Using 4 input to control 10 output


Results 1 to 8 of 8

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    "its is possible to change from out put to a label? because i will use to control a different output devices for example RC servo, DC motor ,relay etc?"

    sure....

    Code:
    ADCON1=7 ;disable ADC
    
    
    TRISB=$FF
    TRISA=0
    TRISC=0
    
    
    Out1     VAR PORTA.0
    Out2     VAR PORTA.1
    Out3     VAR PORTA.2
    Out4     VAR PORTA.3
    Out5     VAR PORTA.4
    Out6     VAR PORTC.0
    Out7     VAR PORTC.1
    Out8     VAR PORTC.2
    Out9     VAR PORTC.3
    Out10    VAR PORTC.4
    Rinput   VAR PORTB
    
    GetInput VAR BYTE
    Gosub ResetOutputPort
    start:
    
    GetInput=Rinput & $0F ;will mask the MSB bits of PORTB
    
    select case Getinput
         Case 0
            Gosub ResetOutputPort
         Case 1
            Out1=1
            Out3=1
         Case 2
            Out2=1
            Out4=1
         Case 3
            Out5=1
         Case 4
            Out1=1
            Out4=1
         Case 6
            Out6=1
         Case 7 
            Out8=1     
         Case 8 
            Out2=1
            Out3=1
         Case 12
            Out7=1
         Case 14
            Out9=1
         Case 15
            Out10=1
    End Select 
    goto start       
    
                  
    ResetOutputPort:
    PORTA=0
    PORTC=0
    return
    now it's really suppose to match with your specific need.

    NEXT!!!
    Last edited by mister_e; - 4th November 2004 at 17:02.
    Steve

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

Similar Threads

  1. problem with input and output (18F452)
    By turkuaz in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th March 2008, 23:21
  2. LED "capacitance" won't get lower
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 3rd May 2007, 20:31
  3. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 03:46
  4. Using LEDs as light sensors
    By skimask in forum Code Examples
    Replies: 3
    Last Post: - 30th December 2006, 22:19
  5. Can anyone help a beginner in a struggle?
    By douglasjam in forum mel PIC BASIC
    Replies: 1
    Last Post: - 5th May 2005, 23:29

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