View Single Post
Old 28-07-2011, 01:05 AM   #1
haneishun
Đệ tử 1 túi
 
Tham gia ngày: Jun 2009
Bài gửi: 24
:
em muon hien thi so thap phan len LCD ,nhung cai code nay co van de hien thi ko dung

#include <16f877A.h>
#device *=16
#use delay(clock = 20M)
#FUSES NOWDT, HS, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT,NOLVP, NOCPD, NOWRT

#define LCD_ENABLE_PIN PIN_B5
#define LCD_RS_PIN PIN_B7
#define LCD_RW_PIN PIN_B6
#define LCD_DATA4 PIN_B4
#define LCD_DATA5 PIN_B3
#define LCD_DATA6 PIN_B2
#define LCD_DATA7 PIN_B1

#include <lcd.c>
void main(){
int i,x,x1,y1,y2;
lcd_init();
x=123.4;
x1=x*10;
y1=x1/100;
y2=x1%100;
lcd_gotoxy(1,1);
lcd_putc(y1/10+0x30);
lcd_gotoxy(2,1);
lcd_putc(y1%10+0x30);
lcd_gotoxy(3,1);
lcd_putc(y2/10+0x30);
lcd_gotoxy(4,1);
lcd_putc(".");
lcd_gotoxy(5,1);
lcd_putc(y2%10+0x30);
while(1);
}
haneishun vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn