PDA

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



Biatparto
- 6th March 2008, 02:36
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 !

paul borgmeier
- 6th March 2008, 05:44
B0 = B0 /16 ' / works in PBC (see LET command) ... same as B0 = B0 >> 4

Biatparto
- 7th March 2008, 03:16
Paul,

Just tried it and its works....Thanks