EM4095开发板配套软件
源代码在线查看: define.h.bak
#include "w78e365.h"
#define uchar unsigned char
#define uint unsigned int
#define uint32 unsigned long
#define FWD_CMD_LOGIN 0x4
#define FWD_CMD_WRITE 0x2
#define FWD_CMD_READ 0x1
#define FWD_CMD_DISABLE 0x5
#define on 0;
#define off 1;
#define STX 0x02
#define ETX 0x03
#define MAX_COMMAND_LENGTH 15
#define CAPTURE_SIZE (2*11*4)
#define UART_MESSAGE_OK 0x00
#define ERR_ASIC_ANTENNA_FAULT 0x01
#define ERR_UART_ERROR_FLAG 0x04
#define ERR_UART_OVERFLOW 0x05
#define ERR_UART_WRONG_ICMD 0x06
#define ERR_UART_BAD_CRC 0x07
#define ERR_UART_UNKNOWN_CMD 0x08
#define ERR_UART_NO_ETX 0x09
#define ERR_UART_INTERBYTE_ERR 0x0A
#define ERR_EM4469_FLOWLINK_ERR 0x0B
#define ERR_EM4469_WRONG_DE 0x0C
#define ERR_EM4469_WRONG_DR 0x0D
#define ERR_EM4469_PARITY_ERR 0x10
#define ERR_EM4469_BAD_CONF_DATA 0x11
#define ERR_EM4469_NACK 0x12
#define ERR_EM4469_NEITHER_ACK 0x13
#define ERR_EM4469_NO_VALID_DR 0x14
#define ERR_EM4469_BAD_RAW 0x15
uchar MaxCaptureHalfDateRate;
uchar MaxCaptureDateRate;
uchar ReaderCommand[MAX_COMMAND_LENGTH];
uchar check_stat;
uint get_settings_low;
uint get_settings_hi;
bit route_usuall_animal;
uchar config_encoder; // see EM4469 spec
uchar config_data_rate; // see EM4469 spec
uchar config_delayed; // see EM4469 spec
uchar config_lwr; // see EM4469 spec
uchar config_raw; // see EM4469 spec
void (*ReadDecode)(void); //decoder routine variable
void (*WriteDecode)(void); //decoder routine variable
uchar lwr; //last word read
uchar delayed; //delayed value
uchar decode_number; //decoder routine number
uchar halfDataRate; //half period data rate modul
uchar raw; //raw flag to capture read after write response
uchar forward_link_type; //forward link modulation type
uchar capture_data[CAPTURE_SIZE]; //maximum bytes captured at once
uint maxCaptureTimeLow; //lower part of current maximum capture time (used to initialise TCNT1)
uchar maxCaptureTimeHi; //upper part of current maximum capture time (expected value 0xFF or 0xFE only)
uint read_tag_memory_word_low; // Read Cmd content low
uint read_tag_memory_word_hi; // Read Cmd content hi
uint maxTRead; //current datarate maximum response capture time
uint maxTLogin; //current datarate maximum response capture time
uint maxTWrite; //current datarate maximum response capture time
uint32 maxTWriteRaw; //current datarate maximum response capture time
uint maxTDisable; //current datarate maximum response capture time
uint32 maxTDefaultRead; //current datarate maximum response capture time
uint tpp_period; //Tpp pause in RF clocks
uint twr_period; //Twr write time pause in RF clocks
uchar last_valid; //last valid value for invalid sequence compression
uchar captured_bit_count; //store_bit current capture bit counter
uchar capture_cnt; //store_bit current capture byte index
uchar bit_pos; //bit position in demodulation
uchar enable_capture; //enable capture ( 1=capture enable)
uchar last_bit; //for biphase and miller usag
uint last_capture; //counter1 is now reset at capture start, we make a difference
uchar captured_byte; //store_bit current capture bits
uchar captured_valid; //store_bit current capture valid bits
//between current and last value
uchar capture_time[120];
uchar *capture_read_time_data_ptr;
uchar capture_check;
uchar capture_check_count;
bit buffer_capture_check;
uchar compute_capture_check;
uchar debug_mode;
uchar fwd_bit_sz; //forwardlink bit counter
uchar *fwd_write_ptr; //forwardlink bit pointer
uchar currentMaxTimeHi; //actual hi value of maximum capture time
bit flag_wait;
uchar MaxCaptureHalfDateRate;
uchar MaxCaptureDateRate;
uchar PCCommand[MAX_COMMAND_LENGTH];
uchar fwd_bit_phase; //forwardlink bit phase
uchar forwardLink_data[64]; //array of forwarded bits
uchar *forward_ptr; //ptr for forward message preparation
void SendResponse(unsigned char i);
uchar Prepare_Cmd( uchar cmd );
uchar Prepare_Addr( uchar addr );
void SendForward(uchar fwd_bit_count);
void Wait(uint period);
uchar Prepare_Data( uint data_low, uint data_hi);
void ManchesterReadCapture(void);
void ManchesterWriteCapture(void);
void BiphaseReadCapture(void);
void BiphaseWriteCapture(void);
uint count_module(void);
void ReadWordToPC(void);
void ReadStatusToPC(void);
void WriteWord(void);
void FieldSwitch(void);
void SetReaderConfiguration(void);
void GetReaderConfiguration(void);
void Disable(void);
void Login(void);
void PCLinkReader(void);
void DefaultRead(void);
void ReadOnlyAutodetection(void);
void ClearCaptureBuffers(void);
void capture(void);
void store_bit(bit b);