![]() |
|
Tài trợ cho PIC Vietnam |
dsPIC - Bộ điều khiển tín hiệu số 16-bit Theo dự kiến của Microchip, vào khoảng năm 2011 dsPIC sẽ có doanh số lớn hơn PIC |
![]() |
|
Ðiều Chỉnh | Xếp Bài |
![]() |
#1 |
Nhập môn đệ tử
Tham gia ngày: Nov 2012
Bài gửi: 1
: |
![]() Làm sao để nhận được chuỗi kí tự từ máy tính qua cổng RS232 hiện thị đúng lên LCD vậy mọi người. Mình đã truyền nhận được 1 kí tự, khi truyền 1 chuõi thì hiển thị lên LCD chỉ đúng kí tự đầu tiên,các kí tự sau hiển thị chính xác.Mình dùng Pic6f887
|
![]() |
![]() |
![]() |
#2 |
Nhập môn đệ tử
Tham gia ngày: Jan 2013
Bài gửi: 6
: |
bạn có thể mô phỏng trên proteus dùng 2 con pic
+ 1 con dùng để phát chuỗi ký tự. + 1 con dùng để nhận và hiển thị trên LCD. code phát : #include <transmiter.h> #include <LCD_lib_4bit.c> #use fast_io(D) #use fast_io(B) #use fast_io(C) #byte portd=0x08 #byte portb=0x06 #byte portc=0x07 #bit but = portb.0 char data[7],temp; void main() { set_tris_C(0x80); set_tris_B(0x00); enable_interrupts(INT_RDA); enable_interrupts(GLOBAL); LCD_Init (); delay_ms(1); while(1) { if(but==0) { printf("University"); // nhan nut thuc thi lenh while(but==0); // nhan nut nha ra thuc thi cong viec } } } code nhận : #include <UART.h> #include <string.h> #include <D:\chuong trinh\dk dien thoai\sim900\thien\myLCD16x2.c> #use fast_io(D) #use fast_io(B) #use fast_io(C) #byte portd=0x08 #byte portb=0x06 #byte portc=0x07 #bit but = portb.0 unsigned char data[65],kt[]="University"; int1 ok=0; int8 count=0,temp; signed char i; #INT_RDA void serial_isr() { data[count]=getc(); count++; if(count==10) { count=0; ok=1; } } void main() { set_tris_C(0x80); enable_interrupts(INT_RDA); enable_interrupts(GLOBAL); lcd_init (); delay_ms(1); while(1) { if(ok==1) { for(i=0;i<10;i++) { putc(data[i]); lcd_putc(data[i]); } ok=0; } } } |
![]() |
![]() |
![]() |
|
|