BCD to Hex – How do I perform a shift Left/Right using PBC (Noob question)


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2008
    Posts
    3

    Default BCD to Hex – How do I perform a shift Left/Right using PBC (Noob question)

    Hello All,

    Could some one help a noob with a a very quick problem with using Pic Basic.
    I am trying to perform a conversion from BCD to Hex for a DS1307 Real Time Clock, using 16F84A

    I understand how to perform the conversion, my problem is that the Pic Basic Compiler does not support the simple Shift Left (<<4) / Right (>>4) function that is available in PBP.

    I presume I will have to perform this function using ASM, but am having trouble getting it to work correctly. All a need to do is shift the value store in B0 four (4) places to the right.

    Can anyone help me…..Please !
    Last edited by Biatparto; - 6th March 2008 at 02:06.

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


    Did you find this post helpful? Yes | No

    Smile

    Code:
    B0 = B0 /16 ' / works in PBC (see LET command) ... same as B0 = B0 >> 4
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  3. #3
    Join Date
    Mar 2008
    Posts
    3


    Did you find this post helpful? Yes | No

    Default

    Paul,

    Just tried it and its works....Thanks

Members who have read this thread : 1

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