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.

how can i relate these two in MCU?

Status
Not open for further replies.

belinda_sg

New Member
Suppose i have one input voltage to the MCU, said 0.75V, but on my LCD, i want to display the value for 7.2.

how can i set up the relations?

i am using PIC18F2320...
 
Do you want to display 7.5 or 7.2?.... I am assuming you had a typo an you want to display 7.5 from the 0.75V on the microcontroller

So you are going to need a ADC (analog to digial converter), normally a microcontroller has its own build in. Learn how to set it up. The PIC18F2320 has a -bit ADC. So if you use the 10-bit ADC then you know that your steps are 2^10=1024, assume voltage reference of 5V, so 5V/1024 is 4.8mV, or 0.0048V increments.

So after the conversion your 0.75V will be 156. So what you need to do is multyply this number by 48, scaled version of 4.8mV.

Then all you do is spit out the each number to the LCD and make sure you put the dot in the right place according to the scales 4.8mV version.

Ivancho
 
What is your look up table like.????
Then all you need to do is convert the 0.75V with a ADC and have the converted numbet point to your look up table, and "look up" the vaule to display. If you store the values scaled (say 72 instead of 7.2) then you know that you must send a dot after you send the first number.

Ivancho
 
You can not have fraction as index to lookup table. You need to convert 0.75 to nearest integer value i.e. say 1. This will point to 2nd element in the lookup table.
 
kinjalgp said:
You can not have fraction as index to lookup table. You need to convert 0.75 to nearest integer value i.e. say 1. This will point to 2nd element in the lookup table.

It's not really a problem, an A2D only outputs integers, so there's no need for 0.75 to ever exist - just use the integers provided from the A2D.

Even better, in one of the many related threads, she suggests they only want 4 bit resolution - this makes a lookup (or jump) table very, very easy.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top