PIC Vietnam

Go Back   PIC Vietnam > Microchip PIC > Các ngôn ngữ lập trình khác (CCS C, HT PIC,...)

Tài trợ cho PIC Vietnam
Trang chủ Đăng Kí Hỏi/Ðáp Thành Viên Lịch Bài Trong Ngày Vi điều khiển

 
 
Ðiều Chỉnh Xếp Bài
Prev Previous Post   Next Post Next
Old 18-08-2009, 10:28 AM   #2
phamminhtuan
Super Moderator
 
phamminhtuan's Avatar
 
Tham gia ngày: Feb 2006
Bài gửi: 150
:
Link datasheet, không biết có phải loại LCD mà bạn đang dùng không:
http://www.sparkfun.com/datasheets/LCD/SerLCD_V2_5.PDF

Bạn thử sửa code lại thế này xem sao
Code:
#include <16f887.h>
#device adc=8
#use delay(clock=4000000)
#use rs232(baud=9600,xmit=pin_d0,rcv=pin_d1) //thiet lap noi tiep

void main()
{
   int vin0; //bien dau vao
   setup_adc(adc_clock_internal);   //thiet lap xung clock noi
   setup_adc_ports(an0);     //chon ngo vao analog
   set_adc_channel(0);
   delay_us(10);
   putc(0xFE);  //Turn on display
    putc(0x41);
   for(;;)
   {
      vin0=read_adc();
      //vin0=(vin0/32)+0x30; //Ko can thiet, vi pham printf tao ra ma ascii
      delay_ms(1000);
      putc(0xFE);  //xoa hien thi lcd
      putc(0x51);
      printf("input=%u",vin0);   //xuat rs232
      delay_ms(1000);
   }
}
phamminhtuan vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
 


Quyền Sử Dụng Ở Diễn Ðàn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Smilies đang Mở
[IMG] đang Mở
HTML đang Tắt

Chuyển đến


Múi giờ GMT. Hiện tại là 03:50 PM.


Được sáng lập bởi Đoàn Hiệp
Powered by vBulletin®
Page copy protected against web site content infringement by Copyscape
Copyright © PIC Vietnam