Download Print this page

Siemens AP164601 Manual page 5

Microcontrollers

Advertisement

2.2
Configuration of Alternate Output Function
In order to use an alternate output function of a Port 3 pin, its direction must be set to
output AND the corresponding port data register bit must contain a '1'. Otherwise, the
alternate output function is not enabled and the pin will be stuck at '0' (see figure of Port 3
pins in chapter 'Parallel Ports' in respective User's Manual, e.g. C167 Derivatives User's
Manual, V2.0, p.
function of P3.13 on 8xC166 microcontrollers or SSC shift clock output on most other
C166 microcontrollers could be performed as follows:
BSET P3.13
; enable WR#/SCLK as alternate output function of P3.13,
; initial level is inactive high
BSET DP3.13
; set direction to output
NOP
; or other instruction which does not access P3
Note that when a port data register still contains its reset value 0000h, and the direction of
a pin is set to output before the corresponding bit in the port data register is set to '1', a
low level will appear at the pin. For P3.13/WR# of 8xC166 microcontrollers in particular,
this low level will be regarded as write strobe by external memory devices, and
unexpected results may occur.
2.3
Configuration of CAPCOM Pins
When a Port 2 pin is to be used as compare signal output (alternate function) for the
CAPCOM unit of 8xC166 microcontrollers (respectively Port 7 and Port 8 for CAPCOM2
unit on other C166 microcontrollers), it is not required to write a '1' into the corresponding
bit of the port data register. It is only required to set the direction to output.
3
Initialization of several Port Pins on the same Port
When several port pins are to be configured as outputs on the same port, the port data
register should be programmed before the direction of the selected port pin is set to
output. This is preferably done using MOV or Bit Field instructions.
When for example the alternate function of P3.13 shall be used (WR# function on 8xC166
microcontrollers, SSC shift clock output SCLK on most other C166 microcontrollers), and
P3.10 shall be used as transmit data output TxD0, this could be done with the following
instruction sequence:
BFLDH P3,#24h,#24h
BFLDH DP3,#24h,#24h
NOP
Semiconductor Group
). Configuration of the WR# signal which is an alternate output
6-18
; set P3.13/WR#/SCLK and P3.10/TxD0 to '1'
; switch direction to output
; or other instruction which does not access P3
5 of 7
Port Initialization
and Direction Control
AP164601 1998-02

Advertisement

loading