Dumping EEPROM data

russbow

Senior Member
I suspect what I am trying is impossible.

I am storing data in 24lc256 chips and want to dump the data via sertxd as the result of a button press.

My initial thoughts were going to a dump_it subroutine on button press ->

Code:
dump_it:

#terminal 19200

setfreq m16
serout LCD,N2400_16,(254,1,254,1) 'clear screen

serout lcd,n2400_16,(254,128,"Prepare to dump memory")
serout lcd,n2400_16, (254,148," enter G in terminal")
serout lcd,n2400_16,(254,212," window when ready")


for b0=1 to 32
sertxd (#b0,cr,lf)
next b0


pause 20000

serout LCD,N2400_16,(254,1,254,1) 'clear screen
return
but of course the terminal window does not pop up, and there is no way of checking the "G" anyway. Man 3 does say only during compilation.

Is it a case of pressing f8 first? I feel there is a more elegant solution.
 

russbow

Senior Member
Had a wee think about this.Can you see any problem simply sending the data through the serial out pin of the 20m2 picaxe.. I can use my Eltima rs232 data log program to store it.

In principle, go to dump_it routine

send instruction to LCD to invoke logger on PC

Do / Loop until pin is high

when high, read data and serout

when done, retun to normal prog.

HOWEVER, I can't see a pin reference for the serout pin on the 20m2 chip. I was hoping not to replicate the normal download circuit on another pin.
 

russbow

Senior Member
Thanks GT. Not mentioned on the pin out. Maybe I didn't dig deep enough - all a thought process at the moment.
 

russbow

Senior Member
Doesn't look like A.0 will work.

This passes syntax but no go in simulator.

Code:
#picaxe20m2

do

	high A.0
	pause 500
	low A.0
	pause 500
	
loop
 

russbow

Senior Member
Yes thanks Rossko. Got it sorted. Going back to original idea but using a logger prog instead of the terminal window. Just a minor re-write of the dump routine - easily done.
 

Goeytex

Senior Member
Picaxe Manual 1 page 30; 20M2 doesn't have an A.0 pin you can high/low.
The manual omits that Leg 19 is also A.0. But indeed is. The simulator does not simulate high/ low on A.0 because it was not programmed to for some reason. However it does simulate serout A.0,N4800_8,"Hello World",cr,lf) just fine. That should be a clue along with the fact that the compiler accepts A.0. for both digital output and serout.

The good news is that the 20M2 silicon works fine with both Serout and High/Low using A.0. Sometimes you have to test on the actual chip instead of trusting the simulator. Hopefully Rev-Ed will include A.0 functionality in the simulator with PE6.
 

russbow

Senior Member
Thanks GT. I just want to stuff data up the existing programming lead without having to resort to component changes on the circuit board.
So it would seem that either sertxd or serout would give me just that. Give it a try tomorrow.

PE6? What's that? :D
 

westaust55

Moderator
I suspect what I am trying is impossible.

I am storing data in 24lc256 chips and want to dump the data via sertxd as the result of a button press.

My initial thoughts were going to a dump_it subroutine on button press ->

but of course the terminal window does not pop up, and there is no way of checking the "G" anyway. Man 3 does say only during compilation.

Is it a case of pressing f8 first? I feel there is a more elegant solution.
The [F8] terminal window will not allow you to save the data to PC storage.

Rather than the PE [F8] try the [F9] where you can receive data and then save as a comma delimited file which you can later open in excel.
Your SEROUT commands need to include the commas and LF/CR for end of line characters.

The Datalink via [F9] does have a limitation of 2 kBytes, thereafter it wraps around and you lose first data.
Will wait for up to 5 seconds while not receiving data before it declares the input data stream has finished to time to get the PICAXE sending.

It does not need to be via a separate PICAXE port - I have used the PICAXE board programming port/circuit into the datalink part of the PE with a mini datalogger in a past project (not posted here) using a toggle switch to change between start logging and later in other position to start download to PC.
 

russbow

Senior Member
@Westy. Thanks for that. Just had a play with it, seems to give me what I need.

Will now re-write dump routine to prompt for [f9] and then wait for button press before sending. All looks good.

Thanks a lot. R.
 

Hemi345

Senior Member
The [F8] terminal window will not allow you to save the data to PC storage.
How so? In the edit menu of the terminal window, there is the "Copy Input Buffer" option. I've never tried using it for a lot of incoming data, but for 20 or 30 lines, it has worked well. Paste into Notepad and save as a .csv or whatever.

Does the "Copy Input Buffer" option have the same 2KB limit?
 

westaust55

Moderator
Sorry for confusion.
What I was trying to indicate is that the [F9] datalink will allow you to directly save to a file onto your PC whereas the [F8] terminal app does not allow a direct save from within.
 

russbow

Senior Member
I am still having a problem with this.

One of the options on the datalink panel is " send G "

When is "G" sent and can I use it to initiate my read / send routine, perhaps with code serrxd ("G")

Is it OK to use sertxd to send data out to the data link or serout on the A.0 pin
 

Goeytex

Senior Member
Perhaps the code snip below will help .... I used serout A.0 to show it would work. However serrxd should work just as well. Make sure the datalink is set to 4800 and 2 channels with the graph on.

Code:
#picaxe 20X2
#no_Data
setfreq M4

symbol data0 = b0 
symbol data1 = b1
symbol address = b2


serrxd ("G")

do
   
   for data0 = 5 to 250 step 5  
      let data1 = data1 + 2
      gosub tx_data
      pause 200
   next

   for data0 = 250 to 5 step - 5
     let data1 = data1 - 2
     gosub tx_data
     pause 200
   next 

loop

tx_data:
	
	serout A.0,N4800_4,(#address,",",#data0,",",#data1,CR,LF)
	let address = address + 1
	return
 

russbow

Senior Member
Thanks Goeytex. Have a play with it tomorrow.

I note you are using sertxd "G" to kick things of. Do you know at which point the datalink will send it?

I've had some success with the Eltima RS232 logger software.

Just put the PCB back in it's box ( tight fit ) and now getting garbage on the LCD. First job tomorrow methinks :mad:
 

geoff07

Senior Member
PE6? What's that? :D
PE6 is the (purely theoretical) next major release of the Programming Editor that, if the wishlist is anything to go by, will solve all the known problems of the computer age.
 

westaust55

Moderator
I am still having a problem with this.

One of the options on the datalink panel is " send G "

When is "G" sent and can I use it to initiate my read / send routine, perhaps with code serrxd ("G")

Is it OK to use sertxd to send data out to the data link or serout on the A.0 pin

Yes, if cabled using the standard programming port to PICAXE then you can use SERRXD to receive the “G” character to initiate the data download – that is what the Rev Ed datalogger code does but using separate IO pins.
You could then send the data using SERTXD or SEROUT to A.0 and setting the [F9] datalink speed to suit the PICAXE clock speed for SERTXD or the SEROUT baud rate – both commands should work over the SerialOut pin.

I have used this scheme in the past.
 

russbow

Senior Member
success

Thank you for all your inputs. All working fine now.
The datalink is good for simple dumps, the "G" makes control easy.

There is one annoying thing though. Once the datalink [F9] has been used, I have to do a hard reset to re-program.
A hard re-set is not needed if [F9] has not been invoked.

Any thoughts ?
 

westaust55

Moderator
Think you will find that SERRXD does an auto DISCONNECT so you need to issue a command to reconnect befor a new download.
 

westaust55

Moderator
Usually recollection from a read of the manuals from cover to cover at the start.
Then if chance prevails (ie near PC rather than on iPhone) then try to get manual page for you as well.
 
Top