Hi,
I've been trying to write some code to read data from the serial port of a solar inverter.
The data is available by polling the inverter with a command string (8 bytes).
The Picaxe (18X) sucessfully sends the correct data string to prompt a reply. I can see the reply in a terminal (10 bytes: $80$80$80$dd$dd$dd$dd$dd$dd$cs) I am using a eavesdrop cable to watch what the Picaxe is seeing.
The data being recieved by the Picaxe is not all there. In fact I was expecting many more bytes (10) but the Picaxe would get stuck waiting for them all as its only seeing only getting 3 bytes (about every 3rd or 4th). I'm running athe the slowest data rate the inverter can support (2400) and here's the relevant code snippet:
Any ideas how I could speed things up a little?
I've been trying to write some code to read data from the serial port of a solar inverter.
The data is available by polling the inverter with a command string (8 bytes).
The Picaxe (18X) sucessfully sends the correct data string to prompt a reply. I can see the reply in a terminal (10 bytes: $80$80$80$dd$dd$dd$dd$dd$dd$cs) I am using a eavesdrop cable to watch what the Picaxe is seeing.
The data being recieved by the Picaxe is not all there. In fact I was expecting many more bytes (10) but the Picaxe would get stuck waiting for them all as its only seeing only getting 3 bytes (about every 3rd or 4th). I'm running athe the slowest data rate the inverter can support (2400) and here's the relevant code snippet:
Code:
ReadInv: ' Read data from inverter
SerTxD ("Poll ")
SerOut InvOutPort,N2400,($80,$80,$80,$00,$01,$01,$10,$12)
for Number = 1 to DataLength
'high LED
SerIn InvInPort,N2400,InChar
'low LED
Write Number,Inchar 'store it temporarily
Next Number
Gosub RdTime
Gosub ReadData ' retrieve data to display
Return