Power Up/de
== (**COPIED FROM ENGLISH PAGE**) ==At power up all ports are in Tri-state and can serve as input pins.
When you want to use the ports (pins) as output, you must set the data direction first with the statement : CONFIG PORTB = OUTPUT
Individual bits can also be set to be used as input or output.
For example : DDRB = &B00001111 , will set a value of 15 to the data direction register of PORTB.
PORTB.0 to PORTB.3 (the lower 4 bits) can be used as outputs because they are set high. The upper four bits (PORTB.4 to PORTB.7), can be used for input because they are set low.
You can also set the direction of a port pin with the statement :
CONFIG PINB.0 = OUTPUT | INPUT
The internal RAM is cleared at power up or when a reset occurs. Use $NORAMCLEAR to disable this feature.
You may use $INITMICRO to set a port level and direction immediately on startup.
Languages | English • Deutsch |
---|