Programming Example - Intel 8XC196NT User Manual

Table of Contents

Advertisement

8.7

PROGRAMMING EXAMPLE

This code example configures SSIO0 as a master transmitter to send one byte of data to SSIO1,
the slave receiver. First it sets up a window to allow direct access to the necessary registers. Next,
it configures the clock and data pins. Since SSIO0 is sending data, SC0 (P6.4) and SD0 (P6.5) are
configured as special-function complementary outputs. Since SSIO1 is receiving data, SC1
(P6.6) and SD1 (P6.7) are configured as special-function inputs. The example also sets up a reg-
ister (result) to store the received data byte.
wsr
equ
014h:byte
p6_dir
equ
0d3h:byte
p6_mode
equ
0d1h:byte
p6_reg
equ
0d5h:byte
ssio_baud equ
0b4h:byte
ssio0_con equ
0b1h:byte
ssio1_con equ
0b3h:byte
ssio0_buf equ
0b0h:byte
ssio1_buf equ
0b2h:byte
result
equ
122h:byte
cseg at 0ff2080h
ldb
wsr,#1fh
ldb
p6_dir,#0c0h
ldb
p6_mode,#0f0h
ldb
p6_reg,#0c0h
ldb
ssio_baud,#80h
ldb
ssio0_con,#0c9h
ldb
ssio1_con,#08h
ldb
ssio0_buf,#55h
d_wait:
jbc
ssio1_con,0,d_wait
stb
ssio1_buf,result
sjmp $
end
SYNCHRONOUS SERIAL I/O (SSIO) PORT
;window to 1fd3h
;window to 1fd1h
;window to 1fd5h
;window to 1fb4h
;window to 1fb1h
;window to 1fb3h
;window to 1fb0h
;window to 1fb2h
;register to store the received data byte
;select window 1fh
;set up SD1/SC1 as inputs and
;set up SD0/SC0 as complementary outputs
;set up SD1/SC1, SD0/SC0 as special-function
;set up SD1/SC1 inputs (1), SD0/SC0 outputs (0)
;enable baud-rate generator at 2 MHz
;set up channel 0 as master transmitter
;set up channel 1 as slave receiver
;transmit data 55h
;wait for data to be received
;store received data in "result"
8-15

Advertisement

Table of Contents
loading

Table of Contents