Using input from Switch to control a loop


Results 1 to 10 of 10

Threaded View

  1. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    try this
    Code:
            SYMBOL PORTB=$06
            symbol TRISB=$86
            POKE TRISB,1 ' PORTB.0 = input, other = output 
            POKE PORTB,0 ' Clear all output
            
    main:
            PEEK PORTB,B0
            if BIT0 =1 then goto loop 'enter loop
            'forward
            high 7 'enable pin
            high 6
            low 5
            
            high 4
            low 3
            high 2 'enable pin
            
            goto main
            
    loop:
            PEEK PORTB,B0        
            if BIT0=0 then GOTO main 'exit the loop
            'backup
            high 7 'enable pin
            low 6 'stop this side
            low 5
            
            low 4 'reverse this side
            high 3
            high 2 'enable pin
            goto loop
    Finger crossed, I don't have PBC
    Last edited by mister_e; - 30th January 2009 at 00:11.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Controlsystem for compact sporting (clay shooting)
    By Fredrick in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 30th July 2009, 16:48
  2. Can't get COUNT to count
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 23rd March 2009, 23:14
  3. Serial Relays
    By tazntex in forum General
    Replies: 3
    Last Post: - 17th May 2007, 17:42
  4. Remote Control receiver - input source switching
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 16th October 2006, 21:20
  5. How can i control pic input pins order?
    By tanero in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th August 2005, 12: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