controlling portb output of 5bits in one line


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Posts
    18

    Default controlling portb output of 5bits in one line

    hi ,im new in pic controller.
    im playing with pic16f84a.

    i got a problem programing 5 bits of led from the portb output pins.

    basically,i undestand by

    HIGH 0
    HIGH 1
    HIGH 2
    HIGH 3
    HIGH 4

    PAUSE 500

    LOW 0
    LOW 1
    LOW 2
    LOW 3
    LOW 4

    PAUSE 500


    question is how can i just simply set the output high at any of the bits in just one line.doing the above could take up the memory lines.
    any way i could shortened up the program.

    example if i want to have it in the binary form
    00001 'high on pin1
    11010 'high on pin 1,3 and 4

    thanks..

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    967


    Did you find this post helpful? Yes | No

    Default

    example if i want to have it in the binary form
    00001 'high on pin1
    11010 'high on pin 1,3 and 4
    Simple
    PORTB = $01
    PORTB = $1A

    Happy Easter
    Jerson

  3. #3
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    portb=31 ' or portb=%00011111
    pause 500
    portb=0 ' or portb=%00000000
    pause 500




    portb=1 ' or portb=%00000001

    portb=26 ' or portb=%00011010
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  4. #4
    Join Date
    Apr 2007
    Posts
    18


    Did you find this post helpful? Yes | No

    Default

    its doesnt work ,bro...for both of u..

    so any other way?

    thanks

  5. #5
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Are you running PicBasic Pro or BicBasic Compiler?
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  6. #6
    Join Date
    Apr 2007
    Posts
    18


    Did you find this post helpful? Yes | No

    Default

    pic basic pro compiler

Similar Threads

  1. PICs can do more if use others than delays instructions
    By hardcore in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 24th February 2010, 19:52
  2. shifting problem
    By helmut in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 31st August 2007, 06:11
  3. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 03:46
  4. having problems with Hantronix 20x4 lcd
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 22nd December 2005, 12:22
  5. Output PIC module
    By freelancebee in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th September 2005, 20:10

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