Switch on/off Serial Module
John Wood from United Kingdom  [67 posts]
11 year

I have an very occasional problem that stops my Pic (crash). The cause is unknown but if I can stop/start the Serial Module for say 20sec this would allow the auto reboot of the Pic to accept the serial data without hanging.
When the crash occurs the Serial Module window shows e.g.

3967: \240\240\240\240\.....continues100 ish times.....sent by the PIC? (Seen in red as my Commands from my Pic look)
3968: 00010
3969: 00001
3970: \240\240\240\240\.....repeated 100 ish times.....
3971: 00010
3972: 00001
3973: \240 ...etc...etc

The five digit data is the last sent and could be any combo, no set pattern to use as debugging..
the \240\240 is sent by the Pic
If I stop the serial data and reboot the Pic then all settles down and data is exchanged OK could be hours or 10's mins before it happens again.
I have tried all speeds of data exchange with pause added to the data read write which improved the problem by 90% .
Supply lines all decoupled, tied all unused PIC pins...so rather than spending any more time for the odd glitch is it possible to use the \240\240.... as a "Command" to toggle the Serial Module Off/On.
I have a circuit that sees the crash and auto hard reboots the PIC but after reboot will not communicate while the Serial Module is still sending this repeated data.
I want as near total autonomy as possible..

Any help would be appreciated..
Steven Gentner from United States  [1446 posts] 11 year

Just to clarify, what you are asking for is if it is possible to pause the serial module from sending commands for X number of seconds when a sequence of \240s is seen from the PIC?

If so, you can setup the serial module to accept a response from the PIC using


which should set all resp variables to 240 when you get that sequence. You can then check that if each of these variables is 240 and pause the pipeline for a couple seconds. Not sure if that would help ... or if something similar to that will work.

See attached robofile for if statement example.

John Wood from United Kingdom  [67 posts] 11 year
Thanks Steven,
I tried what you suggested but used my "COMMAND" as the response as I already use it to control the Pipe Line.
I used the If Statement  but use...
"Command" , Contains, Integer, 240
then used the Timer Module.
but it was ignored..
I then in the Serial Module..ticked " send only......." and choose "COMMAND" to clear buffer....
This has up to press allowed recovery to take place without any intervention and the Auto Reboot circuit covers full crashes.
All in all  it is as I require..
That said I would love to use your suggestion as well..
any ideas to get it to work would be appreciated..I know the "COMMAND" does control of the pipline works OK on other controlled functions

Attached screen shot of Serial Module with data before and data after recovery...

Steven Gentner from United States  [1446 posts] 11 year

I think you need a single \ in the receive sequence as in


which tells the module to read in a single character instead of a bunch of characters at a time. The current config would read in multiple 240s which would not compare to a single 240 correctly. But reading things in byte by byte should do that.

Again, as we don't have exactly the same setup I'm guessing a bit at this.


This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index