Go | New | Find | Notify | Tools | Reply |
W07VH5 |
Is there a way to set a non-volatile variable in a microcontroller? Basically, I'm running a latching relay with a microcontroller and I want to give the end user the ability to choose whether the relay is opened or closed upon power up. I'm using Microchip's PicKit3 and I have pic12f675 chips on hand but can change the chips if necessary. I can add a physical jumper to the circuit if that's a better plan.This message has been edited. Last edited by: mark123, | ||
|
Member |
I could do it with a PLC, not familiar with those chips. NRA Life Endowment member Tri-State Gun collectors Life Member | |||
|
W07VH5 |
The final PCB has to be 2" square or smaller. | |||
|
Member |
Never used this part - but based on it's data sheet and app note AN879 , you could probably do this. The app note says there is an ultra low power sleep mode , so this means you could store the data (mode you want) in a register and have it respond accordingly on "power up" The trick is to keep the data alive when it is asleep. A super cap or battery can be used here - depending on how long you want it retained. If all that is too complex , then use a jumper on a pin as you suggest What is application , and what are constraints - answer will change ..... Another thought - use a form C relay and keep the latching code etc simple - the user chooses the relay contacts based on need . . | |||
|
Member |
I know with Arduino you can write to eeprom & have it persist (0.5-4kb, depending on model). I would assume PIC is similar. | |||
|
Member |
Looks like it has 128 bytes EEPROM. so this is good approach. typically you can't write individual bytes , you need to do block writes. Should be documented as to approach required. . | |||
|
W07VH5 |
Thanks. I'm looking into writing and reading to eeprom. I've never used it before. | |||
|
Member |
Don't use EEPROM for storing data that changes frequently. It typically has life of 100,000 writes. (sounds a lot but that is once every 5 min for a year !! ) For storing config data like you want it is good choice. . | |||
|
W07VH5 |
Technically I only need one bit of data that may never change or may change once. Depends on if the end user wants the circuit to be off or on when power is applied. | |||
|
Member |
Yes - for your application it is a good choice - just making sure you don't get too creative and store other changing info there .... . | |||
|
Member |
I use picbasic as the compiler. Simple read and write commands.This message has been edited. Last edited by: nshumway, | |||
|
W07VH5 |
I'm running MPLAB XC8. I'm ok with C but I'm using the free version of XC8 and it doesn't optimize the assembly code. In fact, it looks like the free version purposely bloats the code to make us want to pay for the paid compiler. Any suggestions on other compilers to use with PicKit3? | |||
|
Powered by Social Strata |
Please Wait. Your request is being processed... |