[SOLVED] Serial Communication not working without not gates

Status
Not open for further replies.

LeoStar

Member level 2
Joined
Nov 19, 2014
Messages
50
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Visit site
Activity points
500
Hello everyone,
I am very much familiar with the Max 232 chip and how it works. I am just trying to make 8051 communicate with PC. I am trying to toggle Leds from hyper-terminal. But for some reason it is not working. I have tried the layout on Proteus as well with the same result.
So I hope that I am knocking the right door for help.
Please reply soon!!!
 

Please post circuit and also zip and post your project files.

Thanks a lot for looking into the matter so quickly.
Sir I want to inform just one thing, I am just trying to toggle the bits of port 2 like I send 1 from hyper-terminal to set he bit and 2 to clear it.
I tried tried it out with proteus using max232 and compm.
I created a pair of two logical ports using Virtual serial port emulator.
And sent the characters from hyper-terminal.
It did not work.
I noticed that pins T1out and R1out of Max232 are with bubbles which means the output is inverted. So I used not gates with these pins and the circuit worked.
This is where I am confused, do I need to use the i.e. 74LS04 ic in the circuit as well to make it work.
RSVP.
 

In proteus you don't have to use MAX232. Just connect COMPIM to PIC UART pins. In read hardware you have to connect MAX232 to PIC but you don't need NOT gates.
 
You are absolutely right.
I tried it on hardware firstly.
When it did not work then in order to check the integrity of the circuit I turned to proteus and designed the circuit the way it is on the pcb and tried the simple program of setting and clearing the bit from hyper-terminal and it did not work as well.
Then I tried with not gates on T1 out and R1 out and it worked both with PIC as well as 8051.
That is the reason I am so confused because it is mentioned nowhere that we have to use not gates with these pins.
 

The signals ARE inverted but in most serial links there is a double inversion, once in the MAX232 and again inside the serial port so the signal polarity is restored. RS232 specifications (for historical reasons) state this should be done.

The standard PC serial port accepts a voltage of +12V for a logic '0' and -12V for a logic '1' although in most cases the voltage is actually lower than that due to circuit design. The MAX232 is designed to invert and elevate the voltages from the 8051 logic levels to the RS232 levels.

Some simulators ignore what the voltages really are and just treat them as logic high or low instead.

Brian.
 

I agree with you but it is not happening.
All the connections are up to the mark,I have replaced the Max232 twice but still it is not working.
Now I am trying it with 74ls04 chip.
Lets see what it does.
 

Zip and post your actual hardware circuit and project files. Pullup PIC Rx and Rx lines.
 

Hellooo Champions of electronics,
I am just a beginner so am back with another problem,
I am trying to make serial communication between PIC16F877A and PC through hyperterminal.
The circuit is fine and the hardware is also good.
How it works: Whenever it receives a character it should display it on the LCD connected on PORTB.
What it is actually doing:
It is acting moodily, sometimes it receives and sometimes not. Sometimes it displays the character twice or thrice and then clears the screen.
This is what is happening.
I have changed the DB9 port and the USB to RS232 converter;
I tried by plugging it directly into the DB9 port of the PC,
But nothing rescued me from the problem,
So i decided to bother you guys and I know it is nothing new to you.
Please reply ASAP!!!!!!!!!
 

It is acting moodily, sometimes it receives and sometimes not. Sometimes it displays the character twice or thrice and then clears the screen.
Clearly a software problem, unrelated to the recent topic of this thread.
 

Yes Sir, exactly.
Now I tried to send something from PIC16F877A to the hyperterminal with the following code.


Code dot - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
char arr[]="B.Tech\n\r";
char arr2[]="ECE\n\r";
void main()
{
int i,j;
spbrg=0x19;     /*or 6*/
rcsta.spen=1;
txsta=0x24;
while(1)
{                      /*for displaying one time remove while*/
for(i=0;i<=7;i++)
{delay_ms(10);
Txreg=arr[i];
while(pir1.txif==0);
}
for(j=0;j<=4;j++)
{
delay_ms(10);
Txreg=arr2[j];
while(pir1.txif==0);
}
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
while(1);
}
}



What it should do: Send the array for once and them should get into the infinite loop after 3 seconds.
What it does it transmits the names again after 3 seconds.
How to stop it from sending the names again and again???
 
Last edited by a moderator:

Maybe MCU is resetting. See if Watch Dog Timer is enabled. If you are testing in Proteus then you have to set for Enable WDT as No. In config words set WDT to OFF.
 

Sir everything is disabled in the configuration and the oscillator is set XT making the configuration 2F09.
 

If you are testing in Proteus then Zip and post the complete project files and Proteus file.
 

No sir I am not doing anything on proteus.
I have the hardware ready and sometimes it works and sometimes not.
 

Could u please sent the library And model files for max 232 for proteus. İ have one but its sayin for all the pins of max232 not modeled when i rün a simulatiion
 

MX232 is not needed in Proteus simulation. Just connect TxD of COMPIM to Tx of MCU and RxD to Rx.
 

PORTC.6 and PORTC.7 is used for UART communication. PORTC.7 is Rx and PORTC.6 is Tx pins. Rx pin needs to be set as input pin. So, use


Code C - [expand]
1
TRISC = (TRISC & 0x3F) | 0x80;

This is for PIC16F

If you use PIC18F you have to set TRISC to 0xC0 if PORTC has UART then PIC18F will auto configure as needed.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…