In SX Microcontrollers, SX/B Compiler and SX-Key Tool, UVA BAJA wrote: thanks that helps a lot. we have to take a ton of data at very small time intervals and then record it. that was one of the options that we had been considering. I was also wondering if anyone had some helpful hints about converting the code. I am not very good at it and it is difficult to work on seeing that i am not sitting with the microcontroller here at my desk. PAUSE 120 SEROUT TX\CTS, Baud, ["CD UVAMiniBaja", CR] GOSUB Get_Serial_Bytes ' Open FrontRight.xls for output (write) PAUSE 120 SEROUT TX\CTS, Baud, ["OPW FrontRight.xls", CR] GOSUB Get_Serial_Bytes counter = counter + 1 ' Increment Counter ' Write loop counter value and data separator to DATAFILE.TXT PAUSE 120 'DEBUG "Writing data separator now... ", CR SEROUT TX\CTS, Baud, ["WRF ", $00, $00, $00, $09, CR, DEC5 counter, "**", CR, LF,CR] GOSUB Get_Serial_Bytes PAUSE 120 DIRH=255 FOR i=1 TO 1000 'data acquisition loop GOSUB Get_ADC_Data 'DEBUG DEC3 ADCdata,CR SEROUT TX\CTS, Baud, [ "WRF ", $00, $00, $00, $05, CR, ' writes data to flash drive DEC3 ADCdata, CR,LF, CR] 'DEBUG "say hello, ",CR GOSUB Get_Serial_Bytes PAUSE 1 NEXT ' end of data acquisition loop ' Close DATAFILE.TXT PAUSE 120 SEROUT TX\CTS, Baud, ["CLF FrontRight.xls", CR] GOSUB Get_Serial_Bytes ' Change to root folder PAUSE 120 SEROUT TX\CTS, Baud, ["CD ..", CR] GOSUB Get_Serial_Bytes ' USB Suspend Mode (Power Saving Mode) PAUSE 120 DEBUG "Putting drive to sleep...", CR SEROUT TX\CTS, Baud, ["SUD", CR] GOSUB Get_Serial_Bytes END ' ends program at this point ready for addition of loops Get_Serial_Bytes: timeout = 1 ' Set Timeout Indicator Flag index = 0 ' Initialize Index marker= 0 DO WHILE (timeout > 0) ' While Timeout Has Not Occurred 'DEBUG "hello get serial bytes",CR marker = marker+1 ioByte = 0 ' Clear Temporary Storage SERIN RX\RTS, Baud, 100, No_Data, [ioByte] buffer(index) = ioByte ' Save Byte Received To Array index = index + 1 ' Increment Index IF (index > 14) THEN ' Check For Overflow index = 14 ' Prevent Overflow ENDIF LOOP DEBUG "Do loop ran...", DEC marker, " times",CR RETURN there is some of the code i am working on it right now but so far i am not getting that far. Also if there is any way to optimize the time that it takes to run that would be great. that is the hardest thing that we have come across so far and if the data does not come in fast enough it is invalid and there is no reason to even take it. all we need is the raw data which we can then convert to what we need in excel. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=261082#m261102 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)