PDA

View Full Version : Parallax Memory Stick Datalogger using SPI



djmachine
- 22nd March 2009, 20:44
Hello, I have purchased a Memory Stick Datalogger from Parallax
http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/List/1/ProductID/434/Default.aspx?txtSearch=usb+data+logger&SortField=ProductName%2cProductName

and would like to take the sample code found in the samples on microEngineerings website http://www.melabs.com/resources/samples/submitted/PULSE-LOGGER.pbp

and use it using SPI for this device. I was wondering how difficult it would be to change the code. I am not too interested in keeping the debug statements. Just the basics to be able to create a file and populate it with some data. I am using a Pic18F452 for the job. Any help is much appreciated.

djmachine
- 25th March 2009, 01:51
ok so no replies asof yet so let me ask a different question... after each serout command sent to the datalogger they call the fuction
GOSUB GET_SERIAL_BYTES ' Purge Received Buffer


GET_SERIAL_BYTES: ' Subroutine to get serial byte data

serin2 rx,84,100,phase_out,[iobyte] ' Get byte data
buffer[index] = iobyte ' Load buffer with IOBYTE
index = index + 1 ' Increase the buffer size
if index > 30 then PHASE_OUT ' if more than 30 phase out
return

PHASE_OUT: ' timeout buffers too big
RETURN

I am not familiar with UART communications. Could this purging function be ommited when using SPI?

Archangel
- 25th March 2009, 16:28
I am not familiar with UART communications. Could this purging function be omitted when using SPI?That subroutine causes the pic to put each character into individual bytes of an array, and if the information exceeds 30 characters it dumps the whole mess and starts over.

Normnet
- 26th March 2009, 03:04
For SPI help see SPI clk speed adjustment (http://www.picbasic.org/forum/showthread.php?p=32821#post32821) post #13.
First run program with Shiftin and Shift out.

Norm