German1981
New Member
Hi, I am building a frequency counter and I want to output this value in BCD form on the pins of a BS2. Here is a bit of the code.
freq var word ' variable
Thous var byte
Hunds var byte
Tens var byte
Ones var byte
freq = 2345 ' just an example to test the program
Thous = freq/1000
freq = freq - freq*1000
Hunds = freq/100
freq = freq - freq*100
Tens = freq/10
freq = freq-freq/10
Ones = freq
When I write this code, the only number i am getting returned correctly to me is the Thousands digit. If anyone has any ideas, it would certainly be a great help!
freq var word ' variable
Thous var byte
Hunds var byte
Tens var byte
Ones var byte
freq = 2345 ' just an example to test the program
Thous = freq/1000
freq = freq - freq*1000
Hunds = freq/100
freq = freq - freq*100
Tens = freq/10
freq = freq-freq/10
Ones = freq
When I write this code, the only number i am getting returned correctly to me is the Thousands digit. If anyone has any ideas, it would certainly be a great help!