binary to bcd in software

Discussion in 'Embedded Systems and Microcontrollers' started by harry99932, Apr 28, 2011.

  1. harry99932

    Thread Starter Member

    Dec 30, 2010
    38
    2
    Hi Guys i wonder if you can help me, im fairly new to pics and im trying to implement a shift +3 algorithm. Im just wondering is the carry bit open to all locations i.e if i shift one file left then shift another file left without clearing the bit will i carry the bit shifted out of the first file into the lsb of the second file?

    Probably a simple one but i cant find the answer and i dont have anyhting with me at the moment to try it!

    Best regards,
    Harry
     
  2. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Do you use assembler or some other language. My clairvoyance is somewhat dim today:p
     
  3. harry99932

    Thread Starter Member

    Dec 30, 2010
    38
    2
    Sorry im half asleep <snip> shift work! Im using assembly with pic 16f690
     
    Last edited by a moderator: Apr 28, 2011
  4. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    The RLF, and RRF will shift the current value of carry bit always. The status of of carry bit will always depend on the previous instructions executed. Hope this help. By the way. Questions like this can easy be answered by single stepping through the code. And be able to debug is very important for a programmer. Please take a look at the first post here http://forum.allaboutcircuits.com/showthread.php?t=44852 And take some time to go through the Webseminars I recommend. It will give you a jumpstart in debugging.
     
  5. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
  6. harry99932

    Thread Starter Member

    Dec 30, 2010
    38
    2
    Thanks for the help guys thats what i needed to hear. I try desperatley not use prewritten code for help, gives you ideas but doesnt help you think at the right level, takes a <snip> of a lot longer this way though! Il definatley have a look at the debug topics.

    Cheers for your time,
    Harry
     
    Last edited by a moderator: Apr 28, 2011
Loading...