Thanks. Now do I put the write code before ADC code and read code after ADC codeWrite ADR, Word wX
Read ADR, Word wX
ADR is an even number 0 to 254 ($FE), or a variable holding such a number (*)
wX is a word variable, w0, w1, w2 etc
http://www.picaxe.com/BASIC-Commands/Variables/write
http://www.picaxe.com/BASIC-Commands/Variables/read
* Technically it can be any number but it can avoid coding problems and errors when using word values to use only even numbers.
You have to put the WRITE after READADC or the data being written won't be what the ADC has read.Thanks. Now do I put the write code before ADC code and read code after ADC code
This is my codeYou have to put the WRITE after READADC or the data being written won't be what the ADC has read.
The READ will need to be wherever your project requires it to be.
main:
For b4 = 0 To 3
Readadc10 1,w0
Write w0,w1
Serin 1,N2400,w1
Sertxd (Cr, Lf,#w1," " )
Sertxd (Cr, Lf,#w0," " )
Next b4
If b4 > 3 Then
Endif
For b4 = 0 To 3
Read w0,w1
Serout 0,N2400,(w1,w0)
Sertxd (Cr, Lf,#w1," " )
Sertxd (Cr, Lf,#w0," " )
Next b4
Goto main
If you use the simulator, you will see that you are notAm I not writing it to eeprom 0 to 3 based on examples
Main:
for w0 = 0 to 3
w1 = w0 * 2
Readadc10 1,w2
Write w1, Word w2
next w0
Serin 1,n2400,w1
for w0 = 0 to 3
w1 = w0 * 2
Read w1, Word w2
Serout 0,n2400,(#w0, " ", #w2, CR, LF)
next w0
goto main
If you are saying that hippy's code didn't work, you need to tell us how it didn't meet your requirements.... I tried code did not work
If I recall correctly, the picaxe eeprom is good for 100,000 writes (and maybe many more, but with the risk of having errors). Writing to eeprom many times per second will quickly cause the memory to fail.... continued data stream into memory is not good for picaxe
I think you are going to have to describe in more detail what it is you are wanting to achieve, how you want your program to work, in what order you want things done.I tried code did not work
Main:
for w0 = 0 to 3
do while pinC.3 = 0 : loop ' wait until button has been pressed
w1 = w0 * 2
Readadc10 1,w2
Write w1, Word w2
do while pinC.3 = 1 : loop ' wait until button has been released
next w0
Serin 1,n2400,w1
for w0 = 0 to 3
w1 = w0 * 2
Read w1, Word w2
Serout 0,n2400,(#w0, " ", #w2, CR, LF)
next w0
goto main
' 08readLoadCell
#picaxe 08m2
#terminal 4800
#no_data
pause 2000
sertxd("starting 08readLoadCell",cr,lf)
Main:
for w0 = 0 to 6
do while pinC.3 = 0:loop
w1 = w0 * 2
readadc10 1,w2
write w1,word w2
pause 1000
sertxd (#w0," ",#w2,cr,lf)
do while pinC.3 = 1:loop
next w0
'serin 2,n4800,w1
sertxd (cr,lf)
for w0 = 0 to 6
w1 = w0 * 2
read w1,word w2
pause 1000
sertxd (#w0," ",#w2,cr,lf)
next w0
goto main
starting 08readLoadCell
0 150
1 44
2 312
3 313
4 131
5 28
6 15
0 150
1 44
2 312
3 313
4 131
5 28
6 15