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.

problem of re-scale the analog input..

Status
Not open for further replies.

meera83

New Member
i m asking to do an assigment(PIC16F877-ASSEMBLY LANGUAGE) which the input is analog 5-10V, but the output that i want to show on the LCD rescale became 0.00-10.00(decimal number)...:(

may i know that where can i get the tutorial about this kind of assembly code??:confused:

thanks..
 
bananasiong said:

yap, before that i already go through with the tutorial there..
the tutorial is about input(0-5V), then the output on LCD display show decimal (0-1023) because ADC got 10 bit..:)

my problem is i have no idea to re-scale my output on LCD show 0.00-10.00 that depend on input voltage 5-10V..:(

is it possible that i insert formula like y=4x+3 in program code, i use assembly language to write program, so how to write this formula by using binary code??:confused: :confused:

thanks..:eek:
 
The output of the analogue convert gives 0 to 1023, so if you divide it by two (a simple logical shift), this then gives 0 to 511. You can then just add 500 to it, a simple 16 bit add. This then gives a display range of 500 to 1011. Then simply adjust the attenuator on the input So 10V in reads 1000 on the A2D. This gives you a display range of 5.00 to 10.11, but it should never go above 10.00 - no complicated maths, and best possible accuracy!.
 
Last edited:
i think your suggestion is for re-scale the input signal,right??

my input is 5-10V, but i want the output show on LCD is the number of 0.00-10.00(decimal number)..

so, if i used your suggestion to scale the input and keep the binary bit in PORTB, the what next step should i do to make the LCD display 0.00-10.00??

is it mean that i need to insert with a formula like y=3.2x+3?
and take the binary value on PORTB as x, do the calculation change to another new result(0-10 in binary form)..

if have to do like that, i still face with a problem that i have no idea on how to write a formula by using assembly language..
how to change the y=3.2x+3 in code that is understanding by assembler??

thanks..
 
Connect two 1K resistors in series. Connect one end to 0V. Connect the other end to your 10V signal. Connect the middle to your ADC input.

Supply your circuit from 5.5V and with a resistive divider (or zener) generate 5.12V to use as Vref.

With the above configuration,
10V in will give 1000 on the ADC.
5V in will give 500 on the ADC.

Use the routine to convert the binary into individual numbers.

Take these individual numbers and add 0x30 to each one.
Print the first two on your LCD.
Print a "." on your LCD.
Print the last two digits.

Done.

A better way would be to divide your input signal by 4 and generate 2.56V for the Vref.

HTH

Mike.
 
Pommie said:
Connect two 1K resistors in series. Connect one end to 0V. Connect the other end to your 10V signal. Connect the middle to your ADC input.

Supply your circuit from 5.5V and with a resistive divider (or zener) generate 5.12V to use as Vref.

With the above configuration,
10V in will give 1000 on the ADC.
5V in will give 500 on the ADC.

Use the routine to convert the binary into individual numbers.

Take these individual numbers and add 0x30 to each one.
Print the first two on your LCD.
Print a "." on your LCD.
Print the last two digits.

Done.

A better way would be to divide your input signal by 4 and generate 2.56V for the Vref.

HTH

Mike.


i have go through the example, the example is same with changing 16bit to 4 bit...still don't understand with show the output as what we want..:(
 
i now able to convert the analog input(0-5V) to 0000-1111,
after that, i convert this binary code to ASCII code and display on LCD,
the LCD show 0-15... and the ASCII code show 10 as A, how can i make in as 10..

what method can i use to let the output just from 0-10,

and i also need the voltage convertion until 2 decimal point..(for example 3.23 show on LCD )...
 
The analogue input should be 10 bits. You convert the 10 bits into 4 decimal values with the routine above. You display the decimal values with the decimal point in the right place.

Mike.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top