Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

RF interface with keypad 3x4 & LCD 16x2 (PIC16F877A) - mikro-c compiler

Status
Not open for further replies.

annwar

Newbie level 6
Joined
Feb 25, 2011
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Sabah, Malaysia
Activity points
1,495
Hi, in my FYP for microcontroller, I proceeding a project about an RF interface

with keypad as an Input,& LCD as output.(PIC16F877A)my problem is i cant find

any program that uses RF interface with keypad and LCD. How can i send data,

using RF .. example.. enter a digit in keypad PIC1.. and then . send to another

PIC2 , im using 2 PIC as TX and RX to display at LCD screen..Im using

RF-RX-315 & RF-TX-315. Can somebody help me, with the program.. any links,

or tutorial...

all your HELP is really appreciated. THANK YOU... :-D:-D:-D
 

here is very usefull for you..
quite similar with your project..

**broken link removed**
 
  • Like
Reactions: annwar

    annwar

    Points: 2
    Helpful Answer Positive Rating
Thanks for the link.. :)

for your information, at the start im assign to do this exact project PR16, but im assign to change alittle bit of the input&output device. In this project, i have to interface with keypad 3x4 and LCD16x2 with an RF . So, when i push a button on the keypad it will be displayed on the other side wirelessly sending data. Do you know any other link... or program that exactly like this.. My problem is interfacing with he program in the RF part... how to send... n how it receive .

Anybody knows about RF sending data .. PLEASE HELP ME>> YOUR HELP IS APPRECIATED THANK YOU...arigatougozaimasu..
 

u can use UART module..as you can see in PIC16F877A datasheet, pin C6 and C7 is for tx an rx..
in the link i give below, find the serial communication section,
**broken link removed**
did you have any experience with serial comm?
 
  • Like
Reactions: annwar

    annwar

    Points: 2
    Helpful Answer Positive Rating
Thanks for the link....
NO, i have no experiance at all in microcontroller... im just started studying about serial communicatin.. .. about RS232.. terminal .. UART.. something like that laa..

but, im confuse about RF and connection between rs232... serial communication..
thus the coding on both is the same... as the RF... transmite wirellessly through
without wires.. that is what i wanna do.. transmite data using RF .. wirelessly...
can this be done>?... PLEASE HELP ME>>> REALLY APPRECIATED... can u help me with the programming in the transmite data part.. Tx Rx.. ...

1 more thing, does the coding in communication between RS232 is the same as the... coding in the RF sending data part... wirelessly... ???
 

yes the coding is still the same..
but one PIC will only tx and the other just rx..
rs323 is for computer communication..
the different in your project with rs232..
is only the way you connect it..rs232 is wired connection to computer..
but in your case is wireless connection..
in your circuit you dont need the max232 ic..
just connect the tx pin (PIC A) to the tx module..
and rx pin (PIC B) to the rx module..
 
Last edited:
  • Like
Reactions: annwar

    annwar

    Points: 2
    Helpful Answer Positive Rating
Hi,

Here's a couple of projects using the RF-315 Series modules as well as an app note.

Hope this helps in your quest.
 

Attachments

  • PICRFRXTX315.pdf
    3.1 MB · Views: 265
  • RF Datalink using a PICAXE UART.pdf
    26.3 KB · Views: 176
  • KLP_Walkthrough.pdf
    425.4 KB · Views: 185
Last edited:
  • Like
Reactions: annwar

    annwar

    Points: 2
    Helpful Answer Positive Rating
YES!!.. thanks guys.. u all are a great help.. .. i will continue on my research on this program...

>>lockman_akim

about the RS232.. when we are connected to each ther PC and PIC.. we can use UART Terminal... but when... wirelessly.. does it need to change the coding.. im curious.. need to know about that.. and,.. .. can u give me allittle sample coding.. for transmit and recieve data.. using RF...
it.. might help me.. to think clearly.. im a little bit confuse...?????

:)... THANKS GUYS>>
 

no you don need any change with the code..for example:

Transimtter PIC:

if portb.0 == 0 then
uart_write (100)


Receiver:

int x;
x = uart_read
if x == 100 then
portb.1 = 1


this is not real code..im just want to make you understand the concept..
 
  • Like
Reactions: annwar

    annwar

    Points: 2
    Helpful Answer Positive Rating
oh.. i cc.

basicly... can u tell me.. asimple code.. to transmit.. example.. a LED ON OFF..
signal.. transmit.. as switch.. to ON LED .. at reciever.. can this be done?.. HELP ME>
 

just like i give above..
u can read more about the coding in the link that i give to you before..
 
  • Like
Reactions: annwar

    annwar

    Points: 2
    Helpful Answer Positive Rating
Here are some other app notes and example code, demonstrating a tire pressure sensor, code is in assembler.

I may have some other tutorials laying around, if so I'll post them.

Ciao
 

Attachments

  • Demo.zip
    101.3 KB · Views: 168
  • Schematics and PCB.zip
    1.1 MB · Views: 165
  • 00238C.pdf
    309.1 KB · Views: 191
Last edited:
  • Like
Reactions: annwar

    annwar

    Points: 2
    Helpful Answer Positive Rating
im still confuse about this program... no matter what .. i do .. there still some error.. in the program.. can anybody help me..

is using different sofware program makes the coding unreadable?... like using mplab coding in mikroc pro program.. it all mess up.. i still dont understand.. there some coding that need to be rearranged.. and im stress out about this...

CAN anybody help with my situation..

coding.. for mikro C compiler..

RF interface... with LDC 16x2..
.. any link or tutorial.. might gonna help..

THANKS>> ALL YOUR HELP IS REALLY APPRECIATED>>
 

In order to provide help, we'll need to take a look at your code and schematics. Can you upload these two items?
 

this is my circuit n my coding.. for the program... but... im not complete with the program.. in the RF function part.... can u please correct me.. if im wrong... n HELP me with the coding in the RF function part... im having a little problem.. using mikroc compiler.. THANKS..





//-------------------------RF _ TRANSMITTER TX-------------------------//
//-------------------------------------------------------------------------//
// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections

// Keypad module connections
char keypadPort at PORTD;
// End Keypad module connections
unsigned short kp, oldstate[17], i;
unsigned long data delay(void);
void InitLCD(void);


char txt[6];

//===================================================================================
// define
//===================================================================================


#define send_button RA3
#define display PORTB
#define SYNC_DATA 0x00
#define HEADER 0xaa
//#define buzzer RB2





initMain(); //Main initialization

void initMain() //main initialization of SFR registers

{
INTCON = 0x00; //turn off interrupts
ADRESH = 0x00;
ADRESL = 0x00;
ADCON1 = 0x0F; //all inputs are digital
ADCON0 = 0x00;
TRISD = 0xFF; //PORTD is input
TRISB = 0x00;
PORTB = 0x00;
PORTD = 0x00;
}


Keypad_Init(); //Initialize Keyboard
Lcd_Init(); //Initialize LCD
Lcd_Cmd(_LCD_CLEAR) ; // Clear display





char txt1[] = "WELCOME TO";
char txt2[] = "LECTUREROOM";

char txt3[] = "PLEASE ENTER";
char txt4[] = "NUMBER =";

char txt5[] = "(1)SENSEI ZAID ";
char txt6[] = "(2)SENSEISUHANA ";

char txt7[] = "(3)SENSEI MASRI ";
char txt8[] = "(4)SENSEI SAM";

char txt9[] = "(5)SENSEI ZUL";
char txt10[] = "(6)SENSEI ANWAR";


//-------------------------------------------------------------------------//
//-------------------------------------------------------------------------//

void Move_Delay()
{ // Function used for text moving
Delay_ms(1000); // You can change the moving speed here
}

void main()
{
TRISB = 0;
PORTB = 0xFF;
TRISB = 0xff;




Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off




//-------------------------------------------------------------------------//
//-------------------------------------------------------------------------//







Lcd_Out(1,3,txt1); // Write text in first row
Lcd_Out(2,3,txt2); // Write text in second row
Delay_ms(1000);

// Moving text
for(i=0; i<3; i++) { // Move text to the right 4 times
Lcd_Cmd(_LCD_SHIFT_RIGHT);
Move_Delay();
}

// Endless loop
for(i=0; i<4; i++)
{
Lcd_Cmd(_LCD_SHIFT_LEFT); // Move text to the left 4 times
Move_Delay();
}

for(i=0; i<2; i++)
{
Lcd_Cmd(_LCD_SHIFT_RIGHT); // Move text to the right 4 times
Move_Delay();
}

Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Out(1,1,txt5); // Write text in 5th row
Lcd_Out(2,1,txt6);
Delay_ms(6000);
Lcd_Cmd(_LCD_CLEAR); // Clear display // Write text in 6th row
Lcd_Out(1,1,txt7); // Write text in 7th row
Lcd_Out(2,1,txt8);
Delay_ms(6000);
Lcd_Cmd(_LCD_CLEAR); // Clear display // Write text in 8th row
Lcd_Out(1,1,txt9);
Lcd_Out(2,1,txt10);
Delay_ms(6000);
Lcd_Cmd(_LCD_CLEAR); // Clear display // Write text in 9th row


/*
Lcd_Out(1, 1, "Enter Digit: "); //

*/




// Clear display // Write text in 9th row
Lcd_Out(1, 3, "Please Wait..."); //
Lcd_Out(2, 3, ".........");
for(i=0; i<2; i++)
{
Lcd_Cmd(_LCD_SHIFT_LEFT); // Move text to the left 4 times
Move_Delay();
}

for(i=0; i<6; i++)
{
Lcd_Cmd(_LCD_SHIFT_RIGHT); // Move text to the right 4 times
Move_Delay();
}

for(i=0; i<3; i++)
{
Lcd_Cmd(_LCD_SHIFT_LEFT); // Move text to the left 4 times
Move_Delay();
}









Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, "Enter Digit = "); //
Lcd_Out(2, 1, "= "); //


do
{ //infinite loop

/**/
kp = 0;

while (!kp)
{ //Wait for key to be pressed and released
kp = Keypad_Key_Click(); //There is a Click function in new library

Delay_ms(1); //wait a bit
}

/*
if('1')
{
Lcd_Out(2, 5, "SENSEI ZAID");
}

if('2')
{
Lcd_Out(2, 5, "SENSEI SUHANA");
}

if('3')
{
Lcd_Out(2, 5, "SENSEI MASRI");
}

if('4')
{
Lcd_Out(2, 5, "SENSEI SAM");
}

if('5')
{
Lcd_Out(2, 5, "SENSEI ZUL");
}

if('6')
{
Lcd_Out(2, 5, "SENSEI ZUL");
}

*/


for(i=0; i<12; i++)
oldstate = 0; //reset to 0 keypress counter


switch (kp)
{ // Prepare value for output
case 1: kp = '1'; break;
case 2: kp = '2'; break;
case 3: kp = '3'; break;
case 5: kp = '4'; break;
case 6: kp = '5'; break;
case 7: kp = '6'; break;
case 9: kp = '7'; break;
case 10: kp = '8'; break;
case 11: kp = '9'; break;
case 13: kp = '*'; break;
case 14: kp = '0'; break;
case 15: kp = '#'; break;
default: kp = 0;
}
/*
*/


Lcd_Chr(1, 14, kp); // Print KEY on LCD
Lcd_Out(2, 10, txt); // Print number of pressings

}

while (1);
//~!






}

//-------------------------------------------------------------------------//
//-------------------------------------------------------------------------//







/*

// MAIN RF TX TRANSMITTER
//===================================================================================
// define
//===================================================================================

#define send_button RA3
#define display PORTB


//===================================================================================
// function prototype
//===================================================================================
unsigned char data uart_send(void);
unsigned char data send_packet(void);




//===================================================================================
// functions
//===================================================================================
unsigned char data uart_send(void)
{
while(TXIF==0); //only send the new data after
TXREG = data ; //the previous data finish sent
}


unsigned char data send_packet(void)
{
unsigned char i; // Buffer for the data in one packet.
unsigned char buffer[3];

// Byte 0 is the header.


buffer[1] = data; // Byte 1 is the data.

buffer[2] = (unsigned char)(HEADER + data); // Byte 2 is the checksum.

for (i = 0; i < 7; i++) uart_send(SYNC_DATA); // Clocking for a while before sending the data so that the Tx and Rx are in sync.

for (i = 0; i < 3; i++) uart_send(buffer); // Transmit the packet using UART.

}

*/

---------- Post added at 19:33 ---------- Previous post was at 19:28 ----------

the program for the RF function.. for transmit n recieve is not complete.. this is the transmit part only.. for the recieve.. part.. i donno how to.. deal with it..
this prograam.. is funtion as.. when.. keypad pressed.. example.. no. 4... it will be send.. to the reciever.. n shown on the LCD.. by pushing the send button.. RA3..
im trying to send a couple of number.. to reciever.. or data... text.. to the reciever.. CAN U HELP ME>>

a simple coding.. for RF.. to send the desired data.. :)...
 

... hello.. again.. I HAVE A QUESTION>>

is it possible... for this project... i use manchester coding.. program..
im very curious about it.. i have try to simulate and it works pretty well...
BUT.. it is possible.. for sending data... in a type way?... im using kepad.. when i key in a number it will automatically display on the LCD reciever side..
kp = Keypad_Key_Click(); ...calling back.. what ive click.. and.. send on the reciever...??..im using mikro C compiler.. coding..

IS IT POSSIBLE?>>> IM CURIOUS>>>

PLEASE HELP ME>> >>> THANKS>.
 

Dear Sir,

Well and wish to hear the same from you.

Sir am in need of your help.

Project going on here in Robotics

In that ...

when am pressing character 'a' , corresponding ascii to be passed to COMPORT1

pls help in coding and connxn sir
 

this is my circuit n my coding.. for the program... but... im not complete with the program.. in the RF function part.... can u please correct me.. if im wrong... n HELP me with the coding in the RF function part... im having a little problem.. using mikroc compiler.. THANKS..





//-------------------------RF _ TRANSMITTER TX-------------------------//
//-------------------------------------------------------------------------//
// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections

// Keypad module connections
char keypadPort at PORTD;
// End Keypad module connections
unsigned short kp, oldstate[17], i;
unsigned long data delay(void);
void InitLCD(void);


char txt[6];

//===================================================================================
// define
//===================================================================================


#define send_button RA3
#define display PORTB
#define SYNC_DATA 0x00
#define HEADER 0xaa
//#define buzzer RB2





initMain(); //Main initialization

void initMain() //main initialization of SFR registers

{
INTCON = 0x00; //turn off interrupts
ADRESH = 0x00;
ADRESL = 0x00;
ADCON1 = 0x0F; //all inputs are digital
ADCON0 = 0x00;
TRISD = 0xFF; //PORTD is input
TRISB = 0x00;
PORTB = 0x00;
PORTD = 0x00;
}


Keypad_Init(); //Initialize Keyboard
Lcd_Init(); //Initialize LCD
Lcd_Cmd(_LCD_CLEAR) ; // Clear display





char txt1[] = "WELCOME TO";
char txt2[] = "LECTUREROOM";

char txt3[] = "PLEASE ENTER";
char txt4[] = "NUMBER =";

char txt5[] = "(1)SENSEI ZAID ";
char txt6[] = "(2)SENSEISUHANA ";

char txt7[] = "(3)SENSEI MASRI ";
char txt8[] = "(4)SENSEI SAM";

char txt9[] = "(5)SENSEI ZUL";
char txt10[] = "(6)SENSEI ANWAR";


//-------------------------------------------------------------------------//
//-------------------------------------------------------------------------//

void Move_Delay()
{ // Function used for text moving
Delay_ms(1000); // You can change the moving speed here
}

void main()
{
TRISB = 0;
PORTB = 0xFF;
TRISB = 0xff;




Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off




//-------------------------------------------------------------------------//
//-------------------------------------------------------------------------//







Lcd_Out(1,3,txt1); // Write text in first row
Lcd_Out(2,3,txt2); // Write text in second row
Delay_ms(1000);

// Moving text
for(i=0; i<3; i++) { // Move text to the right 4 times
Lcd_Cmd(_LCD_SHIFT_RIGHT);
Move_Delay();
}

// Endless loop
for(i=0; i<4; i++)
{
Lcd_Cmd(_LCD_SHIFT_LEFT); // Move text to the left 4 times
Move_Delay();
}

for(i=0; i<2; i++)
{
Lcd_Cmd(_LCD_SHIFT_RIGHT); // Move text to the right 4 times
Move_Delay();
}

Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Out(1,1,txt5); // Write text in 5th row
Lcd_Out(2,1,txt6);
Delay_ms(6000);
Lcd_Cmd(_LCD_CLEAR); // Clear display // Write text in 6th row
Lcd_Out(1,1,txt7); // Write text in 7th row
Lcd_Out(2,1,txt8);
Delay_ms(6000);
Lcd_Cmd(_LCD_CLEAR); // Clear display // Write text in 8th row
Lcd_Out(1,1,txt9);
Lcd_Out(2,1,txt10);
Delay_ms(6000);
Lcd_Cmd(_LCD_CLEAR); // Clear display // Write text in 9th row


/*
Lcd_Out(1, 1, "Enter Digit: "); //

*/




// Clear display // Write text in 9th row
Lcd_Out(1, 3, "Please Wait..."); //
Lcd_Out(2, 3, ".........");
for(i=0; i<2; i++)
{
Lcd_Cmd(_LCD_SHIFT_LEFT); // Move text to the left 4 times
Move_Delay();
}

for(i=0; i<6; i++)
{
Lcd_Cmd(_LCD_SHIFT_RIGHT); // Move text to the right 4 times
Move_Delay();
}

for(i=0; i<3; i++)
{
Lcd_Cmd(_LCD_SHIFT_LEFT); // Move text to the left 4 times
Move_Delay();
}









Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, "Enter Digit = "); //
Lcd_Out(2, 1, "= "); //


do
{ //infinite loop

/**/
kp = 0;

while (!kp)
{ //Wait for key to be pressed and released
kp = Keypad_Key_Click(); //There is a Click function in new library

Delay_ms(1); //wait a bit
}

/*
if('1')
{
Lcd_Out(2, 5, "SENSEI ZAID");
}

if('2')
{
Lcd_Out(2, 5, "SENSEI SUHANA");
}

if('3')
{
Lcd_Out(2, 5, "SENSEI MASRI");
}

if('4')
{
Lcd_Out(2, 5, "SENSEI SAM");
}

if('5')
{
Lcd_Out(2, 5, "SENSEI ZUL");
}

if('6')
{
Lcd_Out(2, 5, "SENSEI ZUL");
}

*/


for(i=0; i<12; i++)
oldstate = 0; //reset to 0 keypress counter


switch (kp)
{ // Prepare value for output
case 1: kp = '1'; break;
case 2: kp = '2'; break;
case 3: kp = '3'; break;
case 5: kp = '4'; break;
case 6: kp = '5'; break;
case 7: kp = '6'; break;
case 9: kp = '7'; break;
case 10: kp = '8'; break;
case 11: kp = '9'; break;
case 13: kp = '*'; break;
case 14: kp = '0'; break;
case 15: kp = '#'; break;
default: kp = 0;
}
/*
*/


Lcd_Chr(1, 14, kp); // Print KEY on LCD
Lcd_Out(2, 10, txt); // Print number of pressings

}

while (1);
//~!






}

//-------------------------------------------------------------------------//
//-------------------------------------------------------------------------//







/*

// MAIN RF TX TRANSMITTER
//===================================================================================
// define
//===================================================================================

#define send_button RA3
#define display PORTB


//===================================================================================
// function prototype
//===================================================================================
unsigned char data uart_send(void);
unsigned char data send_packet(void);




//===================================================================================
// functions
//===================================================================================
unsigned char data uart_send(void)
{
while(TXIF==0); //only send the new data after
TXREG = data ; //the previous data finish sent
}


unsigned char data send_packet(void)
{
unsigned char i; // Buffer for the data in one packet.
unsigned char buffer[3];

// Byte 0 is the header.


buffer[1] = data; // Byte 1 is the data.

buffer[2] = (unsigned char)(HEADER + data); // Byte 2 is the checksum.

for (i = 0; i < 7; i++) uart_send(SYNC_DATA); // Clocking for a while before sending the data so that the Tx and Rx are in sync.

for (i = 0; i < 3; i++) uart_send(buffer); // Transmit the packet using UART.

}

*/

---------- Post added at 19:33 ---------- Previous post was at 19:28 ----------

the program for the RF function.. for transmit n recieve is not complete.. this is the transmit part only.. for the recieve.. part.. i donno how to.. deal with it..
this prograam.. is funtion as.. when.. keypad pressed.. example.. no. 4... it will be send.. to the reciever.. n shown on the LCD.. by pushing the send button.. RA3..
im trying to send a couple of number.. to reciever.. or data... text.. to the reciever.. CAN U HELP ME>>

a simple coding.. for RF.. to send the desired data.. :)...















"SIR CAN YOU PLEASE UPLOAD THE WHOLE Programme you complete with Its C and Hex File's) Even I am Doin The same Project but am unable do generate the programme code"

Thank you
 

hello again... again im doing another project about RF.. and this project is mainly for using RF singnal.

Sir.. im doing a project about RF control home appliances. for controlling electrical appliances as a SWITCH.. exp: lamp fan aircond..

im going to control this using PIC16F877A as controller and same PIC on reciever ... this is my first attemp to use RF as signal...

IM GLAD if someone would HELP me on this PROJECT ... I will be using MIKROC compiler PIC16F877A . im sure YOU are familiar with this project.. using RF 315 module or higher...

if someone could give me the coding program or links n tutorial.. whatsoever.. il be glad.. THANK U so MUCH.. arigatougozaimasu.. :)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top