Help! Converting float to bcd in Logix5000

saltykarp

Member
Join Date
Nov 2011
Location
Oregon
Posts
11
Can someone help...?

In Logix5000, I am trying to convert float/real numbers to bcd. I used a TOD function to convert a binary to bcd. So if I put in an 12 (0000 0000 0000 1100), I would get in bcd: 0000 0000 0001 0010.

But how would a float number work? How would I do it if I needed get a bcd from a number such as 128.44?

Then I would take that number and display it on a BCD-7 seg display.

Thanks
 
Is the decimal in a fixed location on the 7-segment display ?

If so it seems you'd just multiply by 100, then convert to BCD.

Explain more about what you actually want to display.
 
I have a real number input to my system. This number will be displayed in a bcc-7 seg LCD display. The number will have a decimal point. There are 5 digits and the decimal is fixed allowing 3 places after the decimal. The number could be 12.200 or .654, etc.

Is there a conversion to make decimal numbers to bcd? If so, how? And I would probably need to truncate it to fit my desired size for my LCD display
 
Multiply the float by 1000.0 then MOV it to a DINT. That may round (depending on what is left after the decimal point) but at least you will have within .001 of the original value. Let the TOD operate on that. Then send the 4 bit sections to the appropriate digit. It depends on your display setup on how that last is done.
 

Similar Topics

I need help converting from a floating register to two integer words. I'm using a SLC 5/05 and need to be able to write 32 bit data to a servo...
Replies
2
Views
4,717
Hello nice to meet you, im new in here, I'm currently trying to convert code written in STL for a S7-400 to SCL for an S7-1500, because when i run...
Replies
5
Views
331
Hi! I am working on a project were we will be replacing an 300 CPU with a 1500 CPU and we are working on migrating / converting code. There is a...
Replies
9
Views
1,080
Hi! I need help converting an old MicroLogix 1100 project to Micro 820. Project Details I have an old MicroLogix 1100 program that has been in...
Replies
0
Views
478
Hope someone is really bored this late on Memorial day!!! I have spent the last 5 hours researching this and trying everything I could find on...
Replies
9
Views
3,284
Back
Top Bottom