main.c in wg26c.rar


Wiegand 26 serial communication protocol to the agreement, can Wiegand input 26...Original Link
    Sponsored links

			
#include <reg52.h>
#include <string.h>
#include <intrins.h>
/////////////////////////////////////////////////////////////////////
//89C52特殊寄存器定义
/////////////////////////////////////////////////////////////////////
sfr      WDT_CONTR  =    0xe1;
sfr16    RCAP2LH    =    0xCA;
sfr16    T2LH       =    0xCC;
sfr      AUXR       =    0X8E;
/////////////////////////////////////////////////////////////////////
//端口定义
/////////////////////////////////////////////////////////////////////
sbit	led		=	P0^0;
sbit	wgdata1 =	P1^2;
sbit	wgdata_1  =	P1^3;
sbit	wgdata_0  =	P1^4;
sbit	b_xiepoid = P1^5;
sbit	b_scom  =	P1^6;
sbit	b_wgcode  =	P1^7;
sbit	b_rs485 = P3^2;
bit 	b_rewg	;
bit 	b_sendscom;
bit 	b_norec;

unsigned char idata txwgdata;
unsigned char idata wgnumber;
unsigned char idata SendBuf[15];
unsigned char idata Sendnum;  
unsigned char idata scomdata;
unsigned long bdata wgdata26; 
    
/////////////////////////////////////////////////////////////////////
//延时常数及波特率定义
/////////////////////////////////////////////////////////////////////
#define  OSC_FREQ        11059200L

#define  RCAP2_50us      65536L - OSC_FREQ/240417L
#define  RCAP2_1ms       65536L - OSC_FREQ/12021L
#define  RCAP2_10ms      65536L - OSC_FREQ/1200L

#define  BOUND19200      256 - 3
#define	 BOUND9600		 256 - 6
/////////////////////////////////////////////////////////////////////
//函数原型
/////////////////////////////////////////////////////////////////////
void InitializeSystem();                                                                                                            
void DelayMs(unsigned int j);                                      
void Delay_50us(unsigned char j);        
unsigned char getascii(unsigned char input);
                                                
///++++++++++++++

void main( )
{    
    InitializeSystem( );
    while(1)
	{
		WDT_CONTR = 0x3f;
		if(b_rewg)
		{
			DelayMs(30);
			if(wgnumber != 0)
				

			...
			...
			... to be continued.

  This is a preview. To get the complete source file, 
  please click here to download the whole source code package.

			
			


Project Files

    Sponsored links
NameSizeDate
 wg26.plg152.00 B12-04-09 23:48
 wg26.Uv22.15 kB12-04-09 23:48
 wg26_Opt.Bak1.42 kB21-01-08 16:49
 wg26_Uv2.Bak2.01 kB21-01-08 16:49
 main.c4.72 kB21-01-08 15:09
 main.LST10.14 kB21-01-08 15:09
 main.OBJ9.70 kB21-01-08 15:09
 STARTUP.A515.00 kB16-04-02 14:32
 STARTUP.LST11.39 kB21-01-08 15:04
 STARTUP.OBJ749.00 B21-01-08 15:04
 wg269.20 kB21-01-08 15:09
 wg26.hex1.30 kB21-01-08 15:09
 wg26.lnp56.00 B21-01-08 15:09
 wg26.M5110.83 kB21-01-08 15:09
 wg26.Opt1.44 kB12-04-09 23:48
...

Related Items

    Sponsored links