📄 xq_16io.lst
字号:
A51 MACRO ASSEMBLER XQ_AP66C.LST 11/24/2003 18:38:36 PAGE 1
MACRO ASSEMBLER A51 V6.14
OBJECT MODULE PLACED IN .\Pc16bios.OBJ
ASSEMBLER INVOKED BY: C:\KEIL\C51\BIN\A51.EXE .\Pc16bios.a51 SET(SMALL) DEBUG EP
LOC OBJ LINE SOURCE
1 ;
2 ; Copyright (c) Johnson Electric Industry Mfty. Ltd.
3 ; Filename : PC16Bios.a51
4 ; CPU Type : AT89S8252
5 ; Revision : 1.0
6 ; Date :
7 ; Description : AT89S8252 for 16 input 8 output
8 ; C call assemble subroutine
9 ;----------------------------------------------------------------------------
10 $list
11 ; $nolist
12 ; $nomod51
13 ;-----------------test-------------------------------------------------------
14 $date (010101)
A51 MACRO ASSEMBLER XQ_AP66C.LST 11/24/2003 18:38:36 PAGE 2
15 ; $ep(error.txt) ;better not use it
16 $pr (xq_16IO.lst) ;ok---------must have it
17 $pl (24) ;ok
18 $pw (119) ;ok
19 $nosb
20 $noxref
21 $tt (xq_ap66c.lst) ;ok
22 $cond
23 ; $rb(0,1)
24 $list
25
26 ;----------------------------------------------------------------------------
27 ; $include (\franklin\include\define.inc)
28 ;$include (define.inc)
+1 29 ; define general lable
0001 +1 30 ON set 1
0000 +1 31 OFF set 0
0000 +1 32 RESET set OFF
0001 +1 33 TRUE set ON
0000 +1 34 FALSE set OFF
0001 +1 35 LSB set 1
0000 +1 36 MSB set 0
A51 MACRO ASSEMBLER XQ_AP66C.LST 11/24/2003 18:38:36 PAGE 3
37
38 ;----------------------------------------------------------------------------
39 public init_system,_output_port,_scan_manual
40 public _current_time,_delay,_input_port
41 public _get_outstus,_get_key,_disp_pilot
42 ;----------------------------------------------------------------------------
43 ; Declaration any constant (typeless) numbers here.
00B2 44 MSB_PERIOD set 0b2h ; b1e0h=delay10ms
00E0 45 LSB_PERIOD set 0e0h ; 63c0h=delay20ms
46 ;----------------------------------------------------------------------------
47 ; define data segment for varible
48 data_segment segment data ; declare one data segment
---- 49 rseg data_segment ; select it to be cuttrent segment
50
0000 51 output_buf: ds 1 ; reserve 1 byte space
0001 52 input_stus: ds 1
0002 53 port0_stus: ds 1
0003 54 port2_stus: ds 1
0004 55 port3_stus: ds 1
0005 56 input_buf1: ds 3
0008 57 input_buf2: ds 3 ; software filte for input signal
000B 58 tick_clock: ds 2
A51 MACRO ASSEMBLER XQ_AP66C.LST 11/24/2003 18:38:36 PAGE 4
59 ;----------------------------------------------------------------------------
60 ; BIT SEGMENT: reserves space in BIT RAM (delete segment if not used!)
61 bit_seg_name segment bit ; segment for BIT RAM.
---- 62 rseg bit_seg_name ; switch to this bit segment
0000 63 scan_flag: dbit 1
64 ;----------------------------------------------------------------------------
65 ; cseg at 0 ; absolute Code SEGment AT address 0
66 ; ljmp INIT_SYSTEM ; install RESET location (jump to start)
67 ; code segment start address
68 system_start segment code ; switch to this code segment
---- 69 rseg system_start
70
71
72 using 0 ; state register_bank used
73
0000 758AE0 74 init_system: mov tl0,#LSB_PERIOD
0003 758CB2 75 mov th0,#MSB_PERIOD ; set timer0 interrupt period 10ms for @24MHZ
0006 758BEC 76 mov tl1,#0ech
0009 758DCB 77 mov th1,#0cbh ; set timer1 interrupt period 6.67ms for @24MHZ
000C 758911 78 mov tmod,#00010001b ; select mode 1 16 counter
000F 75A8AA 79 mov ie,#10101010b ; enable globe and timer0&timer1&timer2 interrupt
0012 D28C 80 setb tr0 ; start timer0
A51 MACRO ASSEMBLER XQ_AP66C.LST 11/24/2003 18:38:36 PAGE 5
0014 D28E 81 setb tr1 ; start timer1
0016 7D0A 82 mov r5,#10
0018 120000 F 83 powerondelay: call delay5ms ; software delay 1 second
001B DDFB 84 djnz r5,powerondelay ; for SPI serial programming port
001D 22 85 ret
86 ;----------------------------------------------------------------------------
87 ; PC16I8O input port c call function prototype char _input_port(char c)
88 ;
89
90
91
92
001E C3 93 _input_port: clr c
001F EF 94 mov a,r7
0020 6480 95 xrl a,#080h
0022 9489 96 subb a,#089h
0024 5006 97 jnc in_port1
0026 AE00 F 98 mov r6,port0_stus
0028 8E00 F 99 mov input_stus,r6
002A 8004 100 sjmp in_port2
101
002C AE00 F 102 in_port1: mov r6,port2_stus
A51 MACRO ASSEMBLER XQ_AP66C.LST 11/24/2003 18:38:36 PAGE 6
002E 8E00 F 103 mov input_stus,r6
0030 EF 104 in_port2: mov a,r7
0031 14 105 dec a
0032 B41000 106 cjne a,#010h,in_port3
0035 4003 107 in_port3: jc $ + 5h
0037 020000 F 108 ljmp in_exit
003A 900000 F 109 mov dptr,#stus_vector
003D F8 110 mov r0,a
003E 28 111 add a,r0
003F 28 112 add a,r0
0040 73 113 jmp @a+dptr
114 ;
0041 020000 F 115 stus_vector: ljmp stus_port1
0044 020000 F 116 ljmp stus_port2
0047 020000 F 117 ljmp stus_port3
004A 020000 F 118 ljmp stus_port4
004D 020000 F 119 ljmp stus_port5
0050 020000 F 120 ljmp stus_port6
0053 020000 F 121 ljmp stus_port7
0056 020000 F 122 ljmp stus_port8
0059 020000 F 123 ljmp stus_port9
005C 020000 F 124 ljmp stus_port10
A51 MACRO ASSEMBLER XQ_AP66C.LST 11/24/2003 18:38:36 PAGE 7
005F 020000 F 125 ljmp stus_port11
0062 020000 F 126 ljmp stus_port12
0065 020000 F 127 ljmp stus_port13
0068 020000 F 128 ljmp stus_port14
006B 020000 F 129 ljmp stus_port15
006E 020000 F 130 ljmp stus_port16
131 ;
0071 530001 F 132 stus_port1: anl input_stus,#01H
0074 8049 133 sjmp in_exit
134 ;
0076 530002 F 135 stus_port2: anl input_stus,#02H
0079 8044 136 sjmp in_exit
137 ;
007B 530004 F 138 stus_port3: anl input_stus,#04H
007E 803F 139 sjmp in_exit
140 ;
0080 530008 F 141 stus_port4: anl input_stus,#08H
0083 803A 142 sjmp in_exit
143 ;
0085 530010 F 144 stus_port5: anl input_stus,#010H
0088 8035 145 sjmp in_exit
146 ;
A51 MACRO ASSEMBLER XQ_AP66C.LST 11/24/2003 18:38:36 PAGE 8
008A 530020 F 147 stus_port6: anl input_stus,#020H
008D 8030 148 sjmp in_exit
149 ;
008F 530040 F 150 stus_port7: anl input_stus,#040H
0092 802B 151 sjmp in_exit
152 ;
0094 530080 F 153 stus_port8: anl input_stus,#080H
0097 8026 154 sjmp in_exit
155 ;
0099 530001 F 156 stus_port9: anl input_stus,#01H
009C 8021 157 sjmp in_exit
158 ;
009E 530002 F 159 stus_port10: anl input_stus,#02H
00A1 801C 160 sjmp in_exit
161 ;
00A3 530004 F 162 stus_port11: anl input_stus,#04H
00A6 8017 163 sjmp in_exit
164 ;
00A8 530008 F 165 stus_port12: anl input_stus,#08H
00AB 8012 166 sjmp in_exit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -