Using 4 input to control 10 output


Closed Thread
Results 1 to 8 of 8

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    The result will be based on this table

    Code:
    state of inputs          state of outputs
    ==============          ================
    0000                       0000000001
    0001                       0000000010
    0010                       0000000100
    0011                       0000001000
    0100                       0000010000
    0101                       0000100000
    etc
    simple code here...
    Code:
    ADCON1=7 ;disable ADC
    
    
    TRISB=$FF
    TRISA=0
    TRISC=0
    
    
    InputBCD VAR PORTB
    Out1_8   VAR PORTA ;first 5 LEDs
    Out9_10  VAR PORTC ;last 5 LEDs
    GetInput VAR BYTE
    BCDToDEC VAR BYTE
    
    Out1_5=0
    Out6_10=0
    
    start:
    Getinput=InputBCD
    
    Select case Getinput
               Case is<=5
                       Out6_10=0
                       BCDToDEC=dcd Getinput                   
                       Out1_5= BCDToDEC
               Case is>=6
                        Out1_5=0
                        BCDToDEC=dcd (GetInput-6)
                        Out6_10= BCDToDEC
    End Select
    goto start
    it's suppose to work. Try and post reply on this. There's several different way to do this
    Last edited by mister_e; - 3rd November 2004 at 06:12.
    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