Write External Data into picaxe is possible ???

lamxe

Senior Member
Dear All...
I would like to put a data pulse EXTERNAL into picaxe only (ie:not user other eeprom 24xx)Please see my picture. If possible it can work, please help me to modifier my bad code. Thank you in advance for your time.
Here my bad code (just for you understand what I would like to do)I am very sorry forget put this code into##
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;picaxe 08m or other...71.GIF
Main:
If pin3 = 0 then
gosub Writ
Else
gosub rea
endif
Writ:
for b0 = 0 to 63 ; start a loop
serin 3,N2400,b1 ; receive serial value;Not suitable for my project
write b0,b1 ; write value of b1 into b0
next b0 ; next loop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Rea:
for b0 = 0 to 63 ; start a loop
read b0,b1 ; read value at b0 into b1
serout 0,N2400,(b1) ; transmit value to serial LCD receive serial value;Not suitable for my project
next b0 ; next loop
 
Last edited:

hippy

Ex-Staff (retired)
@ lamxe : It is unfortunately rather difficult to understand your exact requirements. This may be an issue of English not being your first language in which case it may be worth posting in a language you are more comfortable with - or at least letting us know what that would be - as there may be members who can better help you that way.
 

jtcurneal

Senior Member
Almost all Picaxe chips have memory that can be used for storage of data by direct or indirect addressing. See Variables - Storage in Manual 2.

If you use bptr as an indirect pointer to the data storage area,
You can store the byte data and increment the pointer count with one instruction ( @bptrinc ).

Joel
 

lamxe

Senior Member
Thank you so much, hippy for your advice.
Thank you a lot, Joel.. for your understand my question and reply.
 

lbenson

Senior Member
I don't understand what you wish to do, but there are structural problems with the code you have provided. You have "gosub Writ" and "gosub Rea", but neither routine ends with a "return".

Likewise, your "main:" routine does not end with "goto main", so, as coded, it would just fall through into "Writ", and then that ended it would fall through into "Rea".

But please explain again what you wish to do.
 

lamxe

Senior Member
Forum10.GIF
Dear lbenson.
Thanks so much for your help. My question :
It is possible to user the picaxe as an eeprom ,it mean : after programmed the code for command write and read into picaxe:
*At position command write :
I send an ( EXTERIOR)data ie: 1010111... (pulse) into the picaxe.
(please see my picture) And my code at first post
* At position read :
checker by an led for to know write is resultant or not)
And If possible I can do that, please help me to get the code (read write command code).Thank you so much for your time.
 

lamxe

Senior Member
Dear Hippy
Thank you a lot for your help,98% of what I wanted to find, the rest 2% I will find and practice.
Thank you again for your best guide.
 

lbenson

Senior Member
Regarding your incoming data stream at one pulse per second, is there a clock pulse so that you know when you can read valid data? If not, is there an idle voltage level (5V or 0v) and a start bit (the opposite) so you can tell when to start reading?

With a start bit (say 5 volts after idling at 0V), you could do the following:
Code:
main:
  do
    if pin3 = 1 then ' detected start bit
      pause 1500     ' wait for the middle of the first data bit
      for b13 = 1 to 8
        b0 = b0 * 2   ' shift left one bit
        bit0 = pin3   ' save current bit value
        pause 1000    ' wait for next bit
      next
    endif
    ' now save b0 to eeprom
  loop
Within the "for" loop you could alternatively use any register:

b12 = b12 * 2 + pin3
 
Top