10
COM1, COM2 HANDSHAKE LINES
The RS-232 configuration provides handshake inputs for COM1 and COM2 which may be examined by reading IP4 and IP5 respectively.
Reading a 0 is a + RS-232 input and 1 is a - RS-232 input. AIso in this configuration, OP0 and OP1 control the handshake outputs for
COM1 and COM2 respectively. Normally these are controlled by using the OUTSET and OUTRES commands, but setting bit 5 of MR2A
(for COM1) or MR2B (for COM2) will enable the Request-to Send (RTS) function. When enabled, this function will bring the corresponding
handshake out line to a - RS-232 level one bit time after the characters in the Channel A (or B for COM2) transmit shift register and in the
THR, if any, are completely transmitted including the programmed number of stop bits, if the transmitter is not enabled. To automatically
terminate a string of characters, do the following:
Enable the RTS function
Enable the transmitter
Set handshake out line to + RS-232 level using the OUTSET command
Send string, and immediately after writing last character to THR, disable transmitter
The last character will be sent and the handshake out line will go to a - RS-232 level one bit time afterward.
In the RS-422 configuration OP0 and OP1 are used to enable the transmitters for COM1 and COM2 respectively. Use the OUTRES
command to enable and OUTSET to disable.
Because of the may features of the chip, initialization is a bit more complicated as you can see from the following subroutine.
;
; INIT2681: SET UP COM1 AND COM2 FOR NO PARITY, ONE STOP BIT AND 8 DATA
; AT 9600 BAUD.
;
MR1ADAT EQU 00010011B ; no RTS, Rx int on RxRDY, char mode, no parity, 8 data
MR2ADAT EQU 00000111B ; normal,no TxRTS, no CTS, 1 stop bit
MR1BDAT EQU 00010011B ; no RTS, Rx int on RxRDY, char mode, no parity, 8 data
MR2BDAT EQU 00000111B ; normal,no TxRTS, no CTS, 1 stop bit
INIT2681:
; DO RESET COMMANDS FOR PORTS A AND B. THIS WILL EXECUTE CHANNEL
; A & B's MISCELLANEOUS COMMANDS NUMBERED 101,100,011,010,001.
MOV A,#01010000B ; DO FROM THIS COMMAND, DOWN TO 00010000
CRINIT: MOV P2,#CRA
MOVX @R1,A
MOV P2,#CRB
MOVX @R1,A
ADD A,#-16 ; SUBTRACT 1 FROM UPPER NIBBLE
JNZ CRINIT ; LOOP TILL 0
MOV P2,#MR1A ; SETUP PROTOCOL FOR PORT A
MOV A,#MR1ADAT
MOVX @R1,A
MOV A,#MR2ADAT
MOVX @R1,A
MOV P2,#MR1B ; SETUP PROTOCOL FOR PORT B
MOV A,#MR1BDAT
MOVX @R1,A
MOV A,#MR2BDAT
MOVX @R1,A
; SELECT BAUD RATE
MOV P2,#ACR
MOV A,#80H
MOVX @R1,A ; SELECT SET 2 OF BAUD RATES
MOV P2,#CSRA
MOV A,#10111011B
MOVX @R1,A ; RX AND TX AT 9600 FOR A
MOV P2,#CSRB
MOVX @R1,A ; RX AND TX AT 9600 FOR B
continued on next page....
Содержание MicroPac 535
Страница 22: ...APPENDIX D MicroPac 535 Schematics...
Страница 23: ......
Страница 24: ......
Страница 25: ......
Страница 26: ......