decimal input on portB


Results 1 to 9 of 9

Threaded View

  1. #4
    Join Date
    Apr 2015
    Posts
    4


    Did you find this post helpful? Yes | No

    Question Re: decimal input on portB

    Hi all,

    Decimal or Hex ? It's depend of BRANCH syntax. Can I write something like
    BRANCH PORTB [dog, cat,fish] ???


    For nibbles, I can choose between
    initial:
    TRISB = 111111
    SWVAR VAR BYTE
    SWVAR1 VAR BYTE
    SWVAR2 VAR BYTE

    code1:
    SWVAR = PORTB
    SWVAR1 = SWVAR & $0F
    SWVAR2 = SWVAR & $F0

    or code2:
    SWVAR1 = SWVAR >> 4 'Right shift myPortB 4 bits, (moves bits 7:4 to bits 3:0 and then set bits 7:4 to 0)
    SWVAR2 = SWVAR & %00001111 'Mask off bits 7:4 to 0, Only get bits 3:0

    switches will be active when pulling down... Do I change something in my code ?

    Thanks for your time. Have a nice day. Oleg
    Last edited by Sancerre; - 8th April 2015 at 07:54.

Similar Threads

  1. Decimal variable input with HSERIN command
    By pxidr84 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 28th April 2013, 14:14
  2. PORTB.3 Input not working as expected.
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th March 2013, 09:58
  3. Replies: 6
    Last Post: - 12th March 2011, 13:11
  4. portb input problems
    By lockjawz in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 15th February 2011, 15:18
  5. Decimal value
    By leonel in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th April 2005, 16:39

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