Read a BCD value (Thumbwheel Switch)


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    May 2004
    Posts
    81


    Did you find this post helpful? Yes | No

    Default

    I’m posting here because I think it’s relevant.

    If your looking for just the upper 4 bits, can you just use My_Variable = My_Variable >> 4? The help file (which is more or less the PBP manual copied) in microcode studio says when you shift values the new values shifted in are 0.

    Example: (and again, I am asking if I am reading this correctly)

    My_Variable = %11110101 ‘I want the upper four bits
    My_Variable = My_Variabel >> 4 ‘Shift left 4 places, shifting in zeros… should now be %00001111

    Is that correct?

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by bearpawz

    My_Variable = %11110101 ‘I want the upper four bits
    My_Variable = My_Variabel >> 4 ‘Shift left 4 places, shifting in zeros… should now be %00001111

    Is that correct?
    Yup! That's right!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Cleaning up code
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd December 2009, 07:14
  2. SEROUT WORD variable problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th April 2009, 11:20
  3. Q: using MCLR for Input on 12F683
    By picster in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 31st January 2009, 15:25
  4. How to read pulse from reed switch
    By passion1 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 9th June 2007, 14:29
  5. Changing declared variables names on the fly
    By jessey in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 16th December 2006, 06:34

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