Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Serial transfer not happening using Max232

Status
Not open for further replies.

ananthashayanams

Junior Member level 2
Junior Member level 2
Joined
Jul 21, 2007
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,455
sch.jpg

hardware
PIC : 16F877A
Compiler : CCS
Burner : MicroPro
Serial IC : MAX232
Programming : ICSP mode

Hi

I have a serial port connected to my PIC16F877A through MAX232. I use hyperterminal with a RS232-USB converter. The problem is, any data transmitted from the PIC comes as 0's (zeroes) in Hyper Terminal, not able to find out what is the problem
V+ = 8.67V V- = -7.59V

The capacitors used are 10uF 63V, guess the capacitor voltage should be higher than 10V as MAX232 generates +-8V.

I tried a very simple program of sending just a character A using putc("A"), but this comes as zero.
 
Last edited:

Try to test the loop: start with making a connection between pins 2 and 3 on DB9 and send a character via hyperterminal; it should echo it back to the screen.
Then go one step further: connect pins T1in (11) and R1out (12), or whichever you use, and sent a character ...
:wink:
IanP
 
  • Like
Reactions: tpetar

    tpetar

    Points: 2
    Helpful Answer Positive Rating
Hi,

If you use RS232 - USB converter then you must select proper com port ( with proper baud rate )in hyper-terminal as assign by Os for converter. You can seen your com port no. in hardware manager.

Regards,
 
@ IanP
Changed my Terminal to Hterm, works al most like Hyperterminal with more options.
Tried this, with shorting 2 & 3, the Hterm gets back whatever is transmitted,
when the pins of max232 are connected from PIC, still returns a 0

@Jayanth

Code
Code:
#if defined(__PCM__)
#include <16F877.h>
#device adc=16
#use delay(clock=20000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,brgh1ok)
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP


void main()
{
int value = 85;
char ch;
char string[64];
puts("**********************************");
puts("  RS232 demo with CCS C compiler  ");
puts("**********************************");
/* start a new line (CR + LF) */
putc('\n');
putc('\r');
/* output variable in decimal format */
printf("Decimal variable output: %d\n\r", value);
/* output variable in hex format */
printf("Hex variable output: %x\n\r", value);
/* echo demo: PIC receives data and sends it back. */
/*            If ENTER key is received, this demo exits. */
puts("Type on the keyboard, PIC will echo back the characters:");
while (1)
{
printf("Decimal variable output: %d\n\r", value);
/* read a single character */
ch = getc();
/* echo back the received character */
putc(ch);
}
}

g_shyam1682
Yes, I do use RS-232 converter and the Port number, Baud Rate are set properly. My OS is Win8 and the RS232-USB adapter was for WinXP, but Win8 properly configured it and shows it in device manager. Looping RX/TX lines proved that the adapter has no issues.

Somehow transmitted from PIC is still 0, Does my hardware have any issues ? are capacitors causing any issues ? V+ & V- voltage readings look okay though, changed MAX232 IC as well but result is the same.
 

Zip and post the project files so that it can be tested.

Another issue which is not related to UART is

Code C - [expand]
1
#device adc=16

should be changed to

Code C - [expand]
1
#device adc=10

 

ch = getc();
could you try assign specific value for ch, Example: ch = 'A';
If 'A' is sent to PC, you try use other function.

- - - Updated - - -
Sorry, I just read your post again, You need check hardware: TX and RX pin. I can't see pin number of your schematic.
 

Okay ! Here are the connection made

PIC to MAX232

Pin 26 (RC7) ---> Pin 12 (R1o)
Pin 25 (RC6) ---> Pin 11 (T1i)

Max232 to DB9 Connector

Pin 14(T1o) ---> Pin 2
Pin 13 (R1i) ---> Pin 3
Gnd ---> Pin 5
 
Last edited:

Hi,

Remove your micro from board and then sort Pin no. 11 and 12 of MAX232 for loop back test.
If it loop back ok, then problem in your code.
but if it is not loop back properly then problem in your MAX232 circuit.

If problem found in MAX232 circuit, replace all capacitor with 1 uF value.

Hope this is help you
Ghanshyam - 07891231301
 

Hi All,

The issue got solved, thanks for the support and debug help provided, it made me think in multiple ways to solve issue.

Problem was in the #fuses directive, I has XT for instead of HS, my Osc is 20MHz. Once I changed this to HS everything started to print out/receive properly on the Hterm.

@g_shyam1682 : Thanks to your idea to eliminate either Hardware or Software issue, on your idea I removed the PIC and shorted pins 25 & 26, everything was working fine with Hterm, so it boiled down to my code which also was fine except for the fuse part.

Regards
Anantha
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top