|
|
View previous topic :: View next topic |
Author |
Message |
maiprog
Joined: 24 Mar 2014 Posts: 7
|
Send data through variable for LCD? |
Posted: Sun Mar 30, 2014 3:20 pm |
|
|
I want to send data through variable through LCD.
and I am using flex_lcd drive.
my LCD is struck, and the pin c6 get high.
Code: |
#include <18F4520.h>
#FUSES NOPROTECT,NOWDT,NOLVP,HS,NOBROWNOUT
#use delay(clock=10000000)
#include <flex_lcd.h>
float phase_angle = 13.6;
float firing_angle = 10.5;
int cap_bnk=12;
void main()
{
lcd_init();
while(1)
{
sprintf(LCD_putc,"\f %u",phase_angle);
delay_ms(100);
lcd_gotoxy(0,1);
sprintf(LCD_putc,"FA:%u",firing_angle);
delay_ms(100);
lcd_gotoxy(0,2);
sprintf(LCD_putc, "Cap:%u",cap_bnk);
delay_ms(100);
}
} |
I tried fprintf,sprintf and printf. I heard that these are UART functions.
please help |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Mar 30, 2014 3:51 pm |
|
|
Read the CCS manual. Or just google sprintf. You are 2nd person within
a short time period who uses sprintf incorrectly. The output of sprintf
goes to a RAM buffer. It never goes to an i/o function or a stream.
For that, you should use printf.
Also, read the CCS manual for printf. %u is not the format specifier
for a floating point variable. The manual (in the printf section) will
tell you what the correct format specifier is.
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf
Even one more thing !
You are using 0 as a parameter in the lcd_gotoxy() function. But the
function specification given in the CCS driver file, lcd.c, does not say you
can do that. It say this:
Quote: | lcd_gotoxy(x,y) Set write position on LCD (upper left is 1,1) |
You need to read the documentation for every function before you use it. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|