Mindstorms 3rd Party ROBOTC Drivers RobotC
[Home] [Download] [Submit a bug/suggestion] [ROBOTC Forums] [Blog] [Support this project]
Files | Defines | Functions | Variables

Codatex RFID Sensor
[Other]

Files

file  codatech-rfid.h
 

Codatex RFID driver.


Defines

#define CTRFID_I2C_ADDR   0x04
#define CTRFID_FIRM_VER   0x00
#define CTRFID_MAN_NAME   0x08
#define CTRFID_SENS_TYP   0x10
#define CTRFID_STATUS   0x32
#define CTRFID_OFFSET   0x41
#define CTRFID_CMD   0x00
#define CTRFID_BYTE1   0x01
#define CTRFID_BYTE2   0x02
#define CTRFID_BYTE3   0x03
#define CTRFID_BYTE4   0x04
#define CTRFID_BYTE5   0x05
#define CTRFID_SERIAL   0xA0
#define CTRFID_CMD_STOP   0x00
#define CTRFID_CMD_SINGLESHOT   0x01
#define CTRFID_CMD_CONTINUOUS   0x02
#define CTRFID_CMD_BOOTLOADER   0x81
#define CTRFID_CMD_STARTAPPFIRM   0x83

Functions

bool CTRFIDinit (tSensors link)
bool CTRFIDsetContinuous (tSensors link)
bool CTRFIDsetSingleShot (tSensors link)
bool CTRFIDreadTransponder (tSensors link, string &transponderID)
bool _CTRFIDsendCommand (tSensors link, ubyte command)
bool _CTRFIDsendDummy (tSensors link)
bool _CTRFIDreadStatus (tSensors link, ubyte &_status)

Variables

tByteArray CTRFID_I2CRequest
tByteArray CTRFID_I2CReply
bool CTRFIDreadContinuous [4] = {false, false, false, false}
bool CTRFIDinitialised [4] = {false, false, false, false}

Detailed Description

Codatex RFID Sensor


Define Documentation

#define CTRFID_BYTE1   0x01

1rst byte of transponder data

Definition at line 60 of file codatech-rfid.h.

#define CTRFID_BYTE2   0x02

2nd byte of transponder data

Definition at line 61 of file codatech-rfid.h.

#define CTRFID_BYTE3   0x03

3rd byte of transponder data

Definition at line 62 of file codatech-rfid.h.

#define CTRFID_BYTE4   0x04

4th byte of transponder data

Definition at line 63 of file codatech-rfid.h.

#define CTRFID_BYTE5   0x05

5th byte of transponder data

Definition at line 64 of file codatech-rfid.h.

#define CTRFID_CMD   0x00

Command to the RFID sensor

Definition at line 59 of file codatech-rfid.h.

#define CTRFID_CMD_BOOTLOADER   0x81

Start the bootloader

Definition at line 81 of file codatech-rfid.h.

#define CTRFID_CMD_CONTINUOUS   0x02

Continuous read, the sensor will continuously read and store data in registers 42h to 46h! After app. 2 sec. of inactivity on the I2C bus the sensor will enter the sleep mode

Definition at line 77 of file codatech-rfid.h.

#define CTRFID_CMD_SINGLESHOT   0x01

Will start a single read action, if any transponder is readable, the data will be read and stored in registers 42h to 46 h. Immediately after reading a transponder or after a max wait time of app. 0,5 seconds the sensor will enter the sleep mode

Definition at line 70 of file codatech-rfid.h.

#define CTRFID_CMD_STARTAPPFIRM   0x83

Start the application firmware

Definition at line 82 of file codatech-rfid.h.

#define CTRFID_CMD_STOP   0x00

Stop RFID sensor, will stop reading and put RFID sensor into sleep mode

Definition at line 68 of file codatech-rfid.h.

#define CTRFID_FIRM_VER   0x00

RFID Firmware version

Definition at line 54 of file codatech-rfid.h.

#define CTRFID_I2C_ADDR   0x04

RFID I2C device address

Definition at line 51 of file codatech-rfid.h.

#define CTRFID_MAN_NAME   0x08

RFID Manufacturer name (CODATEX)

Definition at line 55 of file codatech-rfid.h.

#define CTRFID_OFFSET   0x41

Offset for sensor's registers

Definition at line 58 of file codatech-rfid.h.

#define CTRFID_SENS_TYP   0x10

RFID Sensor type (RFID)

Definition at line 56 of file codatech-rfid.h.

#define CTRFID_SERIAL   0xA0

address of serial number

Definition at line 65 of file codatech-rfid.h.

#define CTRFID_STATUS   0x32

Sensor status info (0/1)

Definition at line 57 of file codatech-rfid.h.


Function Documentation

bool _CTRFIDreadStatus ( tSensors  link,
ubyte &  _status 
)

Check if the sensor is in continuous mode.

Note: this is an internal function and should not be called directly.

Parameters:
linkthe CTRFID port number,
_statusthe sensor's status (continuous mode : 1, idle : 0),
Returns:
true if no error occured, false if it did

Definition at line 154 of file codatech-rfid.h.

bool _CTRFIDsendCommand ( tSensors  link,
ubyte  command 
)

Send a command to the RFID sensor.

Note: this is an internal function and should not be called directly.

Parameters:
linkthe CTRFID port number,
commandthe CTRFID command to be sent to the sensor
Returns:
true if no error occured, false if it did

Definition at line 114 of file codatech-rfid.h.

bool _CTRFIDsendDummy ( tSensors  link )

Send a dummy I2C packet to the sensor to wake it up

Note: this is an internal function and should not be called directly.

Parameters:
linkthe CTRFID port number,
Returns:
true if no error occured, false if it did

Definition at line 136 of file codatech-rfid.h.

bool CTRFIDinit ( tSensors  link )

< Functions definition

Configure the sensor for reading transponders

Parameters:
linkthe CTRFID port number,
Returns:
true if no error occured, false if it did

Definition at line 184 of file codatech-rfid.h.

bool CTRFIDreadTransponder ( tSensors  link,
string &  transponderID 
)

Read transponder ID's bytes. This function needs that a reading mode to be selected before using it.

Parameters:
linkthe CTRFID port number,
transponderIDthe read transponder ID,
Returns:
true if no error occured, false if it did
Examples:
codatech-rfid-test1.c, and codatech-rfid-test2.c.

Definition at line 237 of file codatech-rfid.h.

bool CTRFIDsetContinuous ( tSensors  link )

Configure the sensor for reading transponders in continuous mode

Parameters:
linkthe CTRFID port number,
Returns:
true if no error occured, false if it did
Examples:
codatech-rfid-test2.c.

Definition at line 200 of file codatech-rfid.h.

bool CTRFIDsetSingleShot ( tSensors  link )

Configure the sensor for reading transponders in single shot mode

Returns:
true if no error occured, false if it did

Definition at line 218 of file codatech-rfid.h.


Variable Documentation

Array to hold I2C reply data

Definition at line 100 of file codatech-rfid.h.

< Global variables Array to hold I2C command data

Definition at line 99 of file codatech-rfid.h.

bool CTRFIDinitialised[4] = {false, false, false, false}

Has the sensor been initialised?

Definition at line 103 of file codatech-rfid.h.

bool CTRFIDreadContinuous[4] = {false, false, false, false}

Is the sensor configured for Continuous mode?

Definition at line 102 of file codatech-rfid.h.