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 (MAX232) communication PIC16f876a problem USART

Status
Not open for further replies.

RedEyz

New Member
i dont get any result on my hyperterminal

im using 1uF at the place where its 10uF
 

Attachments

  • LCDdrive..h
    655 bytes · Views: 328
  • rs232..c
    905 bytes · Views: 298
  • usart..h
    802 bytes · Views: 308
  • usart..c
    440 bytes · Views: 273
  • LCDdrive..c
    6.8 KB · Views: 402
  • circuit_232..jpg
    circuit_232..jpg
    23.8 KB · Views: 4,701
Last edited:
Your init_comms routine look a bit dodgy, RC5 and RC7 both set to input? One of them has to be an output, the TX is the output.
The 10uF I use a 0.1uF, it is just a de-coupling cap.

I would double check your SPBRG Setting also.

Wilksey
 
You only need 2,3 and 5 connected for the MAX chip to work, the flow controls are not needed.

But they, like the TTL part of the MAX232 need to be on the right pin.

And the code needs changing, there are 2 inputs declared, one needs to be set to output.
 
It hurts nothing to make a couple more solder joints and Hyperterminal might still be trying to use them. I have a cable without those connections and it refused to work until I did those loopbacks. It's irrelevant whether he declared the pins as inputs or outputs, the USART automatically changes them to what's appropriate.
 
It's irrelevant whether he declared the pins as inputs or outputs, the USART automatically changes them to what's appropriate.

Not according to the data sheet,
Bit SPEN (RCSTA<7>) and bits TRISC<7:6> have to be
set in order to configure pins RC6/TX/CK and RC7/RX/DT
as the Universal Synchronous Asynchronous Receiver
Transmitter.

I haven't tried it on an 876 but have on an 886 and they have to be set or it wont work.

Mike.
 
I only had the 886 datasheet handy:
Setting the SPEN bit of the
RCSTA register enables the EUSART and automatically
configures the TX/CK I/O pin as an output.
Setting the SPEN bit of the RCSTA
register enables the EUSART and automatically configures
the RX/DT I/O pin as an input.
 
Last edited:
Wow, it's the other way around. Didn't know that the later chips did it automatically. Good catch. I'll remember that in future.

However, in the OP's case they need to be input.

Mike.
 
I coulda sworn it was like this on all the chips I had been using, but to be honest I've been out of things for a few years. You say you couldn't get it to work on the 886 without setting the TRIS? Hmm. I don't have my own code available right now, but I downloaded Tiny Bootloader, which I do use, and for the F88 and F886 it doesn't bother with setting TRIS.
 
Last edited:
I can't remember how long ago it was that I discovered that the 2 pins had to be input but it obviously wasn't the 886. It may have been the F88 as I used to use that as my default chip. The fact that Tiny Bootloader doesn't set TRIS is irrelevant as they default to input.

Mike.
 
I suppose it depends on the configuration at the cable end, but when I develop on the 232 I just dont use flow control unless I really have to.

I have always set the TRIS pins in HITECH and C18, you may be right, it might not be needed, I always set them though, that way I know that isn't the issue.

I use the loopback when connecting to a modem as it does the handshaking.
 
Pommie said:
The fact that Tiny Bootloader doesn't set TRIS is irrelevant as they default to input.
Yeah, but the TX pin has to be output, no?

Wilksey said:
I always set them though, that way I know that isn't the issue.

That's the same reason I use the loopbacks on the serial connector. :D
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top