sending byte data from picaxe to .csv file on PC

Bellgrove

Member
I want to send a stream of bytes (numbers stored in 28X2 scratchpad) to a PC for later analysis in Excel. I've made it work slowly using the program listed below, based on the example program "AXE110-Datalogger Upload.bas" which uses the "Datalink" terminal.
I can only get this to upload successfully with the long 500ms pause between sertxd sends.
Curiously the window at top right of the Datalink terminal shows all the bytes sent even without any pause, but only the first few points get onto the plot in the graph window and only those are exported to .csv file.
Can anybody suggest a better way to get the data across?

' Load test data into scratchapad
for b0=0 to 127
b3=b0+100
put b0,b3
next b0

'Define useful ASCII characters
symbol COM = 44 'comma
' CR and LF are already defined within compiler

' The PICaxe "datalink" monitor misses the first data sent
sertxd(COM,99,CR,LF) 'dummy

main:
; Start of proper data upload
for b0 = 0 to 127 'Start a for..next loop.
get b0,b2
pause 500 ; this delay seems to be necessary for reliable uploading
sertxd(COM,#b2,CR,LF)
next counter 'Next loop.

serout C.7,N2400,(0) 'Send null to end.
end
 
While I have not used the specific Datalink terminal, I have used several methods for receiving data from (or sending data to) PICAXEs. These ranged from sending CSV formatted data to the PICAXE PE Terminal and clicking 'Save' to using the PuTTY App to log and store output.

Once the csv data is in Excel in that format, it can be saved in an XLSX format but I'm guessing you're on top of that process.

PuTTY has the advantage of the user being able to configure and save these session configurations Eg Identified by COM port ID and Baudrate (or your unique project name), various category pages including logging requirements. The logging configuration can be set up to create a new log file, with Date and Time embedded in the filename every time PuTTY is opened and the session config is selected. I'm sure there are other apps that do similar things but I've been using PuTTY for over 25 years now so it is pretty familiar to me.
 
This was a project I looked into back in 2012

I used PLX-DAQ serial to excel freeby to generate real time graphs.
this application was for a radar scanner using a SFR005 ultrasonic unit.

hope this may help
Code:
picaxe 18m2
#No_Data
pause 1000
setfreq m8

symbol servoCount        = b0
symbol counter1         = b1            'counter
symbol asciihd        = b2
symbol asciiten        = b3
symbol asciiunit        = b4
Symbol range            = w10            'front range sensor register
Symbol trig         = b.3            'front range sensor ADC input    
Symbol SERVO1           = b.0            'Pan servo output


Symbol SERVO1_MIDDLE    = 145 
servo servo1,SERVO1_MIDDLE 
main:
    gosub scan1
goto main
scan1:
for counter1 = 1 to 80
    servoCount = counter1+40
    ServoPos SERVO1,servoCount
    pulsout trig,2                ' produces about 20uS pulse (must be minimum of 10uS)
     pulsin trig,1,range          ' measures the range in 10uS steps
       pause 10                       ' SRF005 mandatory 10mS recharge period after ranging completes
        let range = range * 10 /29     ' multiply by 10 then divide by 29  (8meg) 
        bintoascii range,asciihd,asciiten,asciiunit
    sertxd ("DATA,",asciihd,asciiten,asciiunit,13,10)
    pause 200
next counter1
sertxd ("CLEARDATA,",13,10)
return




scan.jpg

regards Bill
 
Back
Top