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

📄 hardware.h

📁 我里面有比较详细的7960的PDF
💻 H
字号:
#ifndef _HARDWARE_H
#define _HARDWARE_H

#include "include.h"

#define LSD_READER    2
#define HARDWARE LSD_READER

#if HARDWARE == LSD_READER
//***CPU卡平台(LSD—TRF7960R—D1)****************************************************************
// P1.0 ----> IRQ       P2.0 ----> BEEP    P3.0 ----> LED_GRE     P4.0 ----> IO_0
// P1.1 ----> NC        P2.1 ----> LED_YEL P3.1 ----> LED_RED     P4.1 ----> IO_1
// P1.2 ----> NC        P2.2 ----> NC      P3.2 ----> EN          P4.2 ----> IO_2
// P1.3 ----> NC        P2.3 ----> NC      P3.3 ----> DATA_CLK    P4.3 ----> IO_3
// P1.4 ----> NC        P2.4 ----> NC      P3.4 ----> RXD         P4.4 ----> IO_4
// P1.5 ----> NC        P3.5 ----> NC      P3.5 ----> TXD         P4.5 ----> IO_5
// P1.6 ----> NC        P2.6 ----> XL      P3.6 ----> NC          P4.6 ----> IO_6
// P1.7 ----> NC        P2.7 ----> XL      P3.7 ----> NC          P4.7 ----> IO_7
//*************************************************************************************************

#define TRFWrite 	P4OUT		//port4 is connected to the
#define TRFRead  	P4IN		//TRF796x IO port.
#define TRFDirIN	P4DIR = 0x00;
#define TRFDirOUT	P4DIR = 0xFF;
#define TRFSerial	P4DIR = 0x9F;
#define TRFFunc		P4SEL = 0x00;

#define EnableSet	P3DIR |= BIT2  
#define TRFEnable	P3OUT |= BIT2		//EN pin on the TRF796x
#define TRFDisable              P3OUT &= ~BIT2

//PIN operations---------------------------------------------
#define clkPINset               P3DIR |= BIT3		//CLK on P3.3
#define clkON		P3OUT |= BIT3   
#define clkOFF		P3OUT &= ~BIT3

#define irqPINset	P1DIR &= ~BIT1; 
#define irqPIN		BIT0
#define irqPORT		P1IN
#define irqON		P1IE |= BIT0		 //IRQ on P1.0
#define irqOFF		P1IE &= ~BIT0		 //IRQ on P1.0
#define irqEDGEset              P1IES &= ~BIT0		 //rising edge interrupt
#define irqCLR		P1IFG = 0x00
#define irqREQreg	P1IFG

#define LEDpowerON	P3OUT |=  BIT1;                  //P3.1
#define LEDpowerOFF	P3OUT &= ~BIT1;
#define LED15693ON	P3OUT |=  BIT0;                  //P3.0
#define LED15693OFF	P3OUT &= ~BIT0;
#define LEDtypeAON	P2OUT |=  BIT1;                  //P2.1
#define LEDtypeAOFF	P2OUT &= ~BIT1;
#define LEDtypeBON	P3OUT |=  BIT0,P2OUT |=  BIT2;
#define LEDtypeBOFF	P3OUT &= ~BIT0,P2OUT &= ~BIT2;
#define LEDtagitON	P3OUT |=  BIT0;
#define LEDtagitOFF	P3OUT &= ~BIT0;

#define LEDportSET	P3DIR |= (BIT0 + BIT1),P2DIR |= ( BIT1);
#define LEDallOFF	P3OUT &= ~BIT1;P3OUT &= ~BIT0;P2OUT &= ~BIT1;
#define LEDallON	P3OUT |=  BIT1;P3OUT |=  BIT0;P2OUT |=  BIT1;

#define OOKdirIN	P3DIR &= ~BIT7;                 // P3.7

#endif


//Counter-timer constants------------------------------------
#define countValue	TACCR0		//counter register
#define startCounter	TACTL |= MC0 + MC1	//start counter in up mode
#define stopCounter	TACTL &= ~(MC0 + MC1)	//stops the counter
#define count1ms	847

//=======TRF definitions=========================
//Reader addresses
#define ChipStateControl	0x00
#define ISOControl	0x01
#define ISO14443Boptions	0x02
#define ISO14443Aoptions	0x03
#define TXtimerEPChigh	0x04
#define TXtimerEPClow	0x05
#define TXPulseLenghtControl	0x06
#define RXNoResponseWaitTime	0x07
#define RXWaitTime	0x08
#define ModulatorControl	0x09
#define RXSpecialSettings	0x0A
#define RegulatorControl	0x0B
#define IRQStatus	0x0C
#define IRQMask		0x0D
#define CollisionPosition	0x0E
#define RSSILevels	0x0F
#define RAMStartAddress	0x10	                //RAM is 7 bytes long (0x10 - 0x16)
#define TestSetting1	0x1A
#define TestSetting2	0x1B
#define FIFOStatus	0x1C
#define TXLenghtByte1	0x1D
#define TXLenghtByte2	0x1E
#define FIFO		0x1F

//Reader commands-------------------------------------------
#define Idle		0x00
#define SoftInit	0x03
#define InitialRFCollision	0x04
#define ResponseRFCollisionN	0x05
#define ResponseRFCollision0	0x06
#define Reset		0x0F
#define TransmitNoCRC	0x10
#define TransmitCRC	0x11
#define DelayTransmitNoCRC	0x12
#define DelayTransmitCRC	0x13
#define TransmitNextSlot	0x14
#define CloseSlotSequence	0x15
#define StopDecoders	0x16
#define RunDecoders	0x17
#define ChectInternalRF	0x18
#define CheckExternalRF	0x19
#define AdjustGain	0x1A
//==========================================================


void InitSysClk(void);
void DelayMs(unsigned int n_ms);
void CounterSet(void);

#endif

⌨️ 快捷键说明

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