Cannot read data from UHF RFID Sensor Tag SL900A
时间:04-04
整理:3721RD
点击:
I want to read data from RFID tag. I use VS2010 C++ and Qt librabry to design a GUI. I can read data from passive tag but when I supply battery to this tag I cannot read any data. The RFID tag sensor I use is SL900A. In the SL900A datasheet, it has 2 logging forms and has different memory banks. I am a newbie so let me know if anyone has knowledge about that.
And the Mode in here
I solved the above problem but I meet another one. I want to interface with SL900A (sensor tag) using MCU Microchip by applying SPI. But I cannot write data into EEPROM of sensor tag. These are my code:
Code:
#define SEN PORTC.B1
#define WRITE 0x0000
#define READ 0x4000
#define PAGE_WR 0x0800
unsigned int uiTemp=0;
//Write function for the SPI interface
void SL900A_Write(unsigned int uiMode, unsigned int uiAddress, unsigned char ucData){
SEN = 1; //Enable Slave select
delay_us(500); //SEN to first SCLK rising edge setup time
//Transmit 16 bit data
uiTemp = (uiMode&0xff00) | uiAddress;
SPI1_Write(uiTemp);
SPI1_Write(ucData); //Data need to transmit
delay_ms(1);
SEN = 0; //Stop
}
void main()
{
unsigned char ucwrData, ucMo;
unsigned int uiMo, uiAdd,i,uiTemp1;
//FOSC = 0b110; INTOSC oscillator
//OSCCON = 0b01011010; //Internal Oscillator 1Mhz --- SL900A -> 1.5v
//OSCCON = 0b01101010; //Internal Oscillator 4Mhz
OSCCON = 0b01110010; //Internal Oscillator 8Mhz
//OSCCON = 0b01111010; //Internal Oscillator 16Mhz
TRISC.B1 = 0; //RC1 output Select SPI
PORTC.B1 = 1;
TRISB.B4 = 0; //RB4 output test led
//SPI
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV4, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
//SPI1_Init();
//Choose MODE in here
uiMo = WRITE;
//uiAdd = 0x047E; //the last physical address of SL900A User_Memory
uiAdd = 0; //The first physical address of SL900A User_Memory
ucwrData = 0x01;
for (i=0;i<100;i++){
SL900A_Write(uiMo,uiAdd+i,ucwrData);
delay_ms(1);
}
while(1){
PORTB.B4 = 0;
//delay_ms(100);
//PORTB.B4 = 0;
//delay_ms(100);
}
}
And the Mode in here
I think the problem in the SPI function. I also tested and simulated in Proteus and the CLK_pin of SPI interface it did not show me the clock output.
