How to store datas in the data logger....desesperate!
BERTARH
Posts: 3
Hello! I am actually working with the BASIC STAMP 2px to control a gyroscope....We decided to add the data logger to store the data, but my problem is that I don't know how to do it....I have conected the dataLogger to the basic stamp and I have tried to run the test code, but it stops in the "Syncronizing" message and don't give me any other message.....I don't know why could it be....Could someone help me? I am desesperate with it!! Thanks!
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Powered by enthusiasm
"Baud CON 84 ' Serial Baud Rate 9600 bps (BS2)"
I don't know what the new value for the 2px should be though...
Should be easy to find out
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"You do not really understand something unless you can explain it to your grandmother."
-Lucky[size=-1][/size]
The essential components are:
1. The four pin definitions for Chip Select (USBCS) Data In (USBDataIn)·Data Out (USBDataOut) and·SPI Clock (USBClk).
2. Two preable constats for·writing and reading:
USBPre_W····· CON·· %100
USBPre_R····· CON·· %110
3. The two subroutines to read/write a byte from the device:
USB_Write:
· HIGH USBCS
· SHIFTOUT· USBDataOut, USBClk, MSBPOST, [noparse][[/noparse]USBPre_W\3, IoByte\8]
· SHIFTIN·· USBDataIn, USBClk, MSBPOST, [noparse][[/noparse]Status\1]
· LOW USBCS
· PAUSE 1
RETURN
USB_Read:
· HIGH USBCS
· SHIFTOUT· USBDataOut, USBClk, MSBPOST, [noparse][[/noparse]USBPre_R\3]
· SHIFTIN·· USBDataIn, USBClk, MSBPOST, [noparse][[/noparse]IoByte\8, Status\1]
· LOW USBCS
· PAUSE 1
RETURN
' {$STAMP BS2px}
' {$PBASIC 2.5}
'Programa de prueba para escribir los datos del giroscopo en el data logger
'
'
I/O Definitions
TX PIN 1 ' Transmit Data --> 27937.4 (RXD)
RTS PIN 2 ' Request To Send --> 27937.6 (CTS)
RX PIN 3 ' Receive Data <-- 27937.5 (TXD)
CTS PIN 4 ' Clear To Send <-- 27937.2 (RTS)
'
'
Constants
Baud CON 396
'
'
Variables
value VAR Byte
cont VAR Word
cont2 VAR Word
'
'
Inicialization
DEBUG CLS, "Program to record data and store it on a data logger", CR, CR
PAUSE 2000 ' Allow Time To Settle
HIGH TX ' Initialize Transmit Line
LOW RTS ' Take Vinculum Out Of Reset
PAUSE 2000 ' Allow Time To Settle
' Delete SEEDFILE.TXT if one exists, ignore error if no file exists
PAUSE 500
SEROUT TX\CTS, Baud, [noparse][[/noparse]"DLF seedfile.txt", CR]
SEROUT TX\CTS, Baud, [noparse][[/noparse]"OPW seedfile.txt", CR]
FOR CONT2 = 0 TO 50
FOR CONT = 0 TO 1500
LOW 12
SHIFTIN 9, 11, MSBPOST, [noparse][[/noparse]value\9]
HIGH 12
WRITE cont, value
DEBUG DEC5 value
SEROUT TX\CTS, Baud, [noparse][[/noparse]"WRF ", $00, $00, $00, $07, CR, DEC5 value, CR, LF, CR]
NEXT
NEXT
SEROUT TX\CTS, Baud, [noparse][[/noparse]"CLF seedfile.txt", CR]
DEBUG "CLOSED"
END
How could I use the trim???Or would it work with the SPI mode?...Thank you so much!!!sooo much!!