Hi Matthew,
Good to hear that you've come up with a possible solution.
Just make sure that you don't need a pullup or pulldown, if you connect directly to a triac or optocoupler(led) there shouldn't be any need for it. If you connect to a FET or MOSFET (ic or discrete) you probably will need one.
The Pic will not have any problems with toggling between input and output, it's basically the same as toggling the output buffer, i've done it many times to emulate an open collector output. No problems whatsoever, ever.
I did find a statements in the datasheet that led my mind in the direction that it could be possible to set the pin to input. However, quite often i find that there are small errors in the datasheets, usually in the text. The blockdiagrams that shows the internal configuration of each pin are usually more accurate. Not in this case, it seems, according to that figure it should be impossible to do what you're doing. Keep this in mind if you plan to migrate to another pic(16F627A or 16F628), it's easy to assume that they should behave identical, but there is no guarantee.
Good luck
/Ingvar




Bookmarks