Picaxe 08M with 64 megabytes of memory

moxhamj

New Member
64Mb to 2Gb of memory. Very simple interface. The program below demonstrates writing one byte to a location in ram and then reading it back. Schematic attached. Works at baud rates of 300 to hundreds of k, but tested at 2400 because this is simple for an 08M.

Traps - watch that you don't bump the top of the memory module otherwise the ram chip can half pop out and then it doesn't work.

Code:

high 1 ' must start with a high
pause 1000 ' wait for module to boot (300-400ms)
serout 1,T2400,("U") ' sets baud rate to whatever send U at
serin 2,T2400,b13 ' read back ack or nak
w1=123 ' set up address msb to lsb = b3,b2,b1,b0 w1*65536+w0 0-64Mb or up to 2Gb
w0=3124
serout 1,T2400,("@A",b3,b2,b1,b0) ' set address to write to/read from
serin 2,T2400,b13 ' read back ack or nak
b4=37 ' test byte to write
serout 1,T2400,("@w",b4) ' write a byte - this increments counter
serin 2,T2400,b13 ' read back ack or nak
serout 1,T2400,("@A",b3,b2,b1,b0) ' resend the address counter
serin 2,T2400,b13 ' read back ack or nak
serout 1,T2400,("@r") ' read a byte
serin 2,T2400,b13 ' get the byte to read back
debug ' display it
 

Attachments

Last edited:

hippy

Technical Support
Staff member
Excellent work. You may want to consider putting a copy in the completed projects section so it can be more easily found later.
 

moxhamj

New Member
Good suggestion. Added to miscellaneous section.

This is so much memory, I don't know quite what to do with it all. With wireless links, one memory module could serve many picaxes.
 

hippy

Technical Support
Staff member
You could take a 2GB SD Card and log the temperature every second for 60 years :)
 

MFB

Senior Member
Good work and well done! An uncomplicated mass storage facility for the PICAXE at last. A uDrive is on its way to me from SparkFun at this very moment (thank you Santa).
 

moxhamj

New Member
Resellers are all over the world (including sparkfun in the US and 3 in the UK) http://www.4dsystems.com.au/distributors.php

Have a read of the manual as well. There are a couple more features -
* A bulk mode with 512 bytes at once.
* The automatic incrementing of the address counter so you don't need to send it every read or write.
* 64mb to 2Gb. I think 64mb is the smallest because ones smaller than that are hard to get now. w0 and w1 is 2^32 which sets an upper bound of 4Gb. Surely that ought to be enough for anyone?!
 

papaof2

Senior Member
The original Mac had 128K.
Bill Gates once said "No one will ever need more than 640K."

I'm sure someone will find a reason to collect/store more than 4GB with a PICAXE ;-)

John
 

manuka

Senior Member
Young Bill also said (1987) " I believe OS/2 is destined to be the most important operating system, and possibly program, of all time". History shows he's not always right...

Given today's solid state bonanza, with GB memory sticks almost as disposable (& loosable) as ballpoint pens, it's certainly nice to be able to stash away the Megs/Gigs like this. Naturally some sort of indexing/timestamping etc would be needed to assist in making sense of all the info, with the DS1307 Real Time Clock (RTC) perhaps the obvious choice -for I2C PICAXEs anyway. Dr_A: Is this data readily, & more rapidly, read by a PC attached SD card reader?

"Ozzies own" 4D Systems have quite a range of nifty products, including a recently released Development Board => http://www.4dsystems.com.au/prod.php?id=30, hosting a readily driven GLCD (see below), & are very receptive to bright ideas.

The thought of using this 4D board with (say) an 18X for a self contained logging/display system naturally arises, with the likes of mains energy monitoring an obvious task. However this energy field is already pretty well covered by the likes of the cheap UK "Current Cost" meter, which is able to hold months of data.
 

Attachments

Last edited:

moxhamj

New Member
Good points there manuka.

Did you manage to find a sample in that junk pile?

If so, I think this might be ready for a little article in Silicon Chip? Maybe combine with a RTC as you say and do it with an 18X but mention it can still run with an 08M and all the other picaxes too.

The key trick to getting this working was to note that all commands result in a single byte being sent back by the module - either an ascii ack or nak. (ack is 06) - or in the special case of a read, the byte to be read. Good old xmodem protocol commands. Anyway, when I first wrote the code I had delays after each command, and sometimes it would work and sometimes not. The problem was the delay kept changing - and to make it guaranteed to work involved a long delay. But once I changed over to a serin waiting for the byte to come back, the delays were not needed. You could run code to resend a command if you got a nak back but it seems 100% reliable.

Re using an SD reader, one could also send data the other way, from the PC to a picaxe. Eg one could download tables for fonts etc onto the card. Pictures as well, and then transfer them over to lcd graphic modules one byte at a time.

Re reading directly off a computer, the chip that went in the module is very tiny but they sent me a free adaptor so it fits into an SD reader as well. I presume you could read the raw data off with an SD reader - I haven't got one but the data ought to be there and in order too.

Or you could interface directly with the serial port via a max232 and a small .net program.

Or via a picaxe - which again would be pretty simple.

So three ways to read/write data.
 
Last edited:

centrex

Senior Member
Hi Dr A
The 4D device looks very interesting.
Can you please explain how you set up the memory addressing of the device please as I am at a loss to see what you are doing.
Many thanks.
 

moxhamj

New Member
The address is just a random number, anything from 0 to 64Mb. I just picked a big number to prove it really can read and write a byte at that address. In real life you would probably start from 0. And every time you send a byte the modules increments an internal counter. You probably would want to keep track of that with a counter on the picaxe too.

w0=0, w1=0
w0=1, w1=0
...
w0=65535, w1=0
w0=0, w1=1 etc

You need 4 bytes to send an address up to 4Gb. eg 2^8 = 1 byte and 2^32 = 4*8 ie 4 bytes. Sorry, hitting you with some exponential maths there.

Think of it from the point of view of the designers of the module. What is the simplest way to send a big number, eg 1 billion? Answer is 4 bytes.
 
Last edited:

centrex

Senior Member
Thanks for that I should have realised you were only sending to one location.
Certainly appears the way to go for a data logger etc.
I just wish Aus companys gave prices in Aus dollars but I suppose the Aus market is very tiny.
Thanks again
Centrex
 

moxhamj

New Member
Agree re the $US. I note that sparkfun sell them for $US37.95 and 4dsystems are only $US29.95. Don't forget to get a memory card too ($US6.95).

http://www.4dsystems.com.au/shop/

For Australia it is definitely better to buy direct. For anyone outside Australia, I'm not sure how it compares with postage from Sydney vs the various markups others have.
 

centrex

Senior Member
Hi Dr
How far have you got with the wireless thingy you were playing with. I havent seen any posts for awhile.
centrex
 

moxhamj

New Member
Wireless boards just left Beijing (I'm getting regular updates from TNT couriers. Hopefully will get here before xmas.)

I have 10 CP/M boards soldered up and ready to go once the wireless boards arrive. Enough for some proper mesh tests.

The wireless boards have some picaxes for I/O. So one could see this as a CP/M board with picaxes, or, as I prefer to see it, picaxes with a CP/M extension.
 
Last edited:

centrex

Senior Member
Hi Dr A
Just wondering have you done anymore playing with the micro SD card interface, I have been giving some thought to the purchase for a data logger but one byte at a time?
Would be most interested in yours or anyone elses thoughts.
 

MORA99

Senior Member
Vdrive made something similar a long time ago for usb sticks, here you can write several bytes at a time, and create files that can be read on a standard pc.

So you could create an ascii log file that can be viewed on pc without extra software, but that would use upto 20bytes per entry (But that would still last for years with a log per second on a 4gb stick)

openfile appends per default, so no need to keep track of carret position, just openfile, write and close.

http://www.picaxeforum.co.uk/showthread.php?t=6325
 

BCJKiwi

Senior Member
DrA's example is great for byte by byte local storage or storage where you have the capability to read the data off with some other application if required.

Alternatively if a data logging application is required with simple exchange with a PC, then there may be a requirement for a file system.
VDRIVE2 has such a file system and is usable on serial but for i2c or SPI (or serial) go with the uALFAT from GHI Electronics.

These options have the advantage of msdos file structures so the USB, SD or MicroSD=TF=Transflash card (or whatever card type you have decided on when buying the uALFAT) can be plugged right into a PC for analysis.
There is a sample application here http://www.picaxeforum.co.uk/showthread.php?t=8513 which just logs time to a .CSV file. The actual application of which this is a subset logs other data as well as time. The card is then just plugged into a PC and read with Excel or whatever.

Whether or not a file system is required depends entirely on the application.
 
Last edited:
Top