PIC Vietnam

Go Back   PIC Vietnam > Microchip PIC > dsPIC - Bộ điều khiển tín hiệu số 16-bit

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

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
Prev Previous Post   Next Post Next
Old 08-01-2013, 12:17 PM   #2
pthien0288
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;
}
}
}
pthien0288 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à 04:55 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