Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Rs232 receive problem

Status
Not open for further replies.

pixman

Member
HI TO ALL
I AM WORKING ON A PROJECT USING RS232. I HAVE GOT THE TRANSMIT PART WORKING PROPERLY BUT HAVE PROBLEMS WITH RECEIVE. TO TEST IF MY RECEIVE WORKS I SIMPLY RECEIVE THE DATA THE SEND IT BACK WITH THE TRANSMITTER
SAME A NIGELS TUTORIAL 7.7A I AM USING HYPERTERMINAL TO TEST WITH.
TO CHECK IF THE MAX232 IS WORKING I CONNECTED THE RX AND TX WIRES ON THE PIC SIDE AND IT ECHOS THE TEXT BACK.
DOES THIS MEAN THAT IS A PROBLEM ON THE PIC ITSELF.
I AM USING A PIC18F4520

HERE IS THE SERIAL INT I AM USING
SER_INIT
MOVLW d'207' ;9600 baud @ 8 Mhz Fosc -0.16 err SPBRG=207
MOVWF SPBRG
MOVLW b'00100100' ;brgh = 1
MOVWF TXSTA ;enable Async Transmission, set brgh
MOVLW b'10010000'
MOVWF RCSTA ;enable Async Reception
MOVLW B'00001000'
MOVWF BAUDCON

ANY THING ELSE I CAN TEST
 
Last edited:
Did you turn off flow control in HyperTerminal? And are you using a loopback? At the PIC side of the connector connect pins 1, 4, and 6 together, and then pins 7 and 8 together.
 
Tried with flow none and hardware.
As i said ealier connected pins 9 and 10 of max232 together and get loop back.
I think it is something todo with the pic.
 
Sorry, I didn't mean that type of loopback. Tying the suggested pins together is a signal loopback for the PC. And, yes, you want no flow control. Are you sure the MAX232 is wire properly? Is your loopback test done before or after the MAX232?
 
The max232 clearly functions properly. There is a problem with the PIC. It is good that it sends but there is a problem with receiving. Please post your code and use the code setting. Also , all capitals are annoying and hard on the eyes.
 
The following code i use on a PIC18F2520
movlw B'11111111'
movwf TRISC,ACCESS ; Make Port C all inputs
movlw D'12'
movwf SPBRG,ACCESS ; Baud = 9600 for 8Mhz
bsf RCSTA,SPEN,ACCESS ;Enable serial port pins
bsf RCSTA,CREN,ACCESS ;Enable receive
 
I found the problem late last night. I tried a pic16f876a in negels tutorial 7.7a and still no sending of rs232.
the problem was a stupid mistake. I never connected the max232 to GND. Strange how it was still able to send.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top