SEROUT loop with pause


Closed Thread
Results 1 to 4 of 4
  1. #1

    Default SEROUT loop with pause

    Force of habit or maybe there was a reason I put a pause after serout in a loop. I know that I discovered the hard way that I needed to do that in Python to keep the cpu from working too hard (and a little bit of pause made a huge difference).

    But what about PIC's ?

    I simply have --
    START:
    DO STUFF
    SEROUT PORTA.0 T2400 (ETC)
    PAUSE 200
    GOTO START

    Actually, I need to reduce it to 50 or so because I have it feeding a PI with a python script that's reading it but what effect does a pause have with a PIC's performance? Is a pause "good practice" or completely unnecessary? -- thanks much

  2. #2
    Join Date
    Aug 2011
    Posts
    408


    Did you find this post helpful? Yes | No

    Default Re: SEROUT loop with pause

    Completely unnecessary, just like it is with python on the PC.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: SEROUT loop with pause

    Ok thanks. Yeah, I can't remember but it may have been a VB.net program that I needed to slow down the loop to keep it from hogging the cpu. I have the python script reading the PIC, so I may take out the pause I have there also and see. The python serial input command I think just sits there and waits anyway for valid data.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,518


    Did you find this post helpful? Yes | No

    Default Re: SEROUT loop with pause

    On multi core / multi threaded CPU and programs commands like "PAUSE" and "SLEEP" etc usually releases "control" of the CPU so that that other process/threads can gain access to it for the durations of the "sleep".

    With PBP that's simply not the case, PAUSE (just like almost all PBP commands) are blocking. In your case, the purpose of the PAUSE would be to "pace" the output, there's no other benefit or "good practice".

Similar Threads

  1. Replies: 6
    Last Post: - 28th October 2014, 07:08
  2. Do I need a pause?
    By tazntex in forum Serial
    Replies: 21
    Last Post: - 29th August 2008, 05:32
  3. Pause
    By blue in forum General
    Replies: 7
    Last Post: - 29th December 2005, 15:24
  4. pause 0.5
    By detail in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th June 2005, 12:32
  5. pause loop lockup with mplab sim
    By power67 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th February 2005, 14:10

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts