717Views11Replies

# Picaxe 28x2 BCD to Decimal conversion?

Hi, Bit of a daft question really. I am trying to output my clock data from my Pic' 28X2 to a custom array of LED's. I have the code that reads my clock (RTC DS1307) and coverts the BCD input to decimal but no matter what I can't seem to find out how to output the decimal data or have the picaxe arrange it in such a way that it will be displayed on my LED array. My array is, put simply, an LED version of an analogue clock with 60 LEDs for the seconds, minutes etc.

If I could have some pointers with regard to either decimal output or BCD output to a dedicated BCD to DEC chip, that would be much appreciated.

Thanks

## Discussions

Best Answer 6 years ago

How have you connected the 60 leds ?

What do you mean here by decimal output ?

Answer 6 years ago

My LEDs are multiplexed with the common annodes and cathodes connected to all available op pins. And by decimal I mean the standard notation of numerical value ie 0,1,2,3,4 etc as opposed to BCD (Binary Coded Decimal) which, as the name suggests, is in binary where 0001=1, 0010=2, 0011=3 etc. as I previously said I already have a working code to convert binary to decimal but I don't know how to output the converted values to my LEDs. The reason I ask is that I understand it can be difficult to display time information on led displays, whether they be segment displays or big LED boards, in BCD, that's why I mentioned dedicated chips that take a BCD input and convert to a decimal output.

Hope this sheds some clarity, my apologies if I wasn't clear

Thanks

6 years ago

Have you discovered the BCDTOBIN and BINTOBCD commands on the 28x2?

Answer 6 years ago

Hi, I know of them but beyond that no. I created a piece of code, mathematical, that takes the binary variable value and turns it into its decimal equivalent. I couldn't quite figure out how bcdtobin worked. The picaxe manual isn't very informative on the subject!