; ********************************************************************** ; FILE: XR80C320.H. ; Copyright 1996 Arnd Kobus ; Headerdatei mit allen Definitionen der Paulmon Routinen. Am Ende ; werden noch ein Paar Voreinstellungen getroffen (Programmcode ; in der Header Datei). Zuerst zusaetzliche SFR des 80C320. ; ********************************************************************** .equ DPS, 0x86 ; Data Pointer select .equ DPL1, 0x84 ; DPTR1 low .equ DPH1, 0x85 ; DPTR1 high ; .equ CKCON, 0x8E ; Clock Control .flag MD0, B.0 ; Mode flag for RAM access .flag MD1, B.1 ; Mode flag for RAM access .flag MD2, B.2 ; Mode flag for RAM access .flag T0M, B.3 ; Timer 0 mode .flag T1M, B.4 ; Timer 1 mode .flag T2M, B.5 ; Timer 2 mode .flag WD0, B.6 ; Watchdog timing Bit 0 .flag WD1, B.7 ; Watchdog timing Bit 1 ; .equ EXIF, 0x91 .flag BGS, B.0 ; Band gap reference enable during stop mode .flag RGSL, B.1 ; Ring select. Come out of stop mode with ring osc. .flag RGMD, B.2 ; Ring mode flag set by hardware ; EXIF.3 reserved .flag IE2, B.4 ; interrupt 2 edge flag .flag IE3, B.5 ; interrupt 3 edge flag .flag IE4, B.6 ; interrupt 4 edge flag .flag IE5, B.7 ; interrupt 5 edge flag ; .equ SCON0, 0x98 ; Serial Control 0 .flag RI_0, SCON0.0 ; Rx interrupt flag .flag TI_0, SCON0.1 ; Tx interrupt flag .flag RB8_0, SCON0.2 ; 9-th bit rx/stop bit value .flag TB8_0, SCON0.3 ; in modes 2 \& 3 9-th bit tx .flag REN_0, SCON0.4 ; enable reception .flag SM2_0, SCON0.5 ; enable multiprocessorfeature .flag SM1_0, SCON0.6 ; serial port 0 mode .flag SM0_0, SCON0.7 ; serial port 0 mode ; .equ SCON1, 0xC0 ; Serial Control 1 .flag RI_1, SCON1.0 ; Rx interrupt flag .flag TI_1, SCON1.1 ; Tx interrupt flag .flag RB8_1, SCON1.2 ; 9-th bit rx/stop bit value .flag TB8_1, SCON1.3 ; in modes 2 \& 3 9-th bit tx .flag REN_1, SCON1.4 ; enable reception .flag SM2_1, SCON1.5 ; enable multiprocessorfeature .flag SM1_1, SCON1.6 ; serial port 1 mode .flag SM0_1, SCON1.7 ; serial port 1 mode ; .equ SBUF1, 0xC1 ; Serial Data Buffer .equ TA, 0xC7 ; Timed access register ; .equ WDCON, 0xD8 ; Watch dog control .flag RWT, WDCON.0 ; Restart (clear) Watchdog .flag EWT, WDCON.1 ; Enable watchdog timer .flag WTRF, WDCON.2 ; Reset has occured .flag WDIF, WDCON.3 ; Interrupt flag .flag PFI, WDCON.4 ; Power fail interrupt .flag EPFI, WDCON.5 ; Power fail interrupt enable .flag POR, WDCON.6 .flag SMOD_1, WDCON.7 ; .equ EIE, 0xE8 ; Extended Interrupt Enable .flag EX2, EIE.0 ; enable external interrupt 2 .flag EX3, EIE.1 ; enable external interrupt 3 .flag EX4, EIE.2 ; enable external interrupt 4 .flag EX5, EIE.3 ; enable external interrupt 5 .flag EWDI, EIE.4 ; Enable Watch dog interrupt ; .equ EIP, 0xF8 ; Extended Interrupt Priority .flag PX2, EIP.0 ; Priority of external interrupt 2 .flag PX3, EIP.1 ; Priority of external interrupt 3 .flag PX4, EIP.2 ; Priority of external interrupt 4 .flag PX5, EIP.3 ; Priority of external interrupt 5 .flag PWDI, EIP.4 ; Priority of Watch dog interrupt ; ********************************************************************** ; Zusatzhardware ; ********************************************************************** .equ Mod8255, 0x4003 ; 8255 Steuerregister .equ PortA, 0x4000 ; Port A des 8255 .equ PortB, 0x4001 ; ... .equ PortC, 0x4002 ; ********************************************************************** ; Paulmon Einsprungadressen und Definition des Interrupt mapping. ; ********************************************************************** .EQU cout, 0x006B ; Basic character output. Waits for ; the UART's transmitter to be ; available and then sends the ; character in Acc. .EQU cin, 0x006D ; Basic character input. Simply ; waits for a byte and returns it in ; Acc. .EQU phex, 0x006F ; Prints the value in Acc as a ; two-digit hexadecimal number. ; Acc is not changed. .EQU phex16, 0x0071 ; Prints the value of DPTR as a four-digit ; hexadecimal number. .EQU PBin, 0x0073 ; Print Value in Acc as binary number .EQU pstr, 0x0075 ; Prints a string located within code memory. ; DPTR must be loaded with the beginning ; address of the string before calling PSTR. ; Strings may be larger than 256 bytes. The ; string may be terminated with a 0 (which ; would not be transmitted). The string may ; also be terminated by setting the most ; significant bit of the last character. In this ; latter case, the last character is transmitted ; with it's most sig bit cleared. .EQU ghex, 0x0077 ; Gets a two-digit hexidecimal input, which ; is returned in Acc. If ESC is pressed, Carry ; is set, Carry is clear otherwise. If return is ; pressed with no input, PSW.5 is set, PSW.5 ; is clear otherwise. R2 and R3 are altered. .EQU ghex16, 0x0079 ; Gets a four-digit hexidecimal input, which is ; returned in DPTR. If ESC is pressed, Carry ; is set, Carry is clear otherwise. If return is ; pressed with no input, PSW.5 is set, PSW.5 ; is clear otherwise. R2, R3, R4 and Acc are ; altered. .EQU esc, 0x007B ; checks to see if is waiting on serial ; port. C=clear if no , C=set if ; pressed, buffer flushed .EQU upper, 0x007D ; Changes the value of Acc to uppercase if Acc ; contains a lowercase letter. If Acc contains ; an uppercase letter, digit, symbol or other ; non-ascii byte, the value of Acc is not ; altered. .EQU space, 0x007F ; Send a space .EQU asc2hex, 0x0081 ; Converts an ascii value ('0' to '9', 'A' to 'F') ; into a number (0 to 15). Carry is set if Acc ; contained an invalid character. Lowercase ; letters ('a' to 'f') are considered invalid, so a ; call to UPPER should be made if the character ; might be lowercase. .EQU NEWLINE, 0x0083 ; Carriage return .EQU init, 0x0085 ; Auto Baudrate detection .EQU Register, 0x0087 ; Register ausgeben .EQU usTime, 0x0089 ; Short Time delay DPTR * 10 microseconds .EQU mstime, 0x008B ; Time Delay DPTR milliseconds (Dallas 80C320 - 24) .EQU intRAM, 0x008D ; Show internal RAM .EQU ADD16, 0x0090 ; Addiert 16 Bit Zahl @R1 zu 16 Bit Zahl @R0. ; Ergebnis = @R0 + @R1 .EQU SUB16, 0x0093 ; Subtrhiert 16 Bit Zahl @R1 von 16 Bit Zahl @R0 ; Ergebnis = @R0 - @R1 .EQU ABS16, 0x0096 ; Bildet Betrag der 16 Bit Zahl @R0 .EQU NEG16, 0x0099 ; Negiert 16 Bit Zahl an Stelle @R0. @R0 = - @R0 .EQU Abstand16, 0x009C ; Bildet Betrag der Differenz der Zahlen an den ; Stellen @(R0+R2) und @(R1+R2) (Offset). Carry ist ; gesetzt, wenn @(R1+R2) > @(R0+R2) war. ; Ergebnis = | @(R0+R2) - @(R1+R2) | .EQU MUL16, 0x009F ; Multipliziert 16 Bit Zahl @R0 mit 16 Bit Zahl @R1. ; Das 32 Bit Ergebnis ; R0 und R1 werden um 1 erhoeht. .EQU DIV16, 0x00A2 ; Dividiert 32 Bit Zahl @R0 vorzeichenlos durch ; 16 Bit Divisor @R1. Der 16 Bit Quotient ist ; Ergebnis = @R0/@R1. In R0 wird ausserdem ein Zeiger ; auf das Ergebnis und in R1 auf den Divisionsrest ; zurueckgegeben. Der Quotient muss <65536 sein. .EQU interrupt, 0xF300 ; Addresses for interrupt mapping ; ********************************************************************** ; Programmcode fuer Initialisierung ; ********************************************************************** ; ; ********************************************************************** .org start ; Programmstart mov dptr, #Mod8255 ; Adresse laden mov a, #10001001b ; Ports A und B als Ausg„nge, C Eingang movx @dptr, a ; 8255 Steuerregister schreiben ; ********************************************************************** ; end of file ; **********************************************************************