Continue to Site

# how to convert 8bit binary to milivolt..in PIC16F84

Status
Not open for further replies.

#### theenes

##### Junior Member level 2
pic16f84 multiply

if i use external a/d converter TLC549,8 bit converter integrate with pic16f84..once i scan the 8 bit dataout into a variable register..then how could i convert this 8bit binary data into milivolt value..can anybody help me on this coding,using assembly language..
thanking u in full of anticipation..

theenes

#### Buriedcode

##### Full Member level 6
Hi,

If I understand what you are trying to do correctly, then you are sampling a voltage, and you wish to have the number in milivolts? correct?

Well, I guess it depends on the input voltage range. -5v to +5v? 0-2v? That ADC has two reference inputs, for - and + setting that range of the sampled voltage. It may seem easy to simply 'multiply by 1000' (V -> mV) but thats only if the input range is 1v. To find out what the smallest increment of voltage you can measure (LSB) simply divide your input range by 256, for 8-bit resolution. For 5v this would be about 19.5mv.

Once you have this value (again, depends on the voltage range) you can then store this value in a register. And, when you convert your voltage to an 8-bit number, multiply the two together. Eg: You get 134 from a conversion. 134*19.5mv = 2617mV. The 'ol F84 doesn't have a hardware multiplier, but there are some simple tricks to do multiplication on PICs. And anyway, that is just one method of doing what you are trying to do.

Please inform us of your voltage range (minimum/maximum voltage to be sampled). Because sometimes, its easier to reduce the signal in analogue (voltage divider) and sampling over 1v to make it easier to convert voltages in software.

Hope this goes some way to helping you.

BuriedCode.

### theenes

Points: 2

#### theenes

##### Junior Member level 2
thanks for ur reply..yes,u got the right understanding of my question..
so,actually the reference voltage is from the range of 0 to 5 volt..and as u said the resolution is 19.5mv..so how do i do multiplication for pic16f84?..for example..if i get the 10001111,so in decimal is 143..so it must be times by 143*19.5mv..to get the answer,rite..how to do it?i hope u can help me with the coding...i hope u will guide me..appreciate ur help a lot..

Status
Not open for further replies.