New user with PAUSE command problem


Closed Thread
Results 1 to 7 of 7
  1. #1
    Howy's Avatar
    Howy Guest

    Default New user with PAUSE command problem

    Hi All,

    I seem to be having a problem when I use the PAUSE command in my code (basically renders the program inoperable).

    I've reverted to the blink.bas example code to try a figure out what's going on here. I'm using PIC16F84a controller,the PicBasic Pro Compiler and MELabs's serial programmer.

    I am confident that the circuit is wired correctly. The controller seems to be functioning to some degree as I am able to set PORTB.0 and PORTB.1 HIGH and have the LEDS light as expected. However, when I introduce a PAUSE command into the code nothing happens.

    I have used mutiple 16F84A's so it does not seem to be a hardware problem. I have substitued a 4Mhz crytal/capcitor with a 4 Mhz resonator (and have verified that both are working with a frquency counter). Voltage to all pins reads correctly.

    I have also played with every setting on the programmer.

    Funny thing is this circuit worked before.

    I know I must be doing something wrong here ... but for the life of can't figure what. Any help or ideas would be greatly appreciated ....

    Howard.

  2. #2
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Howard,

    Howard>>I know I must be doing something wrong here ... but for the life of can't figure what. Any help or ideas would be greatly appreciated ....<<

    The pause command works great... If you can give us a water down code that shows where the pause does *not* work, maybe we can take a look at it....


    Have you tried Pauseus or slower Pause command to verify?
    Like Pauseus 1? then Pauseus 10 etc?

    I thought I ran into something like this with the 688, until I found out the speed was set to the lowest of 34khz? And my program crawled....while I thought it was dead.

    And, just to through out a few other things...Are you sure the pin you are checking is set as a output pin? Are you sure the pin you are using *IS* a i/o pin?

    Are you reloading a a HEX file, instead of recompiling it and reloading it? Nothing like having a working hex file, and the code that is in the window does not match the Hex file <g>.


    Dwayne
    Last edited by Dwayne; - 5th August 2004 at 19:23.
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

  3. #3
    Howy's Avatar
    Howy Guest


    Did you find this post helpful? Yes | No

    Default

    Dwayne,

    Thanks for the reply. No matter where I place the PAUSE command the problem occurs. It seems to be related to the fact the the PAUSE simply exists somewhere in the code. For example ...

    loop:
    high PortB.0
    low PortB.0
    goto loop

    works fine. LED lights.

    loop:
    high PortB.0
    low PortB.0
    goto loop
    PAUSE 500

    or,

    PAUSE 500
    loop:
    high PortB.0
    low PortB.0
    goto loop

    does not work.

    I have also experimented with the PAUSEUS command and varying the period on both PAUSE commands.

    A frquency counter shows the crystal to working as expected at 4MHz and the LED pin at 105KHz. When I add a PAUSE to the code LED pin reads 0 KHz.

    Hope this info helps ...

    Howard

  4. #4
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Howard,

    if the code examples really are what you have tried, PAUSE is working as designed.


    loop:
    high PortB.0
    low PortB.0
    goto loop

    works fine. LED lights.
    >> In this example the LED is turned on and off over and over again, it is on about 50% of the time and due to the execution speed of the program you cant see any flickering.



    loop:
    high PortB.0
    low PortB.0
    goto loop
    PAUSE 500

    >>see first example, the Pause command will never be executed as there is a Loop....Goto Loop

    or,

    PAUSE 500
    loop:
    high PortB.0
    low PortB.0
    goto loop

    >> This is almost the same as the other two examples, with one difference, there is a 500ms delay until the loop starts.

    try this:


    loop:
    high PortB.0
    PAUSE 500
    low PortB.0
    PAUSE 500
    goto loop


    rgds

    Ralph

  5. #5
    Howy's Avatar
    Howy Guest


    Did you find this post helpful? Yes | No

    Default

    Dwayne and Ralph,

    Thanks so much for your help!! I reinstalled both PBP and the programmer and guess what ... IT WORKS!!! I just wish I knew why it failed in the first place.

    Thanks again Guys!!

    Howard

  6. #6
    CBUK's Avatar
    CBUK Guest


    Did you find this post helpful? Yes | No

    Default

    if you re look over your program....

    loop:
    high PortB.0
    low PortB.0
    goto loop
    PAUSE 500

    imagine that the lines are being processed and scanned in less than micro seconds, you send portb.0 high, then microseconds later you are telling it to turn off. now that output is on for micro seconds, but our eyes react way to slow to beable to see this. so yes the program is working, but do as whats been done in the above post and put in a pause between the highs, and lows

    Chris

  7. #7
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Howard,

    H>>Dwayne and Ralph,

    Thanks so much for your help!! I reinstalled both PBP and the programmer and guess what ... IT WORKS!!! I just wish I knew why it failed in the first place.

    Thanks again Guys!!<<

    Your welcome!!! Have some fun with that chip of yours, and Don't pause too long, or you will get tired of waiting!

    DWayne
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

Similar Threads

  1. Delayed output 10 secs
    By lilimike in forum mel PIC BASIC Pro
    Replies: 37
    Last Post: - 14th October 2011, 06:28
  2. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  3. Replies: 11
    Last Post: - 12th July 2008, 02:36
  4. Fade out LEDs question
    By Sam in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 22nd June 2008, 10:50
  5. Help Quick Need to make code smaller
    By Programmednew in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 25th January 2005, 03:46

Members who have read this thread : 0

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