Microcontroller › 8051 › XBEE interfacing with 8051
- This topic has 19 replies, 7 voices, and was last updated 7 years, 12 months ago by
hanumanth.
-
AuthorPosts
-
November 17, 2013 at 5:59 pm #10615
buddha
Participantdear sir,
thanks for ur reply…as am using mplab 6.62 version as compiler but i could not convert my code into hex code…somehow error comes to it.as i am new to use mplab and i have seen mplab user guid as well but dont understand how to do it..as this is code..
.this is for trasmitter.
#include <16F73.h>#use delay(clock=20000000)#use rs232 (baud = 9600, xmit=PIN_B0,rcv=PIN_B1,stream=WIRELESS) // WIRELESS communicationunsigned long x_coord, y_coord;void send_data(char sdata[]){fputs(sdata,WIRELESS);}unsigned long GetX(){unsigned long result;set_adc_channel(0);output_low(PIN_A2);output_high(PIN_A3);result = read_adc();return result;}unsigned long GetY(){unsigned long result;set_adc_channel(1);output_low(PIN_A3);output_high(PIN_A2);result = read_adc();return result;}void main(){char text[25];output_high(PIN_C4);delay_ms(1000);output_low(PIN_C4);delay_ms(1000);output_high(PIN_C4);delay_ms(1000);output_low(PIN_C4);while(1){x_coord = GetX(); //get X- coordinates of touched location on to variable x_coordy_coord = GetY(); //Get the Y-coordingates of touched locationif((x_coord > 25) && (x_coord < 85) && (y_coord > 25) && (y_coord < 125)){sprintf(text,”1″);send_data(text);output_high(PIN_C4);}else if((x_coord > 25) && (x_coord < 85) && (y_coord > 150) && (y_coord < 240)){sprintf(text,”2″);send_data(text);output_high(PIN_C4);}else if((x_coord > 90) && (x_coord < 140) && (y_coord > 25) && (y_coord < 125)){sprintf(text,”3″);send_data(text);output_high(PIN_C4);}else if((x_coord > 90) && (x_coord < 140) && (y_coord > 150) && (y_coord < 240)){sprintf(text,”4″);send_data(text);output_high(PIN_C4);}else if((x_coord > 145) && (x_coord < 190) && (y_coord > 25) && (y_coord < 125)){sprintf(text,”5″);send_data(text);output_high(PIN_C4);}else if((x_coord > 145) && (x_coord < 190) && (y_coord > 150) && (y_coord < 240)){sprintf(text,”6″);send_data(text);output_high(PIN_C4);}else if((x_coord > 195) && (x_coord < 250) && (y_coord > 25) && (y_coord < 125)){output_high(PIN_C3); //LED Lamp ON}else if((x_coord > 195) && (x_coord < 250) && (y_coord > 150) && (y_coord < 240)){output_low(PIN_C3); //LED Lamp OFF}delay_ms(100);output_low(PIN_C4);}}this is for recever.#include <16F73.h>#use delay(clock=20000000) //crystal oscillator#use rs232 (baud = 9600, xmit=PIN_B1,rcv=PIN_B0,stream=WIRELESS) // WIRELESS communication#include <nokiaGLCD.c> //For Nokia Graphical LCDvoid main(){char text[25]; //For capturing the textchar ch;//Following code is for Health Check (microcontroller)output_high(PIN_C4); //LED ONdelay_ms(1000);output_low(PIN_C4); //LED OFFdelay_ms(1000);output_high(PIN_C4); //LED ONdelay_ms(1000);output_low(PIN_C4); //LED OFFnokia_init(); //Initialise Nokia GLCD//Nokia LCD got 6 row and 21 columnsnokia_clear_screen(); //Clear the screen contentsnokia_gotoxy(2,1); //Go to row number-1 and column number 2sprintf(text,” TOUCH SCREEN”); //this copies the text “TOUCH SCREEN” into the variable text.printf(nokia_printchar,”%s”,text); //Print the text on to LCDdelay_ms(1000); //wait for 1000 milli secondsnokia_gotoxy(2,3); //third row second columnsprintf(text,” AIR LINES”); //copies the text into text variableprintf(nokia_printchar,”%s”,text);delay_ms(500);nokia_gotoxy(2,5); //Fifth row and second columnsprintf(text,” ASSISTANT”);printf(nokia_printchar,”%s”,text);delay_ms(2000);nokia_clear_screen(); //clear LCD contentsnokia_gotoxy(3,3);sprintf(text,”*** READY ***”);printf(nokia_printchar,”%s”,text);delay_ms(1000);while(1) //Infinite loop starts here{if(!input(PIN_A0)) //If the clear button pressed, then clear the requests on LCD{output_high(PIN_C3);delay_ms(500); //Long Beepoutput_low(PIN_C3);nokia_clear_screen();nokia_gotoxy(4,1);printf(nokia_printchar,” NO”);nokia_gotoxy(4,3);printf(nokia_printchar,” PENDING”);nokia_gotoxy(4,5);printf(nokia_printchar,” REQUESTS”);output_low(PIN_C4);}ch = fgetc(WIRELESS); //get characternokia_clear_screen(); // clear Nokia screen LCDnokia_gotoxy(1,1);printf(nokia_printchar,” SEAT NO: A9″);output_high(PIN_C4); //LED ONswitch(ch) //switch to the block based on character received.{case ‘1’:nokia_gotoxy(4,3);printf(nokia_printchar,” REQUESTING”);nokia_gotoxy(4,5);printf(nokia_printchar,” WATER”);break;case ‘2’:nokia_gotoxy(4,3);printf(nokia_printchar,” REQUESTING”);nokia_gotoxy(4,5);printf(nokia_printchar,” FOOD”);break;case ‘3’:nokia_gotoxy(4,3);printf(nokia_printchar,” REQUESTING”);nokia_gotoxy(4,5);printf(nokia_printchar,” MEDICINE”);break;case ‘4’:nokia_gotoxy(4,3);printf(nokia_printchar,” REQUESTING”);nokia_gotoxy(4,5);printf(nokia_printchar,” BED SHEET”);break;case ‘5’:nokia_gotoxy(4,3);printf(nokia_printchar,” REQUESTING”);nokia_gotoxy(4,5);printf(nokia_printchar,” SNACKS”);break;case ‘6’:nokia_gotoxy(4,3);printf(nokia_printchar,” REQUESTING”);nokia_gotoxy(4,5);printf(nokia_printchar,” MAGAZINE”);break;} //end of switch statement}}November 19, 2013 at 5:06 am #10617AJISH ALFRED
ParticipantHi,
Please copy paste the compiler output message here , so that I can easily find out the errors in the code.
February 7, 2014 at 5:37 pm #10974prakash gupta
Participanthello friends,
i m a final year student and i am working under major project where the project aim is…..
” XBEE BASED REMOTE MONITORING OF 3 PARAMETERS ON TRANSFORMER / GENERATOR
HEALTH WITH VOICE ANNOUNCEMENT AND WIRELESS PC INTERFACE”
i have only block diagram of transmitter & recevier section of this project but i have not the circuit
diagram due to that i am not able to interfece it with controller 8051…..can u please direct to me…
April 15, 2015 at 4:48 pm #12790saranya
Participanti need program for interfacing xigbee with pic18f4550 with inputs of sensor to xigbee
February 11, 2017 at 12:21 pm #14430hanumanth
Participantcan u upload circuit connection of xbee with 8051
-
AuthorPosts
- You must be logged in to reply to this topic.