基于MC68HC908RF2轮胎压力监测系统的发射程序文件

上传人:l**** 文档编号:134894564 上传时间:2020-06-09 格式:DOC 页数:15 大小:46KB
返回 下载 相关 举报
基于MC68HC908RF2轮胎压力监测系统的发射程序文件_第1页
第1页 / 共15页
基于MC68HC908RF2轮胎压力监测系统的发射程序文件_第2页
第2页 / 共15页
基于MC68HC908RF2轮胎压力监测系统的发射程序文件_第3页
第3页 / 共15页
基于MC68HC908RF2轮胎压力监测系统的发射程序文件_第4页
第4页 / 共15页
基于MC68HC908RF2轮胎压力监测系统的发射程序文件_第5页
第5页 / 共15页
点击查看更多>>
资源描述

《基于MC68HC908RF2轮胎压力监测系统的发射程序文件》由会员分享,可在线阅读,更多相关《基于MC68HC908RF2轮胎压力监测系统的发射程序文件(15页珍藏版)》请在金锄头文库上搜索。

1、MC68HC908RF2带曼彻斯特码的发射程序波特率:9600 #include /* for EnableInterrupts macro */#include /* include peripheral declarations */*/* PROJECT : RF key demonstrator (ASK or FSK) */* constant file */*/* Protocol */#define nb_wake_up_bit 0 / not using the variable to delay for some time.#define Preamble 0xFB86 /

2、End of Tone + ID (B8) + Header (for using Romeo2 SPI)#define Device_ID 0x7800 / length = 4 ; from $7800 to $7803/ NOTE: Each of these 4 bytes must be programmed/ individually for each RK/RF2 upon programming the flash,/ and represent the tire identification.#define wait_0_2ms 400 / for temperature s

3、ense#define wait_0_5ms 1000 / for L22B pressure sense#define wait_0_8ms 1600 / for long L90J pressure sense#define wait_1ms 2000 / = 1 ms#define wait_1_8ms 3810 / = 1.8 ms for Tango3#define wait_2ms 4000 / = 2 ms for Remeo2/* Transmission Timer Clock Generator */* This is the section that must be mo

4、dified when the crystal is changed. */* You will also have to clear TSC2:0 during transmission (see emis1.asm) */* 9600 bauds using MCU clock for timer (not as accurate over temperature) */ #define UHF_period 200 / =2MHz/10000bauds/ #define UHF_Duty_Cycle 100 / =0.5*UHF_period/* use of DATACLK at 96

5、00 bauds, 434 MHz*/#define UHF_Period 22 / = 212kHz/9600 bauds#define UHF_Duty_Cycle 11 / = 50%/* use of DATACLK at 4800 bauds, 434 MHz*/#define UHF_period 44 / = 212kHz/4800 bauds/#define UHF_Duty_Cycle 22 / = 50%/* use of DATACLK at 9600 bauds, 315 MHz*/ #define UHF_period 16 / = 154kHz/9600 bauds

6、/ #define UHF_Duty_Cycle 8 / = 50%/* use of DATACLK at 1200 bauds, 434 MHz:*/ #define UHF_period_park 176 / = 212kHz/1200 bauds/ #define UHF_Duty_Cycle_park 88 / = 50%/* use of DATACLK at 1200 bauds, 315 MHz:*/ #define UHF_period_park 128 / = 154kHz/1200 bauds/ #define UHF_Duty_Cycle_park 64 / = 50%

7、/* hardef.h/* Tango 3 I/O assignments/#define tango_Band PTB_PTB0#define tango_Band PTA_PTA7 #define tango_Enable PTB_PTB1#define tango_DATA_RF PTB_PTB2#define tango_UP_CLOCK PTB_PTB3 /#define tango_Mode PTA_PTA7 / PA7 *Important: porta! NOT portb!#define tango_Mode PTB_PTB0 /* Mode Control pins */#

8、define S1 PTA_PTA1/#define S0 PTA_PTA2#define S1 PTA_PTA2#define S0 PTA_PTA3 /* Digital Data Output Pin */#define DOUT_BAR PTA_PTA3/#define DOUTb PTA_PTA3 #define DOUT_BAR PTA_PTA1#define DOUTb PTA_PTA1/* Data Clock Pin *#define DCLK PTA_PTA4 /* Serial Data In Pin *#define SDATA PTA_PTA5#define DDAT

9、A PTA_PTA5#define LOWV 0x20#define LVIOUT 0x80#define nb_tx_byte 10/*/* PROJECT : RF key demonstrator (ASK or FSK) */* Variable file */* Modified by Jeff Burgess */* - added work-around for bug in Romeo2 receiver, where its SPI corrupts */* the last bit of data in the frame. Simply transmit one more

10、 useless */* byte, that will be corrupted instead of the useful data. */*/* define tyres ID 0x7800/const uchar IDDevice_ID = 0x55,0x10,0x77,0x77; const uchar IDDevice_ID = 0x55,0x10,0x02,0x01; /const uchar IDDevice_ID = 0x55,0x10,0x02,0x02; /const uchar IDDevice_ID = 0x55,0x10,0x02,0x03; /const ucha

11、r IDDevice_ID = 0x55,0x10,0x02,0x04; /const uchar IDDevice_ID = 0x55,0x10,0x02,0x05; /const uchar IDDevice_ID = 0x55,0x10,0x02,0x06; /const uchar IDDevice_ID = 0x55,0x10,0x02,0x07; /const uchar IDDevice_ID = 0x55,0x10,0x02,0x08; /const uchar IDDevice_ID = 0x55,0x10,0x02,0x09; / transmit variables/ P

12、reamble (2 bytes) - Device ID (4 bytes) - daytona data (2 bytes) -/ Status (1 byte) - CRC (1 byte) - Junk (1 byte)uchar Tx_Bytenb_tx_byte; uchar Current_Tx_Bit;uchar Next_Tx_Bit;uchar current_tx_byte;/* hardware variables for Daytona */ variables for Daytona Serial and SAR routinesuchar T2; / tempor

13、ary variables uchar T3; /uchar T4; /uchar T5; /uchar SAR; /uchar STATUS; /uchar Tx_count; / Measure pressure every 3 sec, tx every 54 sec.uchar Max_Pres; / Holds the maximum pressureuchar Min_Pres; / Holds the minimum pressureuchar AVGCOUNT; / Averaging counter (only used with noisy L22B silicon)uch

14、ar TEMPERATURE; / converted temperatureuchar PRESSURE; / converted pressure uchar COUNTER; / counter to count every 3 or 6 secsuchar Random_Number; / Pseudo-random number (from timer counter low register)void init_ports(void);void init_icg(void);void init_timer(void);void init_kbi(void);void init_sys(void);void tango_read_temperature_mode(void);void tango_rea

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 工作范文

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号