[sdiy] Retaining button state after power off?
Roman Sowa
modular at go2.pl
Tue Feb 4 13:58:47 CET 2014
IMHO even PIC12 is a slight overkill for this, not to mention PIC18,
which I use in my biggest MIDI controllers and still don't need their
full performance.
Anyway, to cut this discussion I took the freedom to write some code for
PIC12 that circulates 4 outputs with one button and retains after power
off. Expected EEPROM endurance 1000 years (read my previous posts on
this thread if you don't know what I mean). Included in the code is also
100ms debouncing, pretty good for the wire-made switch in the example.
LED state is saved when power voltage drop is detected. Circuit needs
PIC12F683 or any other PIC12 with EE and A/D, one white LED used as
voltage reference, and 10k pull-up for the switch. Don't forget the
mandatory decoupling cap across PIC power pins, which of course I
skipped this time to make it more fun.
Switch input - pin 4, four outputs active high on pins 6,5,3,2 (this is
also circulation order), +5 on pin 1, GND on 8th, voltage reference
(white LED with 1k from 5V, 2.7V in this case) on pin 7.
I tell you, this was fun to do, felt like a teenager again :)
see the video of the test board:
http://youtu.be/IxFbsMwe8IY
sorry for the shaky hand, I was still excited about doing this, holding
the phone in one hand while operating power supply and wireish button
with the other.
below is HEX file for the PIC programmer, feel free to use it, modify,
and make big bucks by putting it in any commercial product.
Roman
:020000040000FA
:040000004620052869
:0800080009006400851D2E288B
:100010003E209F1C0C2805289F149F180D281E08A1
:10002000963C031805288501831671308F004730F0
:100030009B0072089A001C1555309D00AA309D0047
:100040009C141C119C1822289B01831200000000A4
:10005000000026280230F200850036280310F20D39
:10006000721B2A20F219F20D720885000A30F10085
:100070003E20851D3628F10B38280528F001701721
:10008000640000000000F00B4128003407309900A4
:1000900083160930850031309F0011308F004730C2
:1000A0009B001C141A0883121F14F20085000A30EA
:0800B000F1000D30980008007A
:02400E00CC30B4
:02428E0002002C
:00000001FF
W dniu 2014-02-04 05:59, rsdio at sounds.wa.com pisze:
>
> On Feb 3, 2014, at 09:09, Justin Owen wrote:
>> Thanks everyone - seems like a little micro is the way to go for this
>> job. Might let me replace most of my existing circuitry and also
>> potentially let me add some new features.
>>
>> I'll start looking at the ATTiny and PIC12F but anyone with more
>> experience in that area is welcome to suggest some other small/simple
>> options.
>
>
> Don't forget to look into the MSP430 from Texas Instruments. It has the
> FRAM that folks were talking about. I recently did a very quick project
> with it, and it was quite easy to get started and get some firmware
> working. The tools even have a graphical interface for assigning I/O
> pins, timer functions, clock settings, and other specifics. Very nice.
> Texas Instruments have kits that are priced like Arduino, so you can get
> started without investing a lot.
>
> I have a lot of experience with PIC, but you might find the PIC18F
> series more hospitable than the PIC12F. I started a project with the
> PIC16F87, and it's basically required that you write in assembly. I have
> a feeling the PIC12 might be similar. The PIC18F has C language support
> that's better than some of their other 8-bit micros. Many PIC chips have
> EEPROM included as well as Flash, so you can write frequent settings
> changes to EEPROM.
>
> Nothing wrong with ATTiny, they have EEPROM, but no FRAM.
>
> Brian Willoughby
> Sound Consulting
>
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at dropmix.xs4all.nl
> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy
>
More information about the Synth-diy
mailing list