资源简介
主要讲解u2270b解调C语言源码已通过
通过讲解曼码解调方式而已。程序已通过
代码片段和文件信息
// --------------------------------------
// Function: H4001 64位RFID只读卡读头
// MCU: ATmega32
// Crystal: 7.3728Mhz
// Date: 2005/01/16
// --------------------------------------
// Compiler:
// ICCAVR 6.28C6.31A
// RFID基站芯片:U2270B
// --------------------------------------
#include
#include
//variable definition
unsigned char timer_counterror=0post=0data1rxdatarun=0;
unsigned char decode[192]head=0rfiddata[54];
unsigned int tcomp=0;
unsigned char lastbit=0half=0;
const unsigned char ascii[16]=“0123456789ABCDEF“;
//pin definition
#define led() (PORTD^=0x80)
#define RFW (1<<6)
//RFW RFID输出载波控制
#define RFW_1() (PORTC |=RFW)
#define RFW_0() (PORTC &=~RFW)
#define beep (1<<4)
#define beep_1() (PORTC |=beep)
#define beep_0() (PORTC &=~beep)
#define okled (1<<0)
#define okled1() (PORTC |=okled)
#define okled0() (PORTC &=~okled)
//RFID_IN U2270B返回卡的未解调码
#define RFID_IN (PINC&0x80)
void port_init(void)
{
PORTA = 0xFF;
DDRA = 0x00;
PORTB = 0xFF;
DDRB = 0x00;
PORTC = 0xFF;
DDRC = 0x51;
PORTD = 0x7F;
DDRD = 0x80;
}
//TIMER0 initialisation - prescale:1024
// WGM: Normal
// desired value: 10mSec
// actual value: 9.861mSec (1.4%)
void timer0_init(void)
{
TCCR0 = 0x00; //stop
TCNT0 = 0xB9; //set count
OCR0 = 0x47; //set compare
TCCR0 = 0x05; //start timer
}
#pragma interrupt_handler timer0_ovf_isr:12
void timer0_ovf_isr(void)
{
TCNT0 = 0xB9; //reload counter value
timer_count++;
if (timer_count>50) { // 0.01*50=0.5sec每0.5秒扫描一次是否有ID卡
// led();
timer_count=0;
run=1;
}
}
//TIMER1 initialisation - prescale:1
// WGM: 0) Normal TOP=0xFFFF
// desired value: 1Hz
// actual value: Out of range
void timer1_init(void)
{
TCCR1B = 0x00; //stop
TCNT1H = 0x00 /*INVALID SETTING*/; //setup
TCNT1L = 0x00 /*INVALID SETTING*/;
OCR1AH = 0x00 /*INVALID SETTING*/;
OCR1AL = 0x00 /*INVALID SETTING*/;
OCR1BH = 0x00 /*INVALID SETTING*/;
OCR1BL = 0x00 /*INVALID SETTING*/;
ICR1H = 0x00 /*INVALID SETTING*/;
ICR1L = 0x00 /*INVALID SETTING*/;
TCCR1A = 0x00;
TCCR1B = 0x01; //start Timer
}
//UART0 initialisation
// desired baud rate: 9600
// actual: baud rate:57600 (0.0%)
// char size: 8 bit
// parity: Disabled
void uart0_init(void) //Uart初始化
{
UCSRB = 0x00; //disable while setting baud rate
UCSRA = 0x00;
UCSRC = 0x06;
UBRRL = 0x07; //set baud rate lo9600=0x2F57600=0x07
UBRRH = 0x00; //set baud rate hi
UCSRB = 0x98;
}
#pragma interrupt_handler uart0_rx_isr:14
void uart0_rx_isr(void) //接收中断处理
{
//uart has received a character in UDR
rxdata=UDR;
}
//call this routine to initialise all peripherals
void init_devices(void) //初始化
{
//stop errant interrupts until set up
CLI(); //disable all interrupts
port_init();
timer0_init();
timer1_init();
uart
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-03-10 16:38 U2270B c语言开发解调源码\
文件 7328 2006-09-10 21:06 U2270B c语言开发解调源码\H4001.c
文件 6852 2006-09-10 21:07 U2270B c语言开发解调源码\H4001.cof
文件 4405 2006-09-10 21:07 U2270B c语言开发解调源码\H4001.dbg
文件 58 2006-09-10 21:07 U2270B c语言开发解调源码\H4001.dp2
文件 5662 2006-09-10 21:07 U2270B c语言开发解调源码\H4001.hex
文件 66975 2006-09-10 21:07 U2270B c语言开发解调源码\H4001.lis
文件 10 2006-09-10 21:07 U2270B c语言开发解调源码\H4001.lk
文件 38712 2006-09-10 21:07 U2270B c语言开发解调源码\H4001.lst
文件 502 2006-09-10 21:07 U2270B c语言开发解调源码\H4001.mak
文件 3434 2006-09-10 21:07 U2270B c语言开发解调源码\H4001.mp
文件 17924 2006-09-10 21:07 U2270B c语言开发解调源码\H4001.o
文件 894 2006-09-10 21:07 U2270B c语言开发解调源码\H4001.prj
文件 27722 2006-09-10 21:07 U2270B c语言开发解调源码\H4001.s
文件 42 2006-09-10 21:05 U2270B c语言开发解调源码\H4001.src
- 上一篇:贪心法解决01背包贪心算法
- 下一篇:单功能流水线模拟
评论
共有 条评论