EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / dear sir,            thanks

dear sir,            thanks

|

Microcontroller › 8051 › XBEE interfacing with 8051 › dear sir,            thanks

November 17, 2013 at 5:59 pm #10615
buddha
Participant

dear 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 communication
 
 
unsigned 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_coord
     
      y_coord = GetY();   //Get the Y-coordingates of touched location
 
     
     
      if((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 LCD
 
void main()
{
   char text[25]; //For capturing the text
   char ch;
 
  
   //Following code is for Health Check (microcontroller)
   output_high(PIN_C4);  //LED ON
   delay_ms(1000);
   output_low(PIN_C4);   //LED OFF
   delay_ms(1000);
   output_high(PIN_C4);  //LED ON
   delay_ms(1000);
   output_low(PIN_C4);   //LED OFF
  
   nokia_init();  //Initialise Nokia GLCD
 
   //Nokia LCD got 6 row and 21 columns
  
   nokia_clear_screen();  //Clear the screen contents
   
   nokia_gotoxy(2,1);  //Go to row number-1 and column number 2
   
   sprintf(text,” TOUCH SCREEN”);  //this copies the text “TOUCH SCREEN” into the variable text.
   
   printf(nokia_printchar,”%s”,text); //Print the text on to LCD
   
   delay_ms(1000);  //wait for 1000 milli seconds
  
   nokia_gotoxy(2,3);  //third row second column
   sprintf(text,”  AIR LINES”);  //copies the text into text variable
   printf(nokia_printchar,”%s”,text);
   delay_ms(500);
     
   nokia_gotoxy(2,5);  //Fifth row and second column
   sprintf(text,”  ASSISTANT”);
   printf(nokia_printchar,”%s”,text);
   delay_ms(2000);
  
  
   nokia_clear_screen(); //clear LCD contents
   nokia_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 Beep
            output_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 character
       
       nokia_clear_screen(); // clear Nokia screen LCD
      
       nokia_gotoxy(1,1);
       printf(nokia_printchar,” SEAT NO: A9″);
       output_high(PIN_C4); //LED ON
       switch(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       
   }
}
 

RSS Recent Posts

  • My Advanced Realistic Humanoid Robots Project December 7, 2025
  • Looking for single photovoltaic cells for light gate December 7, 2025
  • I am ready to move from electrical and electronics field but confused where ? December 7, 2025
  • Hitachi SuperScan Elite 802 CRT Monitor Issues (Model CM802U) December 7, 2025
  • Sanity Check – Peltier "Cooler" for Heating and Cooling December 7, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise