14M/18M Storing Input States? NVMish

Tasp

Member
Hello everyone,

I'm wishing to use a 14m or 18m to do the following things.

1) Use a push button to change state of an output.
2) Store the state of an output in "memory" so that when the power is switched off then back on, the chip retains the states of the inputs. Using only the picaxe chip.

No.1 is not a problem, No.2 now that's the problem.

I've checked out WRITE command in manual 2 page 218, and this is EEPROM so should be safe on power down/up

Could someone suggest some code on how I would go about this please

TIA
 

hippy

Technical Support
Staff member
Code:
#Picaxe 14M

Eeprom 0,(0)

Read 0, bit0
outpin0 = bit0

Do
  If pin0 = 1 Then
    bit0 = not bit0
    outpin0 = bit0
    Write 0, bit0
    Pause 10
    Do : Loop Until pin0 <> 1
  End If   
Loop
 

Tasp

Member
Hippy, thanks for the rapid response!!

I was still writing the code for the inputs and outputs!

I will try to decipher you code with the manual to see what it's doing.

Many thanks
 
Top