+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Full Member level 4
    Points: 1,652, Level: 9

    Join Date
    Sep 2014
    Location
    india
    Posts
    212
    Helped
    1 / 1
    Points
    1,652
    Level
    9

    Data transmition serielly by by 8051 through rf module.

    Dear All,
    I want to transmit data serielly by using Rf module 433mhz.I have made circuit as follow in proteus.As i press key in transmitter side then data is not seen in reciever 8051 port.pls chk & help.
    Thks,
    Tepu

    Click image for larger version. 

Name:	exp.png 
Views:	4 
Size:	4.5 KB 
ID:	149483

    Transmitter code:
    Code:
    //-----------------Program for wireless Home Automation using cheap ass 413MHz RF module
    //-----------------Target controller family: 8051 
    //-----------------Programmer: Moses Okoroafor
    //-----------------Company: Pearl Electronics Nigeria.
    //-----------------Date started: 27/04/2017
    
    
    
    #define OFF 1
    #define ON  0
    #include 
    
     
     //-----------PORT TO VARIABLE ASSIGNMENT--------------------------
    sbit BUT1 = P3^2; 
    sbit BUT2 = P3^3;
    sbit BUT3 = P3^7;
    sbit LED1 = P3^5;
    sbit LED2 = P3^4;
    
    //-------------PROTOTYPE DECLARATION------------------------------- 
    void delay(unsigned int ms);
    void UART_Init();
    void UART_TxChar(char ch);
    void transmit(int datum);
    bit i,j,k;
     
    //-------------MAIN PROGRAM STARTS HERE---------------------------- 
    void main()
    { 
    	i = j = k = 1;
    	EA = 0;
    	
    	P1 = 0X3F; P3 = 0XFF;                    // shows '0' on the 7 seg on startup
    	delay(300);
    	LED1 = LED2 = ON;
    	delay(1000);
    	LED1 = LED2 = OFF;
    	delay(100);
    	UART_Init();
    
    	while(1)
    { 
     if (!BUT1)                                           //button for one light
        {delay(30);
          if(!BUT1)
    			{ 
    				j = ~j;
    				if(j==0)
           { transmit(0x01); LED1 = ON;  if(k==0) P1 = 0X5b; else P1 = 0x06;}               //when bits are 0, lights come ON
    				 else {transmit(0x09);LED1 = OFF; if(k==1)P1 = 0X3F; else P1 = 0x06;}
    				delay(300);
    			}
    		}	
    		
    		
    
    if (!BUT2)                                           //button for the second light
        {delay(30);
          if(!BUT2)
    			{
    				k = ~k;
    				if(k==0)    {transmit(0x03); LED2 = ON; if(j==0)P1 = 0X5B; else P1 = 0X06;}                          //lights ON
    				else     {transmit(0x06); LED2 = OFF;   if(j==0)P1 = 0x06; else P1 = 0X3F;}
    				delay(300);
    			}
    		}	
    		
    		
    
    if (!BUT3)                                         // reset
        {delay(30);
          if(!BUT3)
    			{
    				i = ~i;
    				if(i==0) {transmit(0x02); LED1 = LED2 = ON; }
    				else     {transmit(0x0F); LED1 = LED2 = OFF;}
    				delay(300);
    			}
    		}			
    
     
    }
    }
     
    
    
    //---------------FUNCTION BODY DEFINITION--------------------------------------
    
    void delay(unsigned int ms){                      //generate one millisecond delay
      unsigned int i,j;
      for	(i=0; i
    
    Reciever code:

    Code:
    //-----------------Program for wireless Home Automation using cheap ass 413MHz RF module
    //-----------------Target controller family: 8051 
    //-----------------Programmer: Moses Okoroafor
    //-----------------Company: Pearl Electronics Nigeria.
    //-----------------Date started: 27/04/2017
    
    
    
    #define OFF 1
    #define ON  0
    #include 
    
     
     //-----------PORT TO VARIABLE ASSIGNMENT--------------------------
    sbit LED1 = P1^0;
    sbit LED2 = P1^1;
    
    
    //-------------PROTOTYPE DECLARATION------------------------------- 
    void delay(unsigned int ms);
    void UART_Init();
    char UART_RxChar();
    void receive();
    
     
    //-------------MAIN PROGRAM STARTS HERE---------------------------- 
    void main()
    { 
    		LED1 = LED2 = ON;
    	delay(1000);
    	LED1 = LED2 = OFF;
    	delay(100);
    	UART_Init();
    
    	while(1)
    	{
    		receive();
    	}
    }
    
    
    //---------------DEFINITION OF FUNCTIONS----------------------------------
    
    
    void delay(unsigned int ms){                      //generate one millisecond delay
      unsigned int i,j;
      for	(i=0; i
    
    Last edited by andre_teprom; 10th October 2018 at 12:45. Reason: convert pucture from BMP to PNG (viewable on the browser)

    •   AltAdvertisment

        
       

  2. #2
    Super Moderator
    Points: 27,875, Level: 40
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,313
    Helped
    1054 / 1054
    Points
    27,875
    Level
    40
    Blog Entries
    6

    Re: Data transmition serielly by by 8051 through rf module.

    Didn't you note that you have not implemented the receive() function at the receive side ?
    You have just the prototype and the the function called at the main, nothing else.
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )



    •   AltAdvertisment

        
       

  3. #3
    Full Member level 4
    Points: 1,652, Level: 9

    Join Date
    Sep 2014
    Location
    india
    Posts
    212
    Helped
    1 / 1
    Points
    1,652
    Level
    9

    Re: Data transmission serially by 8051 through rf module.

    I could'nt attach complete code.As i copy & paste full code???
    Last edited by tapu; 12th October 2018 at 08:02.



    •   AltAdvertisment

        
       

  4. #4
    Super Moderator
    Points: 27,875, Level: 40
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,313
    Helped
    1054 / 1054
    Points
    27,875
    Level
    40
    Blog Entries
    6

    Re: Data transmission serially by 8051 through rf module.

    Click on "Go Advanced" button, right below the "Quick Reply" panel.
    There you can find option to attach compressed files.
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )



  5. #5
    Full Member level 4
    Points: 1,652, Level: 9

    Join Date
    Sep 2014
    Location
    india
    Posts
    212
    Helped
    1 / 1
    Points
    1,652
    Level
    9

    Re: Data transmission serially by 8051 through rf module.

    Thank you for reply.Here is my code.



--[[ ]]--