I would like to set up a task running under MQX that would "listen" for user input via the virtual COM port. Until the user inputs something, this task is to remain in the idle state.
Since scanf() likes to work on a string, I may need to use a variation of getc() and do my own character handling. But, I'd be OK with that as long as the task remains idle until input is available.
Is there a good example of this?
Thanks
Hello David,
Could you please check the below thread?
Please let me know if this helps!!!
Has anyone modified the MQX serial driver to include a timeout?
Have a great day,
Sol
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Sol,
The link you pointed to is interesting and may be useful sometime in the future. What I did to take care of the problem is just what I suggested in the original post. Since the getchar() blocks for the next character, I just let the task accumulate an appropriate string and than pass that through sscanf(). Since I am not concerned about timeouts (yet), it works for me.
My problem was in looking at fscanf() as compared to the combo of getcchar()/sscanf().
Thanks for your input.