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

📄 4095.c

📁 4095与89c52之间的处理程序
💻 C
字号:
www.pudn.com > EM4095.rar > em4095.c

   
              /*----------------头文件------------------*/   
/******************************************/   
#include "reg52.h"    
#include "intrins.h"    
//#include "absacc.h"    
//#include "math.h"    
#include "string.h"    
#include "stdio.h"    
#include "EM4100.h"    
#include "em4095.h"    
   
/**********************************************/   
   
/********************定义特殊功能寄存器*************************/   
/***************************************************************/   
   
sfr AUXR=0x8e ;      /*ALE控制寄存器*/   
/***************************************************************/   
/*uchar bdata  x_byte;  
  
sbit  x_bit0=x_byte^0;  
sbit  x_bit1=x_byte^1;  
sbit  x_bit2=x_byte^2;  
sbit  x_bit3=x_byte^3;  
sbit  x_bit4=x_byte^4;  
sbit  x_bit5=x_byte^5;  
sbit  x_bit6=x_byte^6;  
sbit  x_bit7=x_byte^7;    */   
   
   
/****************************************************************************  
* 文件名:em4095.c  
* 功能描述:  电子门禁的实现:  
                 识别RFID卡,读取其ID号, 并结合输入的按键密码,进行身份认证,  
                 认证通过后使蜂鸣器鸣叫一声,并驱动电磁门锁实现开锁功能,  
                 存储此次开锁时间,以便以后查询和考证。  
*****************************************************************************/   
   
                                    
//#include"em4095.h"                         
/*********************************************/   
/************************************************  
*函数 :DelayMs()  
*调用函数:  
*参数:  
*功能描述: 延时子程序X*ms  
by:  
**************************************************/   
   
void DelayMs(uint number)   
{   
    uint temp;   
    for(;number!=0;number--)   
    {   
        for(temp=228;temp!=0;temp--)   
        {   
        ;   
        }   
    }   
}   
   
/************************************************  
*函数 :InitQ()  
*调用函数:  
*参数:  
*功能描述: 系统初始化接收缓冲区  
by:  
**************************************************/   
void InitQ()   
{   
    RecCtn=0;               /*接收数据数 */   
    In=Out=GetChar;   
   
}   
/************************************************  
*函数 :Uart_Init()   
*调用函数:  
*参数:  
*功能描述: Uart初始化函数  
by:  
**************************************************/   
void Uart_Init()      
{   
   PCON=0X00;   
   SCON = 0x50;    /*   设置串行口控制寄存器SCON*/      
   TMOD = 0x20;    /*   定时器T1产生11.0592M时钟时波特率为9600   */      
   //TCON   = 0x69;    /*   TCON   */       
   TH1 =  0xfd;     /*   TH1   */   
   TL1 =  0XFd;   
   TR1=1;   
       
      
}      
/************************************************  
*函数 :System_init()  
*调用函数:  
*参数:  
*功能描述: 系统初始化函数  
by:  
**************************************************/   
void System_init()   
{   
  LED=0;   
  DelayMs(10);   
  Uart_Init();    
       
  InitQ();   
     
 // GetIndex=0;    
  IE=0X90;   
  PS=1;   
  MOD=0;   
  SHD=1;   
  DelayMs(35);   
  SHD=0;   
    
    
}   
/************************************************  
*函数 :Send_Byte()   
*调用函数:  
*参数:  
*功能描述: 向串口发送一个字节的数据  
by:  
**************************************************/   
void Send_Byte(uchar a)    
{   
  //SBUF=a;    
    
   TI=0;    
   SBUF=a;   
    while(TI==0);   
    TI=0;     
   
   
}   
/************************************************  
*函数 :Send_String()   
*调用函数:  
*参数:  
*功能描述: 向串口发送一字符串  
by:  
**************************************************/   
void Send_String(uchar *a,uchar str_lenght)   
{   
   uchar i;   
   for(i=0;i<STR_LENGHT;I++) if((TL0) TR0="1;" while(DEMOD_OUT="=0);" { INT1_Int(void) *void ************************************************** by: 外部中断函数 *功能描述: *参数: *调用函数: :INT1_Int() *函数 ************************************************ } LED_Flash(1); RI="0;" In++; RecCtn++; *In="SBUF;" if(RI="=1)" 4 interrupt Uart_Int(void) void 串口中断函数 :Uart_Int() ; else OK!\n?,13); Test Send_String(?Com printf(?\nSN:%ld?,GetCode); Send_Byte(?H?); if(GetCode) GetCode="0;" * Send_Byte(?!?); Send_Byte(?U?); *Send_Byte(?Y?); if(Read_Byte()="=0x02)" DelayMs(35); ES="0;" InitQ(); if(RecCtn="=0)" while(1) System_init(); LED_Flash(3); Manchester_IN="1;" LED="1;" SHD="1;" MOD="0;" ulong LED_Times; uchar main() 主控 :main() DelayMs(1); *Get_Manma() 射频接受程序 *函数名:Get_Manma() DelayMs(200); for(LED_Times="0;LED_Times<LEDTimes;LED_Times++)" ) LEDTimes LED_Flash(uchar *功能描述:led闪烁程序 *函数名:LED_Flash() return(ReadByte) Out++; RecCtn--; ReadByte="*Out;" ReadByte; Read_Byte(void) 从缓冲区取一个字节的数据 *函数名:Read_Byte() a++; Send_Byte(*a);>32)   
   {   
        
   }   
   
}*/   

			  /*----------------头文件------------------*/ 
/******************************************/ 
#include "reg52.h" 
#include "intrins.h" 
//#include "absacc.h" 
//#include "math.h" 
#include "string.h" 
#include "stdio.h" 
#include "EM4100.h" 
#include "em4095.h" 
 
/**********************************************/ 
 
/********************定义特殊功能寄存器*************************/ 
/***************************************************************/ 
 
sfr AUXR=0x8e ;      /*ALE控制寄存器*/ 
/***************************************************************/ 
/*uchar bdata  x_byte; 
 
sbit  x_bit0=x_byte^0; 
sbit  x_bit1=x_byte^1; 
sbit  x_bit2=x_byte^2; 
sbit  x_bit3=x_byte^3; 
sbit  x_bit4=x_byte^4; 
sbit  x_bit5=x_byte^5; 
sbit  x_bit6=x_byte^6; 
sbit  x_bit7=x_byte^7; 	  */ 
 
 
/**************************************************************************** 
* 文件名:em4095.c 
* 功能描述:  电子门禁的实现: 
                 识别RFID卡,读取其ID号, 并结合输入的按键密码,进行身份认证, 
                 认证通过后使蜂鸣器鸣叫一声,并驱动电磁门锁实现开锁功能, 
                 存储此次开锁时间,以便以后查询和考证。 
*****************************************************************************/ 
 
                                  
//#include"em4095.h"                      
/*********************************************/ 
/************************************************ 
*函数 :DelayMs() 
*调用函数: 
*参数: 
*功能描述: 延时子程序X*ms 
by: 
**************************************************/ 
 
void DelayMs(uint number) 
{ 
    uint temp; 
    for(;number!=0;number--) 
    { 
        for(temp=228;temp!=0;temp--) 
        { 
        ; 
        } 
    } 
} 
 
/************************************************ 
*函数 :InitQ() 
*调用函数: 
*参数: 
*功能描述: 系统初始化接收缓冲区 
by: 
**************************************************/ 
void InitQ() 
{ 
    RecCtn=0;               /*接收数据数 */ 
    In=Out=GetChar; 
 
} 
/************************************************ 
*函数 :Uart_Init()  
*调用函数: 
*参数: 
*功能描述: Uart初始化函数 
by: 
**************************************************/ 
void Uart_Init()    
{ 
   PCON=0X00; 
   SCON = 0x50;    /*   设置串行口控制寄存器SCON*/    
   TMOD = 0x20;    /*   定时器T1产生11.0592M时钟时波特率为9600   */    
   //TCON   = 0x69;    /*   TCON   */    
   TH1 =  0xfd;     /*   TH1   */ 
   TL1 =  0XFd; 
   TR1=1; 
     
    
}    
/************************************************ 
*函数 :System_init() 
*调用函数: 
*参数: 
*功能描述: 系统初始化函数 
by: 
**************************************************/ 
void System_init() 
{ 
  LED=0; 
  DelayMs(10); 
  Uart_Init();  
  	 
  InitQ(); 
   
 // GetIndex=0; 
  IE=0X90; 
  PS=1; 
  MOD=0; 
  SHD=1; 
  DelayMs(35); 
  SHD=0; 
  
  
} 
/************************************************ 
*函数 :Send_Byte()  
*调用函数: 
*参数: 
*功能描述: 向串口发送一个字节的数据 
by: 
**************************************************/ 
void Send_Byte(uchar a)  
{ 
  //SBUF=a; 
  
   TI=0;  
   SBUF=a; 
    while(TI==0); 
    TI=0;   
 
 
} 
/************************************************ 
*函数 :Send_String()  
*调用函数: 
*参数: 
*功能描述: 向串口发送一字符串 
by: 
**************************************************/ 
void Send_String(uchar *a,uchar str_lenght) 
{ 
   uchar i; 
   for(i=0;i32) 
   { 
      
   } 
 
}*/ 








 

⌨️ 快捷键说明

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