Page 1
Microcontrollers ApNote AP164601 additional file APX164601.EXE available Port Initialization and Direction Control This Application Note discusses various aspects of the initialization of port pins as outputs: effects of single Bit and Bit Field (BFLDL/H) instructions, ports with bit protection, initialization of alternate output functions, effects of interrupts during port...
Page 2
2.1 Configuration as General Purpose Outputs ..............3 2.2 Configuration of Alternate Output Function ..............5 2.3 Configuration of CAPCOM Pins..................5 3 Initialization of several Port Pins on the same Port ...........5 AP164601 ApNote - Revision History Actual Revision : Rel. 1.0 Previous Revison: Rel. 0.0 Page of...
Page 3
(pipeline effect, see also following examples, and section ’Particular Pipeline Effects’ in respective User’s Manual, e.g. C167 Derivatives User’s Manual, V2.0, p. 4-7). Semiconductor Group 3 of 7 AP164601 1998-02...
Page 4
; or other instruction which does not access P1 This procedure is also recommended when a port pin is used in a bidirectional manner, i.e. when its direction is dynamically changed from input to output. Semiconductor Group 4 of 7 AP164601 1998-02...
Page 5
P3.10 shall be used as transmit data output TxD0, this could be done with the following instruction sequence: BFLDH P3,#24h,#24h ; set P3.13/WR#/SCLK and P3.10/TxD0 to '1' BFLDH DP3,#24h,#24h ; switch direction to output ; or other instruction which does not access P3 Semiconductor Group 5 of 7 AP164601 1998-02...
Page 6
; or other instruction which does not access P3 BFLDL P3,#0Ah,#0Ah ; set P3.1/T6OUT and P3.3/T3OUT to ’1’ BFLDL DP3,#0Ah,#0Ah ; switch P3.1 and P3.3 to output ; or other instruction which does not access P3 Semiconductor Group 6 of 7 AP164601 1998-02...
Page 7
16-bit wide ports, while on other C166 microcontrollers, these ports are implemented as two 8-bit wide ports each, like most other I/O ports For ports with bit protection (Port 2, 7, 8), these types of problems will not occur. Semiconductor Group 7 of 7 AP164601 1998-02...