Shop OBEX P1 Docs P2 Docs Learn Events
Pause problem — Parallax Forums

Pause problem

ssnssn Posts: 4
edited 2009-05-09 05:31 in BASIC Stamp
My question is at the start of the attached program as a comment

Comments

  • Clive WakehamClive Wakeham Posts: 152
    edited 2009-05-08 00:31
    Have you considered the "SLEEP" command instead of the PAUSE command?
  • ssnssn Posts: 4
    edited 2009-05-08 00:53
    Thank you for your reply - I had not thought of sleep... I will try this after I have correcting the drive roller problem on my machine.

    I can also tie the reset to my POR which will hold the chip in reset for about the time that I need. I can also make many do nothing calls to use up time.

    I would like to know why I am getting this reaction for future situations - I don't like not knowing the reason for such a bug.

    Steve
  • vaclav_salvaclav_sal Posts: 451
    edited 2009-05-08 01:25
    Interesting problem, however, define "erratic".

    Inserting valid PAUSE as first code line in Main: should not alter your program execution only delay it.

    However, using SLEEP will a) not insert delay of 1.2 seconds ( see minimal time of SLEEP command)

    b) create "problem" with I/O ( if not taken into count/consideration) - again - see command description.

    Just to make sure - your I/O lines have pull-up / pull - down resistors, right?
    ·
  • Clive WakehamClive Wakeham Posts: 152
    edited 2009-05-08 01:31
    What is pin7 attached to?

    Have you got it tied high (or low) via a resistor to get a known state?

    Maybe the PAUSE lets the pin float in your design putting unknown factors in place.
  • ssnssn Posts: 4
    edited 2009-05-08 02:33
    "erratic" - The program jumps to ANY point in the exe up with no halt
    down twice
    2 - 5 correct cycles
    back to up with no halt
    double feeds
    a complete mess
    and that one command is the cause
    remove it and the machine responds correctly for hundreds of cycles!!! - I just got the drive roller trued up and tested the machine again - I am now at 94 SPM with the pinch roller out of round - this machine is a copy of the orininal prototype that will cycle at 130 SPM

    It is very frustrating to see a copy of my work NOT perform correctly!

    Thank you for your intrest in my problem

    P.S. I do have proper loads on all I/O lines and noise is not an issue - This is self evident
  • Clive WakehamClive Wakeham Posts: 152
    edited 2009-05-08 03:19
    Have you tried to put INPUT5, INPUT6 and INPUT7 after Main: but before the Pause command? But still leave them in the later part.

    Look, I am actually clutching at straws here since I am baffled as you are.
  • ssnssn Posts: 4
    edited 2009-05-08 04:16
    Thank you for your time,
    Tomorrow is a new day - I will solve this problem - I normally do this sort of thing totally on my own - I really do like the fact that you want to help. The chip defaults to input on all pins so that should not matter - pause is the problem - I will try to resolve the issue.

    I am not trying to sound like I know a lot about code but I have programmed at binary level to and from the parallel port for years on another project and have been able to resolve all questions so far - this sounds like a stack over run issue in C but with no crash so how can the device keep going randomly after the first miss step?

    The program now functions correctly without the beginning pause BUT it takes the ram up PAST the flag only at power up. If I stop the sequence using the E STOP and re-start everything works fine - very stable - for thousands of cycyes - I want my demo unit to perfom as well as my patented controller - perfect the first time and every time

    Thank you
    Steve
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2009-05-09 05:31
    All pins are by default inputs as the program starts up. It may help to set pins that will be outputs to a neutral state right at the top. That appears to be pins p0 to p4. Something like,
    OUTS = %00000000 ' outputs will be low, or whatever is best
    DIRS = %00011111 ' p0 to p4 are outputs, p5 to p7 inputs

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.