Disabling TX on 16F628A?
Timothy J. Weber email (remove spam text)
I'm looking for a sanity check.
I'm working on a project using a 16F628A to drive common-cathode LED
modules, using the simple approach of one pin per segment + one pin per
module, cycling through modules. The symptom is that the decimal point
segments are always lit, on all modules.
I've checked the wiring; the DP segment pins are connected properly to
the PIC's pin 8 = RB2. I can't find any shorts.
In the simulator (SourceBoost's), PORTB.2 is always low, but the pin's
always high on a voltmeter.
I'm using the UART for input to the chip, so I'm suspecting that may be
causing problems, as PORTB.2 is also TX. SPEN is 1 to enable the serial
port, and CREN is 1 to enable continuous receive. But I'm never sending
any bytes, and so TXEN is always 0 (defaults to 0 according to the spec,
never modified by code, always 0 in the simulator). According to the spec:
"Clearing enable bit TXEN during a transmission will cause the
transmission to be aborted and will reset the transmitter. As a result
the RB2/TX/CK pin will revert to high-impedance."
So that seems to confirm that when TXEN is low, RB2 should be available
as an I/O pin. Or does it? In any case, it's certainly
Oh - also TXSTA.SYNC is 0, for asynchronous mode, so RB2 should not be
used as CK for the synchronous clock signal as far as I can tell.
And the usual gotchas: TRISB is 0 for that pin, and there are no A/Ds on
this chip to disable.
I'm going to continue looking for stupid mistakes, but I just wanted to
see if anyone happens to have experience either way - that you can't use
RB2 for I/O when SPEN is 1, or that you can (and I'm just not setting it
Source code, if anyone cares to look at it, is at
Timothy J. Weber http://www.lightlink.com/tjweber
See also: massmind.org/techref/microchip/ios.htm?key=tx