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

📄 main.c

📁 CPU卡读写
💻 C
字号:
#include "STC89C51.H"        //STC89C51 MCU 特殊寄存器定义
#include <absacc.h>
#include <intrins.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <String.H>
     
#include "IO.h"				 //  IO及存储器选择定义
#include "NEWTAX.H"          //  全局变量定义

/****************************************
 --------- 外部中断0中断服务程序 ----------
 *****************************************/
void External0(void) interrupt 0 using 2
{
        _nop_();
        return;
}
/****************************************
 --------- 定时器0中断服务程序 ----------
 *****************************************/
void clk_intT0(void) interrupt 1 using 1
{       
        T_Flag0=1;  
        return;                         
}
/****************************************
 --------- 外部中断1中断服务程序 ----------
 *****************************************/
void External1(void) interrupt 2 using 3
{   
	    _nop_();
        return;
}
/****************************************
 --------- 定时器1中断服务程序 ----------
 *****************************************/
void TimeCount1(void) interrupt 3 using 0
{                  
        _nop_(); 
        return;
}                      
/****************************************
 --------- 定时器2中断服务程序 ----------
 *****************************************/
void clk_intT2(void) interrupt 5 using 2
{
      Int2count--;    	//中断次数计数                    
      if(Int2count==0){ //中断到设定次数
          TimeOverRun=1;/*  时间超过5s置位 */
          ET2=0;        //禁止定时器2中断
          TR2=0;        //禁止定时器2计数
      }
      TF2=0;			//清除定时器2中断标志
      return;
}
/****************************************
 --------- 串口中断 ----------
 *****************************************/
void ssio(void) interrupt 4 using 3
{
    uchar data  j=0;
	ES=0;				   /*  关串行中断                 */
	if(NPBit==0){                  /*  下一包标志位               */
		BagHeadBit=0;              /*  接收命令包头出错标志位      */
		SerialBit=0;               /*  接收命令包时长度不够标志位  */
		RcvDataBy232();
		if(uc0!=Head_Flag1)        /*  命令头      0X1B               */ 
								//命令头不为0X1B,设置命令头错标志,等待该包数据发送完毕后退出
		  { BagHeadBit=1; do{RcvDataBy232();}while(SerialBit==0); SerialBit=0; handle=0xff; goto reti;}	
  		Un.ComBuf[j++]=uc0;		//命令头 保存
		RcvDataBy232();         //接收第二字节
		if(uc0!=Head_Flag2)  	/*0X10*/
								//命令头第二个字节数据不是0X10,柚妹

⌨️ 快捷键说明

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