INTERFACING OF RFID with ARM7

Status
Not open for further replies.

simersexy

Newbie level 4
Joined
Dec 4, 2007
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,338
I am a new bie. I don't know much about ARM7. I am still learning. I have been given project to interface RF-ID with ARM7 processor. I don't know how to code. I dont even know if my project name is complete or not.(I mean just interfacing of rfid with arm7 is enough for a project or i have to do some application of it)...

This is the pic of the arm7 processor(evat103) i am using.


datasheet:- Emblitz varsity associate trainee program - ARM with Project Kit [EVAT-103] - Rs.6,800.00 : Emblitz Embedded Technologies, Embedded

This is the RFID reader i am using.(vai 27)

Specifications
Voltage:- DC 5V
Current:- <50MA
Operating Frequency:- 125 KHZ
Read Distance:- 10CM
Output:- TTL(RS232) & WEIGAND-Selectable
Antenna:- Built-in


Please help in doing my project. I have looked everywhere but i have not found any block diagram to interface these two or anything that will help me. I have also downloaded keil version 4 but don't know how to use it( I am learning). Help me in coding. Please help me.
 

The simplest interface method for the RFID Reader would be to use the TTL output option, not the Weigand. You maybe able to attach the RFID reader directly to the ARM's UART, if these pins are 5V tolerant. If they are 5V tolerant it is only a matter of configuring the UART for asynchronous serial at an appropriate BAUD rate.

You will also find several examples of RFID applications in the group:

**broken link removed**

BigDog
 
Last edited by a moderator:
I think you can interface the RFID reader using a Serial port.
Regarding the codes, I can suggest you some logic and you can work on them.
1) Get the RFID Tag code using the serial buffer.
2) Check whether there are appropriate no of bits in the code.
3) Then save it in a memory unit....

R@KE$}={
 
The ARM CPU is a LPC2129 and the IO's are 5V tolerant so you can connect it directly to the serial port on the ARM.
 
Thanx for replies. I am trying to learn its coding. I will appreciate if someone tells me what to do step by step.
 

What JTAG programmer (the grey cable in the left of the picture) have you got connected to the dev board?
Have you already installed you IDE/Compiler if so which one are you using?
Where is the datasheet to the RFID module?

You need a null modem cable to connect the 2 devices together.
Once you have answered the above questions i can help a little more...

Get a copy of this......

The Insider's Guide To The Philips ARM7-Based Microcontrollers (LPC21xx)
A Complete Introduction To The ARM7-TDMI Processor Core And Philips New LPC21xx Series
The ARM7 is set to become the 8051 of the 21st century and already many projects and engineers are moving to it. Long-standing 8051 vendors Philips, are pioneering the use of the small but fast ARM7 core in general purpose devices. The ARM7 is a 32-bit core with some advanced features which 8051 users will not have encountered before. This can result in a steep learning curve when first getting to grips with ARM7-based devices
It covers all aspects of the family, including the CPU core, peripherals and programming techniques. Each major topic is illustrated with an example program which can be run using the Keil uVISION3 ARM development environment, that is included on the accompanying CD-ROM.
The Insider's Guide can be used as the basis of a self-teaching course when used with the Keil uVISION3 compiler IDE. This includes a powerful LPC21xx simulator debugger that allow real ARM/LPC programs to be executed without any hardware.

from here

**broken link removed**



This will show you how to use Keil.


Once you have a basic understanding, i will help you write your code...
 
Last edited:
Thanx for the replies guys. I have not done the hardware part yet(will start tomorrow) , wanted to know about code first... I am using keil uvision(trying to learn to how to use it).

Here is datasheet of rfid reader that i got.

 

That datasheet does'nt say much, for example whats the format of the data, what data do you expect to get from reading a RF-ID card or device?
so it will invole some experementation i think...

First thing to do is to get you ARM working with the serial port connected to the PC so you can get some debug info out of the ARM.

So 'hello word'

In keil 'hello word' is called blinky.

Here is an example for you to play with, all it does is print hello world in a terminal, View attachment Blinky.rar

So to get it working, you need to unrar the files, then open Blinky.uvproj

now you should have a very simple project that is a starting point for any microcontroller, a simple hello word working on Uart0.
115200 Baud, 1 stop bit no parity.

so connect a serial cable from uart0 on your board to the serial port on you pc and run a terminal program like hyperterminal and you should see the output on the screen.

Once this is working then you can start to add to the project. I would start by getting the second serial port working the same, and then connecting the second port to the RF-ID module.

Have fun,,,, :lol:
 
Last edited:
Thanx Alott. Will try that tomorrow.

Btw my project is to read unique code on rfid tag from rfid reader and show it on the lcd.


---------- Post added at 20:41 ---------- Previous post was at 20:24 ----------

From where can i get terminal program like hyperterminal????
 

Hyperterminal is already there in Windows XP...
And for Windows 7 you can use 'rsterm'. It is a terminal program supporting Win 7..
 

I have to interface 16x2 LCD with arm7 lpc2129 too to show the unique no on RFID tag. How can i do that?? Can u give the circuit diagram and coding???
 

Yes what pins do you want to use for your LCD, you need 4 data lines and 4 control lines






then create an empty file called lcd.c

and paste the following code.

Code:
#include <stdio.h>
#include <LPC21xx.H>                     /* LPC21xx definitions               */
#include <stdarg.h>
#include <string.h>
/*********************** Hardware specific configuration **********************/

/*------------------------- Speed dependant settings -------------------------*/

/* If processor works on high frequency delay has to be increased, it can be 
   increased by factor 2^N by this constant                                   */
#define DELAY_2N     0

/*------------------------- Text LCD size definitions ------------------------*/

#define LineLen     16                  /* Width (in characters)              */
#define NumLines     2                  /* Hight (in lines)                   */

/*-------------------- LCD interface hardware definitions --------------------*/


/* PINS: 
   - DB4 = P1.24
   - DB5 = P1.25
   - DB6 = P1.26
   - DB7 = P1.27
   - E   = P1.31 
   - RW  = P1.29
   - RS  = P1.28                                                              */



/*These need changing according to what pins YOU want to use */
/*These need changing according to what pins YOU want to use */
/*These need changing according to what pins YOU want to use */
/*These need changing according to what pins YOU want to use */
/*These need changing according to what pins YOU want to use */
/*These need changing according to what pins YOU want to use */

#define PIN_E                 0x80000000
#define PIN_RW                0x20000000
#define PIN_RS                0x10000000
#define PINS_CTRL             0xB0000000
#define PINS_DATA             0x0F000000



/* pin E  setting to 0 or 1                                                   */
#define LCD_E(x)              ((x) ? (IOSET1 = PIN_E)  : (IOCLR1 = PIN_E) );

/* pin RW setting to 0 or 1                                                   */
#define LCD_RW(x)             ((x) ? (IOSET1 = PIN_RW) : (IOCLR1 = PIN_RW));

/* pin RS setting to 0 or 1                                                   */
#define LCD_RS(x)             ((x) ? (IOSET1 = PIN_RS) : (IOCLR1 = PIN_RS));

/* Reading DATA pins                                                          */
#define LCD_DATA_IN           ((IOPIN1 >> 24) & 0xF)

/* Writing value to DATA pins                                                 */
#define LCD_DATA_OUT(x)       IOCLR1 = PINS_DATA; IOSET1 = (x & 0xF) << 24;

/* Setting all pins to output mode                                            */
#define LCD_ALL_DIR_OUT       IODIR1  |=  PINS_CTRL | PINS_DATA;

/* Setting DATA pins to input mode                                            */
#define LCD_DATA_DIR_IN       IODIR1 &= ~PINS_DATA;

/* Setting DATA pins to output mode                                           */
#define LCD_DATA_DIR_OUT      IODIR1 |=  PINS_DATA;

/******************************************************************************/


/* 8 user defined characters to be loaded into CGRAM (used for bargraph)      */
const unsigned char UserFont[8][8] = {
  { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  { 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10 },
  { 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18 },
  { 0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C },
  { 0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E },
  { 0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F },
  { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }
};


/************************ Global function definitions *************************/


/*******************************************************************************
* Delay in while loop cycles                                                   *
*   Parameter:    cnt:    number of while cycles to delay                      *
*   Return:                                                                    *
*******************************************************************************/

static void delay (int cnt)
{
  cnt <<= DELAY_2N;

  while (cnt--);
}


/*******************************************************************************
* Read status of LCD controller                                                *
*   Parameter:    none                                                         *
*   Return:       Status byte contains busy flag and address pointer           *
*******************************************************************************/

static unsigned char lcd_read_status (void)
{
  unsigned char status;

  LCD_DATA_DIR_IN
  LCD_RS(0)
  LCD_RW(1)
  delay(10);
  LCD_E(1)
  delay(10);
  status  = LCD_DATA_IN << 4;
  LCD_E(0)
  delay(10);
  LCD_E(1)
  delay(10);
  status |= LCD_DATA_IN;
  LCD_E(0)
  LCD_DATA_DIR_OUT
  return (status);
}


/*******************************************************************************
* Wait until LCD controller busy flag is 0                                     *
*   Parameter:                                                                 *
*   Return:       Status byte of LCD controller (busy + address)               *
*******************************************************************************/

static unsigned char wait_while_busy (void)
{
  unsigned char status;

  do  {
    status = lcd_read_status();
  }  while (status & 0x80);             /* Wait for busy flag                 */

  return (status);
}


/*******************************************************************************
* Write 4-bits to LCD controller                                               *
*   Parameter:    c:      command to be written                                *
*   Return:                                                                    *
*******************************************************************************/

void lcd_write_4bit (unsigned char c)
{
  LCD_RW(0)
  LCD_E(1)
  LCD_DATA_OUT(c&0x0F)
  delay(10);
  LCD_E(0)
  delay(10);
}


/*******************************************************************************
* Write command to LCD controller                                              *
*   Parameter:    c:      command to be written                                *
*   Return:                                                                    *
*******************************************************************************/

void lcd_write_cmd (unsigned char c)
{
  wait_while_busy();

  LCD_RS(0)
  lcd_write_4bit (c>>4);
  lcd_write_4bit (c);
}


/*******************************************************************************
* Write data to LCD controller                                                 *
*   Parameter:    c:      data to be written                                   *
*   Return:                                                                    *
*******************************************************************************/

static void lcd_write_data (unsigned char c)
{
  wait_while_busy();

  LCD_RS(1)
  lcd_write_4bit (c>>4);
  lcd_write_4bit (c);
}


/*******************************************************************************
* Print Character to current cursor position                                   *
*   Parameter:    c:      character to be printed                              *
*   Return:                                                                    *
*******************************************************************************/

void lcd_putchar (char c)
{ 
  lcd_write_data (c);
}


/*******************************************************************************
* Initialize the LCD controller                                                *
*   Parameter:                                                                 *
*   Return:                                                                    *
*******************************************************************************/

void lcd_init (void)
{ 
  int i;
  unsigned char const *p;

  /* Set all pins for LCD as outputs                                          */
  LCD_ALL_DIR_OUT

  delay (15000);
  LCD_RS(0)
  lcd_write_4bit (0x3);                 /* Select 4-bit interface             */
  delay (4100);
  lcd_write_4bit (0x3);
  delay (100);
  lcd_write_4bit (0x3);
  lcd_write_4bit (0x2);

  lcd_write_cmd (0x28);                 /* 2 lines, 5x8 character matrix      */
  lcd_write_cmd (0x0C);                 /* Display ctrl:Disp=ON,Curs/Blnk=OFF */
  lcd_write_cmd (0x06);                 /* Entry mode: Move right, no shift   */

  /* Load user-specific characters into CGRAM                                 */
  lcd_write_cmd(0x40);                  /* Set CGRAM address counter to 0     */
  p = &UserFont[0][0];
  for (i = 0; i < sizeof(UserFont); i++, p++)
    lcd_putchar (*p);

  lcd_write_cmd(0x80);                  /* Set DDRAM address counter to 0     */
}



/*******************************************************************************
* Set cursor position on LCD display                                           *
*   Parameter:    column: column position                                      *
*                 line:   line position                                        *
*   Return:                                                                    *
*******************************************************************************/

void set_cursor (unsigned char column, unsigned char line)
{
  unsigned char address;

  address = (line * 40) + column;
  address = 0x80 + (address & 0x7F);
  lcd_write_cmd(address);               /* Set DDRAM address counter to 0     */
}

/*******************************************************************************
* Clear the LCD display                                                        *
*   Parameter:                                                                 *
*   Return:                                                                    *
*******************************************************************************/

void lcd_clear (void)
{
  lcd_write_cmd(0x01);                  /* Display clear                      */
  set_cursor (0, 0);
}


/*******************************************************************************
* Print sting to LCD display                                                   *
*   Parameter:    string: pointer to output string                             *
*   Return:                                                                    *
*******************************************************************************/

void lcd_print (unsigned char const *string)
{
  while (*string)  {
    lcd_putchar (*string++);
  }
}

/******************************************************************************/



void  lcd_printf ( int x, int y,const char * format, ... )
{
va_list argptr;
char buffer[20];

	va_start(argptr, format);
	vsprintf(buffer, format, argptr);
	va_end(argptr);
	set_cursor (x,y);
	lcd_print((unsigned char*)buffer);
}

create another file called lcd.h

and paste

Code:
extern void lcd_init    (void);
extern void lcd_clear   (void);
extern void lcd_putchar (char c);
extern void set_cursor  (unsigned char column, unsigned char line);
extern void lcd_print   (unsigned char const *string);
void  lcd_printf ( int x, int y,const char * format, ... );



now to use it call lcd_init(); to setup the lcd code and call



Code:
lcd_printf("rf-id %d",1234);

to print to the lcd.
 
Last edited by a moderator:

Where to call the functions??? Do i have to make separate main.c file to call the functions??
 

No

at the top of main.c

Code:
#include "lcd.h"

Then all the functions are avalible to you so..

Inside main

int main()
{

   lcd_init();

   lcd_printf("hello");

  while(i)
  {
  ...... whatever you want inside you main loop
  }




}
 
Last edited by a moderator:
In the last line where you have said call lcd_printf("rf-id %d",1234); to print to the LCD. Wont it print 1234??? I want to print the unique value of the rfid tag when i place the tag on the reader. How to relate RFID coding to LCD coding???

---------- Post added at 22:24 ---------- Previous post was at 22:17 ----------

One More thing how do i connect LCD to Arm7 processor. The diagram of the arm7 processor is given in first post. I am not able to configure where will i connect it. Plz help.
 

I have to interface 16x2 LCD with arm7 lpc2129 too to show the unique no on RFID tag. How can i do that?? Can u give the circuit diagram and coding???

When you get the Tag code through the RFID reader, just store it in any variable and then output it through to the LCD datapins...;-)
Its just about calling a different subroutine for displaying the data(Data to be displayed can be given as input to the called subroutine)
Enable the read/write pin and sent the data...
 


From the manual

• 32 bit general purpose I/O pins(P0.8-P23 & P1.16-P1.31) are connected to external
Connectors to facilitate easy system expansion.

so connect to one of the expansion connectors, i can't complete the project for you, please do a little resarch, i will help if you get stuck.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…