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.

Help with C Function to display string!!!

Status
Not open for further replies.

sidy50

Member level 4
Joined
Dec 31, 2009
Messages
79
Helped
14
Reputation
28
Reaction score
3
Trophy points
1,288
Location
India
Activity points
1,839
Hi, im trying to make a Digital Clock using 8051 & 16x2 LCD...I know that a lot these projects would be find once googled...but was trying to make it by my own as a beginner...What i do is to generate a 1 sec delay using interrupts....& in waiting time between these interrupts i print the seconds minutes & hours on LCD...which are stored in 3 different variables...How can i print them on LCD at once like this "03:46:23" using a function such as printf("%d:%d:%d",x,y,z)...Is it possible to print this way:?:...Thanx :D
 

not possible .
you have to write a function to send the individual digits separately to lcd
 

Ok...i uderstand....so to print "x : y : z" i would have to send data like wrt_value(x); wrt_data(':') & so on for y : z right...
 

you can create a string using "sprintf(txt_buf, "time=%2d:%2d:%2d", hour, minute, second);", and then write that string to the lcd.
 

concider a routine that doesnt send the whole string
just what changes this free's processor time and lcd refresh is then easier
even moving messages alarm etc

and also the use of an rtc on a couple of i/o pins
 

Thanx guyz....i got it working @VSMVDD do you mean to say that the string printing method would be more time consuming, than printing data one by one...
 

either way would work. sprintf()/printf() is easy, flexible and robust.

your own version (likely based on routines like itoa()) will have saller footprint, lack of portability but it is likely to be smaller / faster than the sprintf()/printf() approach.
 

    sidy50

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top