xBoard MINI v2.0
Easy to Use learning and development tool for Atmel AVR family of MCUs.
All of us must have used IR remote control of our TV and praise the comfort they provide. IR remote controls have become very popular these days, they comes with DVD players,ACs and many consumer electronics item. And if we can use one with our project its like dream come true !
With xBoard series of single board computer, you can very easily interface
with these IR remote controls. The board has integrated IR receiver and
we have made a very easy to use C library to work with them. Even a beginner
can control his/her project with Remote !!!
A Typical DVD player remote shipped with xBoard™ MINI |
Onboard IR Receiver. |
Short JUPMER JP1 to use IR Receiver.
To add IR support in your project follow the steps –
STEP1: Create a New
project in AVRStudio (WinAVR C Project)
STEP2: Copy
“remote.c”
“remote.h”
“rckey.h”
to your project folder. These file are present inside the folder "xAPI"
in the support CD.
STEP3: Add all the files to your project.
STEP4: Call RemoteInit(); Function at program startup.
And you are done !!!
To get the key code of key pressed in Remote Call
GetRemoteCmd();
The details of function is given below.
unsigned char GetRemoteCmd(char wait)
Description:
This function is used to get commands from the remote control.It returns the
key code of the key pressed in the remote control.
Parameters/Arguments required:
char wait [0 or 1]
If wait=0 function returns immediately and returns key code of key pressed or RC_NONE if no key is pressed.Otherwise if wait=1 function waits for the user to press a key.Function returns only if user presses a key.
Return Value:
Key Code of the key pressed.
Every key in remote has a unique number between 0-255. And this function returns this value. There are some predefined constants for some keys. For example in the remote shown above the UP KEY has code 11. It is defined in “rckeys.h” file. So to check if UP key is pressed you can write RC_UP instead of 11.
Some other constants
RC_UP
RC_DOWN
RC_LEFT
RC_RIGHT
RC_ENTER
Now we will write a simple program which will wait till a key is pressed on remote. Then it will show the KEYCODE of the key pressed.
/*********************************************************************
xBoard(TM) MINI v2.0 Sample Programs
------------------------------------
Description : Demonstrate the use of Remote Control interfacing functions.
Author : Avinash Gupta
Web : www.eXtremeElectronics.co.in
**********************************************************************/
#include <avr/io.h>
#include <util/delay.h>
#include "lcd.h"
#include "remote.h"
#include "rckeys.h"
void main()
{
//Give Some Time for other hardware to start
_delay_loop_2(0);
//Initialize the LCD Subsystem
LCDInit(LS_BLINK);
//Initialize the Remote Subsystem
InitRemote();
LCDClear();
LCDWriteString("Press Any Key On");
LCDWriteStringXY(0,1,"Remote Control");
while(1)
{
uint8_t cmd;
cmd=GetRemoteCmd(1); //Get Remote Command
LCDClear();
LCDWriteString("xBoard MINI v2.0");
LCDWriteStringXY(0,1,"Remote Cmd = ");
LCDWriteInt(cmd,3); //Print the code of received command
}
}
PROJECT FILE - Find the complete project in “Sample”
folder in CD ROM. Load the “RemoteTest.aps” file by double clicking
on it.
HEX FILE - Find hex file in “HEX”
folder in CD-ROM.
See Also: