Discussion in "8051 Discussion Forum" started by    hotzinfo    Sep 18, 2010.
Sat Sep 18 2010, 03:34 am
#1
am simulating serial communication on protues 7 using the virtual terminaland 8952 , when i transmit data to the VT , it is wriiten on only one line.hw do i change line of txet on the VT
Sat Sep 18 2010, 06:37 pm
#2
hi hotzinfo
after sending the data at the end send 0x0d it is a command for hyper terminal to display character to next line


[ Edited Sat Sep 18 2010, 06:37 pm ]
Sat Sep 18 2010, 11:10 pm
#3
In real scenario you have to send Carriage return and line feed to get to new line.
for Carriage Return send 0x0D
and for Line Feed send 0x0A

so each line should end with a 0x0D and 0x0A both. order of sending doesnt mattery but usually CR+LF is used.
Wed Sep 22 2010, 12:17 pm
#4
hi..
m trying to make a RF remote control and will control upto eight devices.
wat i have done i m sending value of one port of the transmitter controller to receiver through serial communication.

My transmitter code is here
#include<reg51.h>

//void delay(unsigned int);
void main()
{
	unsigned char Txdata;

	TMOD=0x20;
	TH1=0xFD;
	SCON=0x50;
	TR1=1;
	P1=0xFF;
	while(1)
	{
		Txdata=P1;
		SBUF=Txdata;
		while(TI==0);
		TI=0;
	
	//	delay(500);
	
	}
}

/*void delay(unsigned int itime)
{
	unsigned int i,j;
	for(i=0;i<itime;i++)
		for(j=0;j<1275;j++); 
} */


and receiver code is
#include<reg51.h>

//void delay(unsigned int);
void main()
{

	unsigned char Rxdata;
	TMOD=0x20;
	TH1=0xFD;
	SCON=0x50;
	TR1=1;

	while(1)
	{  
		while(RI==0);
		Rxdata=SBUF;
		P2=Rxdata;
		RI=0;
	//	delay(500);
	
	}
}

/*void delay(unsigned int itime)
{
	unsigned int i,j;
	for(i=0;i<itime;i++)
		for(j=0;j<1275;j++); 
} */


i simulated the same code on Proteus. it is behaving as expected but wen i implement it on hardware,it is behaving abnormally. i mean port values are transmitted on different ports (like P1.0 in Tx is transmitted on P2.0 and P2.2 of receiver side simultaneously)...
what could be the problem even when i tried it without Rf module(wired connection)
do i need to ammend the code??

Wed Sep 22 2010, 03:31 pm
#5
In both transmitter and receiver code add a line
TL1=0xFD;


after that in receiver code add a line
P1=0x00;



after that in each program introduce some delay after each sending just for checking purpose and check the hardware connections carefully and crystal values


[ Edited Wed Sep 22 2010, 03:32 pm ]
Sat Sep 25 2010, 04:55 pm
#6
Thanks mazoka..
i tried d same as per your advise and got some good result.
now i can control devices through serial communication but i got stuck ,when i replaced the wired connection with RF module.
i observed that the receiver behave abnormally .Receiver switches the devices random,even when i kept my transmitter off.

I know

receiver is picking up the noise and understand it as a signal

.
what should i do to filter this noise? do i need to change the algorithm in the receiver code ??

help me out plz
Sat Sep 25 2010, 05:03 pm
#7
i found some algorithm on internet for filtering the data but they are for avr controller .
i tried to apply the same algorithm for 8051...and simulate that program on proteus..
fortunately program worked well on simulation but when i implement it on hardware ,i didn't get any response from Receiver.

where is the problem?
I am attaching the whole project keil files (for tx and Rx both)+ proteus design files

please go through this and let me know where i am wrong..
Attachment
Sun Sep 26 2010, 12:50 am
#8
in proteus many things do work and u try it by wirerd wireless has a lot of problems even producing noise every time
i check the code that is all right
which wirless modules ur using and algorithm for filtering the data is same for avr and 8051
first in ur hardware check that through wire to verifying that ur code is working and no problem with hardware
after that come to the wireless
Mon Sep 27 2010, 01:36 pm
#9
hello sir,
i tried d same code (Tx_rx.rar,which i posted earlier) with hardware (even having wired connections between controllers ). but it didnt work...

while transmitter was transmitting d right data as i checked that in terminal program,receiver isn't responding



when i check the following program Tx program
TMOD=0x20;
        TH1=0xE8;   // baud rate 1200 bps only
        SCON=0x50;
        TR1=1;
        P1=0xFF;
        while(1)
        {
                Txdata=P1;
                SBUF=Txdata;
                while(TI==0);
                TI=0;
       
             delay(200);
       

and receiver program was
void main()
{

        unsigned char Rxdata;
        TMOD=0x20;
        TH1=0xE8;  // baud rate 1200 bps
        SCON=0x50;
        TR1=1;

        while(1)
        {  
                while(RI==0);
                Rxdata=SBUF;
                P2=Rxdata;
                RI=0;
              delay(200);
       
        }
}


circuit works accordingly (but with wired connection and again behaving abnormal way when through RF module)
how to get out of it..??

so i think my Tx_rx.rar code(which has some kind of algorithm for filtering the data) is useless while simple code works well..


i have encoder and decoder HT12E and HT12D. but i dont know how to interface these two with microcontroller serial port. please suggest urgently:P

Mon Sep 27 2010, 02:51 pm
#10
HT12E and HT12D consider it 2nd option
1st option to troubleshoot the circuit
try this and tell me soon
crystal @ 11.0592 MHz and AT89C51
Tx program
#include<reg51.h>

void DelayMs(unsigned int) ;
void main ()
{
        P1=0xFF;
        TMOD=0x20;
        TL1=0xE8;
        TH1=0xE8;   // baud rate 1200 bps only
        SCON=0x50;
        TR1=1;
        while(1)
        {
                Txdata=P1;
                SBUF=Txdata;
                while(TI==0);
                TI=0;
       
             DelayMs(500);
}
}


//---------------------------------------
// Delay mS function
//---------------------------------------
void DelayMs(unsigned int count) 
{  // mSec Delay 11.0592 Mhz 
    unsigned int i;		       		// Keil v7.5a 
    while(count) {
        i = 115; 
		while(i>
0) i--;
        count--;
    }
}       



receiver program

#include<reg51.h>

void main()
{

        unsigned char Rxdata;
        TMOD=0x20;
        TL1=0xE8;
        TH1=0xE8;  // baud rate 1200 bps
        SCON=0x50;
        TR1=1;

        while(1)
        {  
                while(RI==0);
                Rxdata=SBUF;
                P2=Rxdata;
                RI=0;
             
       
        }
}


as u earlier tell u that u check it transmitter on hyper terminal program both ics with transmitter program and check on hyper terminal to verify that both hardware is ok some time crystal burns or losses it exact frequency sold these circuit on pcb or varoboard , on bread board some time error occures
when u check it on hyper terminal obviously u used max 232 but when u want 2 communicate between two controllers be sure max232 is not attached
check this with wired and tell me response
when trying this program ground of both controller should be common so that it understand each other
or simple led blinking program burn to both the circuits and check is it running properlly or not to decome sure hardware is ok in all aspects
and post is possible ur exact hardware diagram u made infact not of proteus


[ Edited Mon Sep 27 2010, 02:51 pm ]

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

KevinTab
Sun Apr 28 2024, 05:35 am
Tumergix
Sun Apr 28 2024, 12:59 am
StevenDrulk
Sat Apr 27 2024, 08:47 pm
StephenHauct
Sat Apr 27 2024, 09:38 am
Adamsaf
Sat Apr 27 2024, 07:12 am
Robertphype
Sat Apr 27 2024, 12:23 am
ktaletrryp
Fri Apr 26 2024, 10:55 pm
Robertrip
Fri Apr 26 2024, 11:20 am