In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Peter Van der Zee wrote: Hi Bebop; You don't have it quite right. A pin can be made to be an input, or an output; at power-up and on RESET all pins default to input type. When its an input, the external circuitry connected to the pin determines the Hi or LO level. A pin is made an output by changing the pin's TRIS (direction) value. A TRIS value of 1 (this is the default value) means an input, and making the pin's TRIS value 0 makes it an output. To access this TRIS register you must first set the MODE register to $0F (this is also the default mode value on power-up and RESET), to be able to write to the port TRIS register. The MODE register must contain various values, one each for configuring the pin pull-up resistors, switching levels, etc. When its an output, it can have a HI (5V) or LO (0V) output level. This level is stored in the port output register; this is NOT the same as the TRIS register. I believe the content of the output register (not the pin; THAT becomes an input) at power-up is indeterminate, and on RESET it is "no change" from the levels prior to the RESET. So after configuration, any pins made to be outputs will show the value already in it's corresponding output register bit. Hence on power-up its important to set the port output register to the desired levels prior to making them outputs. Hope this helps. Cheers, Peter (pjv) ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=107816#m107973 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)