20X2 hser background problem

ferrymanr

Member
I have been struggling with lost or corrupted characters using hsersetup, get characters from the scratchpad and hserout. The problem is definitely on input as debug data is wrong. Hsersetup is set for background operation. My program does not use PWM or interrupts but does use pulsout and pause commands. If I run just the serial input routine and feed the results out with hserout it works perfectly. The serial data on hserin line ( B.6-IC pin 12) is clean and correct.

My program uses a lot of basic math and is required to a create pulses to a stepper driver and needs to run at 32MHz. The main program works well but when the whole program is running I miss characters or get garbage on the serial input.

Is there any interaction between pulsout or pause commands and hser background operation? Is there anything that would write to the serial input scratchpad?

Can someone point me the right way.

Thanks
Richard
 

hippy

Technical Support
Staff member
There seems no reason the serial receive should be failing but it does depend on exactly what you are doing; if the PICAXE gets tied up doing something it can miss incoming serial. If it does something which changes the operating frequency then that can mess things up.

Perhaps post your code so we can take a look at it.
 

ferrymanr

Member
Found the problem. The resetting of hsptr is critical in that it must be reset AFTER 'get'ting the characters from ther scratchpad and I now monitor hsersptr in my main loop and call the reading routine when hserptr > 7 (Ireceive blocks of 8 characters). The effect was missing the lead character that defined message type.
Richard
 
Top