Changes
8255
,/* PPI Port B */
==== Note:====
1. On CPC464,CPC664,CPC6128 and GX4000 this is LK3 on the PCB. On the CPC464+ and CPC6128+ this is LK103 on the PCB. On the KC compact this is "1".
Table showing manufacturer name on power-up (CPC and CPC+ only):
== Programming Examples ==
1. Using the control byte
* Setting bit 7 of port C to 1,
LD B,&F7 ;8255 Control port
LD A,%00001111 ;Bit Set/reset function
OUT (C),A ;Send it to 8255
RET
* Set port A to input, operating in mode 0, port B to output, operating in mode 0 and port C to input, operating in mode 0.
LD B,&F7 ;8255 Control port
LD A,%10011001 ;Configuration function
OUT (C),A ;Send it to 8255
RET
2. Using port A/B/C,
In this example, port A is set to output, port B is set to input, and port C is set to output, and they are all operating in mode 0.
We will only be using port A for these examples.
* Reading from port A,
;Set port A to input
LD B,&F7 ;8255 Control port
LD A,%10010010 ;Configuration function
OUT (C),A ;Send to 8255
LD B,&F4 ;Port A port address
IN E,(C) ;Get byte from port
;Register E holds value from port
;Return port I/O status and operating modes
;to previous settings.
LD B,&F7 ;8255 Control port
LD A,%10000010 ;Configuration function
OUT (C),A ;Send to 8255
RET
* Writing to port A,
;Set port A to output
;(Note the next few lines are not necessary
;as port A is already acting as output, however
;it is given here just to make the example
;more understandable)
LD B,&F7 ;8255 Control port
LD A,%10000010 ;Configuration function
OUT (C),A ;Send to 8255
LD B,&F4 ;port A port address
;Register E holds value to put into port
LD E,&FF ;Data to put into port
OUT (C),A ;Send to port A
;Return port I/O status and operating modes
;to previous settings.
LD B,&F7 ;8255 Control port
LD A,%10000010 ;Configuration function
OUT (C),A
RET
[Image:8255 ppi 1.jpg]]