PIC Vietnam

Go Back   PIC Vietnam > Các Đề Tài > Luận văn tốt nghiệp

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

Luận văn tốt nghiệp Nếu bạn thắc mắc vì sao chúng tôi muốn phổ biến các luận văn tốt nghiệp? Xin xem tại đây

 
 
Ðiều Chỉnh Xếp Bài
Prev Previous Post   Next Post Next
Old 22-06-2012, 01:30 PM   #1
vinh172001
Nhập môn đệ tử
 
Tham gia ngày: Nov 2011
Bài gửi: 2
:
ai co the giai thich dum em doan ma code ve con chuong trình RFID

#include <16f877a.h>
//#include <def_16f877a.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP,NOBROWNOUT,PUT

#define RF_RDY_CLK PIN_C0 // External interrupt used to read clock
#define RF_SHD PIN_C1 // High disables the antenna signal
#define RF_MOD PIN_C3 // High does 100% modulation
#define RF_DEMOD_OUT PIN_C2 // Data read in interrupt service routine

#include <em4095.c> // Controls the reader IC
#include <em4102.c> // Allows reading 4102 transponders
#use delay(clock=12000000)
#use rs232(baud=9600, xmit=PIN_c6,rcv=PIN_c7)
#define LCD_ENABLE_PIN PIN_B3 ////
#define LCD_RS_PIN PIN_B1 ////
#define LCD_RW_PIN PIN_B2 ////
#define LCD_DATA4 PIN_B4 ////
#define LCD_DATA5 PIN_B5 ////
#define LCD_DATA6 PIN_B6 ////
#define LCD_DATA7 PIN_B7
#include <lcd.c>

//#byte trisb = 0x86
//#bit trisb5 = trisb.5
//#byte PORTB = 0x6
//#bit rb5 = PORTB.5
#Byte PORTA = 0x5
#bit Butt1 = PORTA.0
#bit Butt2 = PORTA.1
#bit Butt3 = PORTA.2
#bit Led1 = PORTA.3
#bit Led2 = PORTA.4
#bit Led3 = PORTA.5

#byte PORTE = 0x9
#bit Tran1 = PORTE.0
#bit Tran2 = PORTE.1

#define x_ON 1
#define x_OFF 0

int8 msg[32];

void main()
{
int8 customerCode;
int32 tagNum;
//trisb5=0;
lcd_init();
set_tris_a(0x7);
Set_tris_e(0);
rf_init(); // Initialize the RF reader // khoi tao em4095 trong thu vien em4095.c
rf_powerUp(); // Power up the antenna // phát sóng tan so 125khz
printf(lcd_putc,"\fSystem ready...");
delay_ms(1000);
while(1) {
if(read_4102(msg))
{
customerCode = msg[0];// gan 1byte la ma khach hang
tagNum = make32(msg[1], msg[2], msg[3], msg[4]);// gan 4byte tiep theo la UIA
sprintf(msg,"Customer Code: %u\n\r", customerCode);
puts(msg);
printf(lcd_putc,"\fC Code:%u\n",customerCode);
sprintf(msg, "Tag Number: %lu\n\n\r", tagNum);
puts(msg);
printf(lcd_putc,"T No:%lu",tagNum);
Led1 = x_ON;
Tran1 = x_ON;
Tran2 = x_ON;
delay_ms(1000);
Led1 = x_OFF;
Tran1 = x_OFF;
Tran2 = x_OFF;
}
}
}
vinh172001 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à 06:19 AM.


Đượ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