PIC16F73-1/SP Commincation with computer

Thread Starter

pyromanci

Joined Jul 25, 2012
7
Hello all,

I have A LOT of PCB's that were manufactured that just recently went out of business. These PCB's are controlled and interacted with by another. Well I just had one die and only have 2 left as spares. So I'm looking into what can be done short of spending a 10 grand or more to replace them all with a alternative plus the cost to retrain the staff on the new devices.. So I figured it would try to make computer program to interact and control them.

I know the PIC16F73 has both SSP and USRAT modules. The devices them self are daisy chained with a 4 wire phone line with RJ22 (handset jack) ends. So i traced the PCB and at least 2 of the jacks pins are connected to the chips pin 17 and 18 which are the RX/TX Pins.

So I've been trying to cobble up a simple converter cable to take that 4 line cable and make it DB9 cable. I haven't had much luck. So have any of you had to do something similar? If so what would you recommend?

I know once I get it talking to the computer properly I can figure out the data being sent back and forth and make a program that can replace the hardware.
 

JohnInTX

Joined Jun 26, 2012
4,787
What is the circuit when multiple boards connected? If they are bussed (in parallel i.e. all RC6's connected together and all RC7s connected together), then I would suspect it uses some sort of SPI-like clock and data IN setup, a simple way of doing it. Based on my interpretation of your description, that's probably what's going on here.

Using the UART in a true daisy chain would imply that RX of one board would be connected to TX of the previous one. If you don't have 2 RJ22s I wouldn't think that's the way its being done. Using it in a multidrop would require some sort of driver e.g. RS485 but you did not indicate any were there.

If indeed you have just wires going to RX/TX of all the boards with no drivers, I suspect some sort of serial clock/data scheme is being used. You would not be able to plug that into the serial port of a computer to read without some specialized effort.

Have you scoped out the data on the two lines to see what might be going on? What documentation do you have?
 

Markd77

Joined Sep 7, 2009
2,806
If it's the same kind of serial that can talk to a PC serial port (the chip is capable of doing other things that won't interface with a PC as easily) then it almost certainly needs inverting and level changing, for which you need an ST232, MAX232 or similar chip. It's probably a good idea to get a scope on all four wires to see what is happening. If one of the other wires has a clock signal on it then things get trickier.
 

Thread Starter

pyromanci

Joined Jul 25, 2012
7
We do not have a scope, so I have not been able to do that with the lines.

I do know they are running in what I would consider a series-parallel circuit. Each device has 2 of the RJ22 female PCB jacks. The main controller plugins in to Jack 1 on Device 1 and Device 1 Jack 2 plugins in to Device 2 Jack 1, ect. So if 1 device goes offline every device after that one is no longer accessible, but with that being said each device can send data at the same time.

As for documentation, I have none that can help. The only documents for these devices is install and operating instructions. None of which is actually helpful. They just say "connect the cable between the 2 devices and then plugin in the power cord" and "Press they button to set the parameters".

And thank you for the quick replies.
 

JohnInTX

Joined Jun 26, 2012
4,787
Are the two RJ22s connected in parallel with the PIC connected in between or does the data go from one to the the PIC, then from the PIC to the other? I.e. is the PIC in the actual data stream or just attached to it?

For level shifting / PC interface, start looking at someplace like
http://www.bb-elec.com/
Once you figure out what you have, you can buy the appropriate level shifter/interface.

If you can publish a quick sketch of the actual RJ22s-PIC circuitry that would help. My problem so far is that if you are going to plug this into some PC serial port, the PIC would have to use standard asnync. If it uses the UART to do it connected directly to a bus, you will have output contention between all of the PICs on the bus. One way to beat this would be to insert the PIC into the data stream itself in some sort of token-ring affair. Without knowing the circuit better, we are reduced to speculation.
 
Last edited:

JohnInTX

Joined Jun 26, 2012
4,787
The exact pn of the driver did not come up but that's what it is according to the pin names.
Its multi-drop half duplex i.e. more than one PIC can be on the line but only one can talk at a time. How they know is determined by a protocol in firmware.

You'll need one of these or something like it:
http://www.bb-elec.com/product11.asp?sku=485sd9tb
to convert the 2wire RS485 to RS232. The A and B terminals hopefully will match A and B on the board.

To proceed:
Hook A and B to the RS485 bus. Don't forget GND.
Plug into the PC and fire up Hyperterm, Procomm or some terminal emulator. Procomm and others have a raw-data window that you can open to view the data in hex. Your data may not be in ASCII and may display funky.
With all hooked up, measure the volts at the PIC RX line and make sure its a logic 1 (TTL mark condition i.e. no character) If not, try reversing the A/B lines on the dongle. IIRC, A should be a bit higher voltage than B when bus is idle but check the datasheet.
If you have a breakout box, measure the RX/TX lines on the RS-232 side, both should be some (-) voltage (RS232 mark).
Fire it up and look for traffic. You'll have to mess with the baudrate, parity etc. to match the UART params. (For a 4mhz 'F73, I'd look in the 1200-19.2K baud range). Without a scope, that's about all you can do.
If you get it right, you should be able to see some correlation between the bus data and the board activity.

Frontline Test Systems http://forum.allaboutcircuits.com/newreply.php?do=newreply&noquote=1&p=508322 makes some nice but pricy bus analysers. You might be able to find a free one or roll your own as well.

BTW, pin 17 of the PIC goes to 4 on the transciever, not GND. I don't think RE/ is connected to Vcc. If it were, you could not receive anything.. Since there is no wire controlling RE/DE (receive/transmit) look for some connection that sets RE/ low when the TX line is low (send-data control). Plus its more likely that pin 4 of the RJ22 is GND.

Good luck!
 
Last edited:
Top