⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 radar.h

📁 倒车雷达的原理图与源码
💻 H
字号:
/*
***************************************************************************************************
* Copyright (C),2007
* Author        : YanZhongsan
* Email         : yanzhongsan@gmail.com
* Date          : 2007-10-17
* File name     : radar.h
* Description   : DS1302 driver head file
* Version       : V 1.0
* Others        : This file is the driver of radar communication
***************************************************************************************************
*/
#ifndef radar_h
#define radar_h

/****Timer define****/

#if XTAL==11059200
    /****Ext 11.0592MHz****/
    #define TIMER2_BEGIN            TCCR2B = 0x03
    #define TIMER2_STOP             TCCR2B = 0x00
    #define TIMER1_BEGIN            TCCR1B = 0x03
    #define TIMER1_STOP             TCCR1B = 0x00
    #define TIMER0_BEGIN            TCCR0B = 0x05
    #define TIMER0_STOP             TCCR0B = 0x00
    #define TIMER0_IS_RUNNING       0x00!=TCCR0B
    #define TIMER0_IS_STOP          0x00==TCCR0B

    #define SET_T2_290us            TCNT2 = 0x9C  //desired value:290us,actual value:289.5us
    #define SET_T2_32us             TCNT2 = 0xF5  //desired value:32us,actual value:31.6us
    #define SET_T2_70us             TCNT2 = 0xE8  //desired value:70us,actual value:69.3us
    #define SET_T2_48us             TCNT2 = 0xEF  //desired value:48us,actual value:49.1us
#endif

/****golbal data****/
extern volatile UCHAR_8 Radar_counter;
extern UCHAR_8 Radar[];
extern UCHAR_8 RadarDisBuf[];
extern UCHAR_8 Alarm;
extern UCHAR_8 SendBack;
extern UCHAR_8 Radar_time;

/****function description****/
void RadarKey(void);
void Radar_communication(void);
void Radar_data_trade(void);
void RadarAlarm(const UCHAR_8 * const time_p);

/****I/O port rename****/
#define RADAR_PORT              PORTB
#define RADAR_DDR               DDRB
#define RADAR_PIN               PINB
#define RADAR_LINE              (1<<PB2)
#define RADAR_LINE_IS_HIGH      (0x00!=(RADAR_PIN & RADAR_LINE))
#define RADAR_LINE_IS_LOW       (0x00==(RADAR_PIN & RADAR_LINE))
#define SET_RADAR_OUT           RADAR_DDR |= RADAR_LINE
#define SET_RADAR_IN            RADAR_DDR &= (~(RADAR_LINE))
#define SET_RADAR_HIGH          RADAR_PORT |= RADAR_LINE
#define SET_RADAR_LOW           RADAR_PORT &= (~(RADAR_LINE))

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -