I have an application that drives two stepper motors and responds to various commands via hserin. The serial comms needs to run in background to avoid too much interrruption of the stepper drive. Until now I have been receiving a fixed length command string consisting of command letter or letters usually followed by ASCII numbers for setting data. I have been using the hserptr value to branch into the hserin handling routine when the string received is the correct length.
The system has worked well for a couple of years but I now need to adapt the routine to handle data from another device that arrives in variable length strings up to about 16 characters ending in a 'CR'. My problem is how to determine when to call hserin and handle the parsing of the string. Using 'if hserptr = string_length then' in my main loop won't work. I need to detect the final 'CR' and only then parse and process the string.
Command strings are received at variable intervals which could be anything from 500mS to 5 days or more apart!
Any suggestions?
Thanks
Richard
The system has worked well for a couple of years but I now need to adapt the routine to handle data from another device that arrives in variable length strings up to about 16 characters ending in a 'CR'. My problem is how to determine when to call hserin and handle the parsing of the string. Using 'if hserptr = string_length then' in my main loop won't work. I need to detect the final 'CR' and only then parse and process the string.
Command strings are received at variable intervals which could be anything from 500mS to 5 days or more apart!
Any suggestions?
Thanks
Richard