Results 1 to 3 of 3

Thread: another question...

  1. #1
    nathan
    Guest

    Default another question...

    ok.. the tutorial doesn't really explain how to set multiple pins to high and low... so lets say for example i expand it to 2 leds... i have pin 2, and 3 hooked up to led's... how could i set them individually to low, and high? (in c using _outb)

  2. #2
    Administrator T-1000 vikas's Avatar
    Join Date
    Feb 2004
    Location
    Delhi
    Posts
    1,922
    Blog Entries
    14

    Default hmm

    Its simple

    _outp passes 8 bits which correspond to 8 leds in you language .

    so 00000001 is 1st led
    and 00000010 is 2nd led

    to change the state of either similarly OR or AND the current state with the appropiate number and pass the number to the port .

    To turn 2nd on simply OR with 2 which is

    00000000 OR 00000010 = 00000010 ( previous state off )
    00000010 OR 00000010 = 00000010 ( previous state on )

    To switch off

    00000000 AND 11111101 = 00000000 ( previous state off )
    00000010 AND 11111101 = 00000000 ( previous state on )

  3. #3

    Default

    Quote Originally Posted by vikas View Post
    Its simple

    _outp passes 8 bits which correspond to 8 leds in you language .

    so 00000001 is 1st led
    and 00000010 is 2nd led

    to change the state of either similarly OR or AND the current state with the appropiate number and pass the number to the port .

    To turn 2nd on simply OR with 2 which is

    00000000 OR 00000010 = 00000010 ( previous state off )
    00000010 OR 00000010 = 00000010 ( previous state on )

    To switch off

    00000000 AND 11111101 = 00000000 ( previous state off )
    00000010 AND 11111101 = 00000000 ( previous state on )
    can you please be more specific? I don't seem to understand.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •