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.

Need c coding for displaying values on LCD (PIC micro)

Status
Not open for further replies.

vinothtnt

Junior Member level 1
Joined
Feb 29, 2008
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,399
hi,

i am using two switches one is for increment and other one is for decrement.i need to disply the values on LCD.I am using pic controller.while i press the increment switch ones my first value must pass while i press the second time the second value will display and so on.while i press the decrement switch the value will decrement one by one.the values r like
1.23,1.54,1.34,2.45and etc.

how can i pass these values into lcd display i am using pic microcontrollerand Hitech c compiler
 

Re: need c coding help

you can simply update an EEPROM register of your microcontroller while you are pressing the switches.
You can use addition and subtraction commands for increments and decrements.
Refer the library files of HighTech c package for coding references
 

Re: need c coding help

for display like 1.43 or 2.54 , you need two variables to update one for decimal part and other for integral part .

say variables are var_integral ,var_decimal .

on up switch press , increase var_decimal from 00 to 99 as soon as it goes beyond 99 make it 00 and increment var_integral by one , similarly for decrease also.

you can display these variables on lcd easily ,
 

Re: need c coding help

If you have enough program memory, the easiest way is to use float types to store the variables and use the sprintf to format the results to send to the display as an assci string.
Something like this:

Code:
#include <stdio.h>

char buffer[12];
float var1 = 1.54;

sprintf(buffer, "%0.2f", var1);

buffer contains the assci string.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top