Continue to Site

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.

Voltmeter Code in ASM for PIC18F

Status
Not open for further replies.

Sumihere

Newbie level 5
Joined
Mar 20, 2012
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,347
Hi

I am using 10 bit ADC and the coding has been done in Assembly Language.

I need to display the input voltage (which is scaled by 2.5 ) on the LCD .

Pls suggest me on how to do this in ASM as it involves lot of floating point multiplications and all...

Thanksss
 

Hi

I am using 10 bit ADC and the coding has been done in Assembly Language.

I need to display the input voltage (which is scaled by 2.5 ) on the LCD .

Pls suggest me on how to do this in ASM as it involves lot of floating point multiplications and all...

Thanksss

There are some programmers who quite assemply programming to avoid floating point manipulation. Floating point manipulation requires really a good lines of codes. BUT in your case there are ways to avoid floating point math.
Search this board.

---------- Post added at 12:27 ---------- Previous post was at 11:56 ----------

Hints,
Scales the ADC input value to 5000 and then divides by 1024. The output is a number between 0 and 5000. e.g. for a 2.5V input voltage the ADC will read 512. 512 * 5000 is 2560000 Dividing by 1024 (right shift 10 times) gives 2500. So using the fixed decimal point between the 2 and the 5 gives the final result displaying "2.500"
 

Thank you... Is it okay to give -5 V to Vref- pin in PIC18F4520..? will it damage the PIC. I am using it as bipolar ADC (-5V to +5V)
 

The ADC is based on analog reading between VRef- to VRef+. When input is at VRef-, the value returned will be 0 (zero) and when input is at VRef+, the value returned will be 1023 (2^10 - 1, i.e., 2 to the power of 10 minus 1).
 

The ADC is based on analog reading between VRef- to VRef+. When input is at VRef-, the value returned will be 0 (zero) and when input is at VRef+, the value returned will be 1023 (2^10 - 1, i.e., 2 to the power of 10 minus 1).

Thank you Sir...But my doubt is whether giving a giving a -ve voltage would damage the PIC by any means..
 

No no....... No -ve voltage

---------- Post added at 00:20 ---------- Previous post was at 00:19 ----------

you can't give a negative votage to any pin of the PIC.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top