Serin with 08,14,20 input only pins

matchbox

Senior Member
I was going to use pinC.3 on a 08M2 and pinC.6 on a 20M2 for serial comms. But then noticed the Picaxe manual 2, page 207, states that pinC.3 on the 08 and 14 and pinC.6 on the 20, need a diode to tie the pin to 5volts for serial input. I have always thought these input only pins are good for nothing!
Can anyone explain what the diode does exactly? And what would happen if the diode was not used?
 

AllyCat

Senior Member
Hi,

That pin (Leg 4) is the Programming pin, when used with an external programmer. To use that Programming mode, the pin to taken to about +8 volts, so it cannot have the normal "electrostatic protection" diode to the Vdd (supply) rail. Theoretically, taking the pin above 5 volts could cause the Program (EEPROM) to become corrupted, but in practice the (re-)programming sequence is complex and unlikely to happen by accident.

Strictly, if this pin is used as a serial input from "TTL" levels, then adding a diode would not be necessary. But PICaxe is intended (to have the capability) to connect directly to "COM port RS232" voltage levels (possibly up to +/- 15 volts) via the 10k+22k programming resistor network. That network only works (with RS232 levels) if there is a diode from the input pin to the Vdd rail. Otherwise, a "high" RS232 level might destroy the chip (absolute max 9 volts rating on that pin).

Yes, I also considered it to be a rather "useless" pin, but it can be the "Timer1 Gate" hardware input (which can be useful) or used as a high impedance output by enabling its Weak Pullup resistor (PULLUP %xxxx , or I prefer POKESFR $8C,8). ;)

Cheers, Alan.
 

matchbox

Senior Member
Strictly, if this pin is used as a serial input from "TTL" levels, then adding a diode would not be necessary.
Thanks Alan, that was the info i was after. And that tells me alot about those pins.
The serial lead connection between the picaxes is very short(a track in fact); so i assume electrostatic charge build-up on that input isn't very likely.
 

Goeytex

Senior Member
I use the input only pins all the time as general inputs and for serial input with serial comms. The diode is only really needed with serial comms having RS232 voltage levels. With TTL levels (Picaxe to Picaxe) it should not be necessary. However, adding the diode and a series resistor is good insurance against possible but unlikely flaky behavior.
 

westaust55

Moderator
Pin C.3 on the 08M2 and 14M2 nor C.6 on a 20M2 is not associated with the PICAXE BASIC programming (Serial In) pin.
This pin is used in the native PIC chip (but not in PICAXE mode as the MasterClear and/or Programming Voltage (Vpp) funcitons) where it can be used for In Circuit serial Programming and then it is for a programaming pulse (typically ~9 volts) and not the actual programming data line.

As mentioned there is no internal ESD diode on the pin and recommendation relates primarily to use with an RS-232 comms link where signals may swing between as much as maximum of -25 volts and +25 volts albeit the typical values can be significantly less.
 
Last edited:

erco

Senior Member
Great info in this thread, thanks all. I typically use those "input only" pins to connect an IR receiver module which always works fine, even without the pullup and capacitor(s) usually shown in schematics.
 
Top