Code trouble


Results 1 to 5 of 5

Thread: Code trouble

Threaded View

  1. #2


    Did you find this post helpful? Yes | No

    Default

    I would have to say your problem is using an "IF" statement inside the "FOR...NEXT" loop. Also you do realize the PAUSE 1 = 1mS and not 1s. I also noticed there is not main program loop, do you in fact what the program to stop once it has read the pulse width?

    Code:
    start:
    counter = 0
    
    loop:
    counter = counter + 1
    pulsin 4,1,pulsewidth
    if pulsewidth >150 then
      gosub switch
      endif
    if pulsewidth=0 then 
      gosub blink 
      endif
    pulsin 4,1,pulsewidth
    pause 1
    if counter = (looptime - 1 ) then
      gosub wakeup
      endif
    goto start
    
    switch:
    blah, blah, blah...
    return
    
    blink:
    blah, blah, blah...
    return
    
    wakeup:
    blah, blah, blah...
    return
    Last edited by CocaColaKid; - 24th August 2005 at 01:29.

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Microchip MCP41xxx Digital Potentiometer Code Trouble
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st August 2005, 18:21

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