Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

outputting BCD values on a basic stamp

Status
Not open for further replies.

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!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top