variable to equal low 4 bits of portB, and OUTPUT b4-b7


Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Mar 2008
    Posts
    9

    Thumbs up variable to equal low 4 bits of portB, and OUTPUT b4-b7

    i am putting a 4 bit binary number to portB on a 16f88. there are 8 bits on portB, and this is what i have:

    ____________________
    keyvalue var byte

    keyvalue = PORTB
    ____________________

    now, i want to be able to use b.4-b.7, and not make my code just a ton of if statements. i could do "if (portb.1 == 1 && portb.2 == 1 &&..........." etc, but that is kinda a lot for 9 numbers (i only need values of 1 through 9).



    basically, i want to have the high 4 bits of portB to be OUTPUTS.
    Last edited by reaper0995; - 29th April 2008 at 18:26.

Similar Threads

  1. PIC16F877A for application in mobile robot...
    By mcbeasleyjr in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th January 2009, 14:47
  2. problem with input and output (18F452)
    By turkuaz in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th March 2008, 23:21
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  4. Output PIC module
    By freelancebee in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th September 2005, 20:10
  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