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.

Problem in Hex to Decimal point Conversion in ADC output on LCD in MPLAB IDE

Status
Not open for further replies.

ecaits

Member level 4
Member level 4
Joined
Jan 16, 2014
Messages
76
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Visit site
Activity points
579
Hello Gurus,

I am using PIC16F877 in MPLAB IDE 7.60, using Hitech C Compiler and MPLAB ICD debugger.

Now I want to display 10 bit ADC output in float point on 16x2 LCD. I am getting ADC output in HEX and by modulo division method I am getting individual decimal value and storing it in one array. In array I am getting exact decimal value but when i m taking it in any variable then it shows in hex format.

My input is 0-5V and i am getting 0-1023 range in ADC output. But I want to display 0.0 to 150.0 (like 145.9) on LCD. To reduce range from 0-1023 to 0.0 to 150.0, I have to divide 0-1023 range by 6.82 so I will get output in floating point to display on LCD.

To divide by 6.82, I should get range 0-1023 in decimal format but it always get in hex format in variable as well as registers.

How I Can solve the issue???
 

char WhatGetsDisplayed[6];
sprintf(WhatGetsDisplayed,"%f",ADCOutput/6.82);
FunctionToShowOnLCD(WhatGetsDisplayed);

Sorry, I do not know the actual name of the function HTC uses to put text on an LCD.

Brian.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top