Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Question on logical equation on my C programming.

Status
Not open for further replies.

maniac84

Full Member level 6
Joined
Mar 4, 2012
Messages
337
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
3,661
Hi guys,
I have a situation on my C programming here and just wondering whether my solution is the correct way:

I have a LED display with particle count sensor and will show 6 digit of seven segment numbers as the count value. The sensor will give voltage input value. The input is from 0V to 10V. So the range of 0V-10V need to be shown in the display as 000000 to 999999 count.
My solution is:
Display number = Input voltage * 99999.9
For example:
Display number = 10.000*99999.9=999999
Display number = 5.500*99999.9=549999
Display number = 2.300*99999.9=229999

Is this the correct solution? I notice that I will get a lot of 9 on the display value.
 
Last edited:

ud23

Advanced Member level 3
Joined
Apr 20, 2011
Messages
926
Helped
185
Reputation
370
Reaction score
180
Trophy points
1,323
Activity points
6,138
Code:
Display number = 10.000*99999.9=999999;
Display number = 5.500*99999.9=549999;
Display number = 2.300*99999.9=229999;

What you want to do with this logic?If i understand correctly if your input voltage is 10 v you want to display as 10.0000 v then why you multiplying it with 99999.9?what is final display value i mean how many decimal point value to be display ?
 

maniac84

Full Member level 6
Joined
Mar 4, 2012
Messages
337
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
3,661
Code:
Display number = 10.000*99999.9=999999;
Display number = 5.500*99999.9=549999;
Display number = 2.300*99999.9=229999;

What you want to do with this logic?If i understand correctly if your input voltage is 10 v you want to display as 10.0000 v then why you multiplying it with 99999.9?what is final display value i mean how many decimal point value to be display ?
Nope. If input is 10V, the display will be showing 999999 which is the max value of the particle count.
All round number. No decimal point.
 

ud23

Advanced Member level 3
Joined
Apr 20, 2011
Messages
926
Helped
185
Reputation
370
Reaction score
180
Trophy points
1,323
Activity points
6,138
ya so your logic should work.it is simply y=m.x; and it would be linear if your input voltage is linear.
 

maniac84

Full Member level 6
Joined
Mar 4, 2012
Messages
337
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
3,661
ya so your logic should work.it is simply y=m.x; and it would be linear if your input voltage is linear.

I see.
But is it the most suitable solution? My display value will get lots of 9.
 

ud23

Advanced Member level 3
Joined
Apr 20, 2011
Messages
926
Helped
185
Reputation
370
Reaction score
180
Trophy points
1,323
Activity points
6,138
I see.
But is it the most suitable solution? My display value will get lots of 9.

this logic working and reason for getting many 9 is your input voltage reading for example if you can read your input voltage=5.5495 then your output 554949 so i don't know your adc bit resolution if you can read voltage with micro voltage accuracy then this logic work with less 9 or accurately.
 

maniac84

Full Member level 6
Joined
Mar 4, 2012
Messages
337
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
3,661
this logic working and reason for getting many 9 is your input voltage reading for example if you can read your input voltage=5.5495 then your output 554949 so i don't know your adc bit resolution if you can read voltage with micro voltage accuracy then this logic work with less 9 or accurately.

My ADC only support up to 3 decimal point...
So, I'll get lots of 9 behind.. =(
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top