Transistor Logic inverting PIC UART input??

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
Post Reply
cdenk
Posts: 74
Joined: Thu Aug 15, 2002 1:01 am
Location: Lagrange, Oh.
Contact:

Transistor Logic inverting PIC UART input??

Post by cdenk » Tue Oct 31, 2006 1:07 pm

I have a 18F1320 where the UART works goes to TTL fiber optic transmitter (Optek OPF1412T) and Receiver (Optek OPF 2412). Using a 74LS00 Nand gate on the receiver with a 560 ohm pullup on the one NAND input and other tied to 5 volt, everything works fine at 9600 baud. Prefer using transistor inverter. First tried (NPN) 2N2222A with :5 volt > 1K ohm > collector, Emitter > ground, and signal (from OPF 2412) > 4.7k ohm > Base. With Pic online, no joy, but remove the PIC and jumper TX > RX, OK. As I understand the 1320 (with schmidt) low level needs to be 0.2 volt or less, and I was getting 0.3 volt. Then tried (PNP) 2N3906 with : 5 volt > Emitter, Ground > 1K ohm to collector, and signal > 4.7K > base. Now the low is getting to 0.00 volts. Tried a 0.01 mfd capacitor between 5 volt and ground. The Tx > Rx jumper thing still works, but the 1320 should receive one of several characters and respond with a string or a character, which isn't happening.

I also have a MAX232 on the circuit, the transmitter (from the 1320) always active, but a jumper to select either the RS-232 or fiber receiver so as not to drive the RX pin from 2 sources. The copper serial is OK.

The board is a PICPROTO18, the fiber optic goes to a 6' Tyco jumper cable (with loopback works fine) to a B&B FOSTC serial (either RS-232, Rs-485, but now RS-232) to fiber optic converter to a PC.

Assuming I have some sort of timing issue with rise fall times, but I don't have a O-scope to troubleshoot. :)

wd5gnr
Posts: 104
Joined: Wed Dec 19, 2001 1:01 am
Contact:

Post by wd5gnr » Tue Oct 31, 2006 3:53 pm

Why a 4.7K resistor in the base?

Assume you have 5V on the base resistor on one side and .7V clamped from the BE junction on the other side. That's 4.3V.

4.3/4700 = 915uA

Drive that transistor into saturation!

A 470 ohm resistor, for example would give you around 10mA.

Robert Reed
Posts: 2276
Joined: Wed Nov 24, 2004 1:01 am
Location: ASHTABULA,OHIO
Contact:

Post by Robert Reed » Tue Oct 31, 2006 5:12 pm

With a 1K load and a 4.7K base resistor and assuming a very modest Hfe of 50, its already 10 times into saturation.

Ron H
Posts: 360
Joined: Tue Dec 18, 2001 1:01 am
Location: Boise, ID
Contact:

Post by Ron H » Tue Oct 31, 2006 6:56 pm

OPF2412 is has an open collector output. If you want to use the PNP, all you should need to do is add a 1.5k resistor from the base of the PNP to +5V in the circuit you described. I would have expected for the circuit you described to work at low data rates, but it needs the added resistor to turn the transistor off more rapidly. Otherwise, the base floats when the 2412 output goes off. This is a very slow way to turn off a BJT.
If you want to use an NPN inverter, then at minimum, you need to connect your 4.7k resistor from the output of the 2412 to +5V, and the base of your transistor directly to the output. The 2412 output has a Schottky transistor (Google), so the saturation voltage is a little higher than a normal bipolar, but should still be OK, especially with only 1mA of collector current.
Are you running at 9600 baud?

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests