Hi all again.
I am making good progress and have developed a 20X2 that can read Hserial data in, process it and send it out of a slower software serial port to my graphic LCD module. In the end this will include all of my code for icons, menus, i need for my application, without tying up my main PICAXE with lots of code and delays waiting for the GLCD to catch up...
My problem is that if i smatter it with delays it works, and without them it doesn't. My understanding is that it should work anyway as it only processes data once the HSERPTR has incremented.
The code in my recieving PIXACE 20X2 is as follows:
With the two delays as shown in the code it works well with whatever timings the serial data is sent to it (as long as it doen;t get over 128 bytes before it can catch up)
However it will also work perfectly if i take at all delays, but space the incomming serial data with 800 x 0.25ms delay . (20 bytes making up one instruction, then delay, then next 20bytes etc...)
Is there something strange about the timings of the Harware serial? Eg a min time one has to wait after the HSERPTR has moved, or issues when you are 'GET'ting variables with the PTR while other data is coming in?
In an ideal world i wish to have no resteriction on how the data is sent from my main PICAXE and also no delays in processing.
Any comment/suggesting most welcome.
Thanks
Darosu
I am making good progress and have developed a 20X2 that can read Hserial data in, process it and send it out of a slower software serial port to my graphic LCD module. In the end this will include all of my code for icons, menus, i need for my application, without tying up my main PICAXE with lots of code and delays waiting for the GLCD to catch up...
My problem is that if i smatter it with delays it works, and without them it doesn't. My understanding is that it should work anyway as it only processes data once the HSERPTR has incremented.
The code in my recieving PIXACE 20X2 is as follows:
Code:
main:
HSERSETUP B9600_16,%001
gosub startup 'LCD startup routine
newdatatest:
if HSERPTR=PTR then 'No new data has been recieved
goto newdatatest 'Go loop until it has
else
pause 25 'New data is in, but wait for the data to settle?
endif
get PTR,TEMP1 'retieve that new byte
inc PTR 'now increment the test byte for next test later
if TEMP1<>EOT then 'if its not the end of the tranmsion then
inc DATALENGTH 'Add 1 onto 'datalength so we know what to process later
pause 15 'Another pause to improve reliability
goto newdatatest 'go back and see if there is some more
endif
'If it was the end of tranmission, send it to LCD
do
if LCDSTAT=1 THEN exit 'Check if the LCD is ready
loop
ptr=DATASTART 'Move pointer back to start of selected data
For counter1=1 to DATALENGTH 'Loopthrou selected variables of scratchpad
get ptr,temp1 'Get each byte
SerOut LCDOUT, T2400_16, (temp1) 'Squirt it out to Serial
inc ptr 'Move ptr down to next byte
next counter1 'Increment For/Next
DATALENGTH = 0 'All data sent, reset DataLength for nect time
DATASTART=PTR 'New DataStart to current pointer position (which is now back in the right place)
goto newdatatest 'Return back to data-testing to see if we have another complete transmission to process?
With the two delays as shown in the code it works well with whatever timings the serial data is sent to it (as long as it doen;t get over 128 bytes before it can catch up)
However it will also work perfectly if i take at all delays, but space the incomming serial data with 800 x 0.25ms delay . (20 bytes making up one instruction, then delay, then next 20bytes etc...)
Is there something strange about the timings of the Harware serial? Eg a min time one has to wait after the HSERPTR has moved, or issues when you are 'GET'ting variables with the PTR while other data is coming in?
In an ideal world i wish to have no resteriction on how the data is sent from my main PICAXE and also no delays in processing.
Any comment/suggesting most welcome.
Thanks
Darosu