DIRS and I2C

cpedw

Senior Member
Having let the magic smoke out of 2 14M2s, (I suspect an unused output got accidentally attached to 5V or 0V) I thought it would be safer to specify all pins as inputs except for the intended outputs. But I'm using I2C as well. Will the chip work out what to do about the I2C pins even if I've specified every pin one way or the other with DIRS?

Derek
 

kranenborg

Senior Member
I thought it would be safer to specify all pins as inputs except for the intended outputs
Isn't it so that by default all bidirectional pins are inputs, i.e. no explicit action is needed, and thus the cause of the problems must be something else?
/Jurjen
 

inglewoodpete

Senior Member
Have a read of the command descriptions for the I/O commands. Most commands will set the port directions as they require. The biggest exceptions are pinsx (which can be broken down into pin7 : pin6 : pin5 : pin4 : pin3 : pin2 : pin1 : pin0) and outpinsx (which also breaks down to individual pins outpin7 : outpin6 : …. outpin0), which require the pin's direction(s) to set via the dirx command (pin direction can also be set on individual pins).
 

AllyCat

Senior Member
Hi,

Isn't it so that by default all bidirectional pins are inputs, i.e. no explicit action is needed, and thus the cause of the problems must be something else?

Yes, all unused outputs are set as inputs after booting, so playing with the DIRS registers is more likely to cause problems than cure them. Also AFAIK, the I2C mode will ignore any DIRS settings on the related pins - only the "pull-down" FETs should be active to meet the "wired OR" (open collector/drain) for the I2C bus..

The most likely way you might damage a PICaxe is to hard wire a used (Low) output pin directly to a supply of more than about 4 volts. Shorting output pins to each other is unlikely to cause problems (at least with M2s, which deliver only quite modest pull-up FET currents).

Cheers, Alan.
 

cpedw

Senior Member
Thanks for that advice. I didn't find the fault but built a new board and programmed a new 14M2 without any DIRS and caused no damage so far. It isn't doing all that it should yet but fixing that is what a wet and windy day is for.

Derek
 
Top