PDA

View Full Version : PIC to PC not working



The Master
- 28th October 2007, 21:05
Hi. Ive got a pic chip which outputs serial to a PC. My app in VB isnt getting any input at all. Ive tried hyper terminal and i do get an input but its not reliable.

I have a 100K resistor going from the serial pin to ground (also tried without this). Is there anything else im supposed to do on my circuit for this to work? I have another chip which uses the serial output from the same port and that is accepting commands fine.

This one is slightly more important than my last thread so i would apreciate a quick response. Let me know if you need any more info

The Master
- 29th October 2007, 09:42
I have also tried disconnecting from the serial port completely and linking the output into the input. The second chip receives all the commands from the first chip fine. It seems this is only a problem when sending to a PC

mackrackit
- 29th October 2007, 22:28
Well, being that you are using...OH WAIT...What chip are you using?
And what pin... And what about code?

I have lots of solutions to your problem:)

Who said this:
"That which seems simple is often overlooked" (Usually by me)
:D

The Master
- 29th October 2007, 23:22
Righty then. The code is perfect (im sure). the chip is a PIC16F84A.

Ive found some settings in the VB comm control and data is now getting in. Its not completely reliable. This circuit is part of the circuit i have other threads about. Im just about to rip the whole thing out of the breadboard and start the whole thing again. I will be testing after almost every new wire to be sure its all done properly.

Ill post back when i start getting more problems (when, not if ;)) lol

DynamoBen
- 30th October 2007, 04:36
The second chip receives all the commands from the first chip fine.

The serial output/input on a pic is TTL so you will have perfect communication in this type of setup. However a PC is RS-232 which is a 12V inverted communications signal. Normally you would use a MAX232 or MAX233 transceiver to convert the serial TTL I/O from the pic to RS-232. A lesser expensive option is to use a few transistors, a quick forum or web search should come up with a schematic.

However the "quick and dirty" way is by placing a 22K resistor in series with the TX pin on the PC side to the RX pin on the pic side. You need to also tie the PC serial ports GND to common on the pic side. (see "DEBUGIN" command in the PicBasic Pro manual for a schematic) BTW the Pic won't be able to transmit back to the PC with this method. To do that see the "DEBUG" command in the manual.


I have a 100K resistor going from the serial pin to ground (also tried without this).

I'm not sure that I follow what you mean here, see the above "quick and dirty" way.

The Master
- 30th October 2007, 05:34
Hi, thanx for your suggestions. This seems to be working perfect now too. For PC to PIC i have a 33K resistor between the serial port and the chip. For PIC to PC i just have the wire going from the chip into the serial port. Nothing else is connected.

I think my biggest problem was the settings for VB's comm control. I did notice that i got a lot of randomness if i touch the serial wires but that isnt affecting anything at the moment.

For now its all good :D. Finally! lol