aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJan Sucan <sucanjan@fit.cvut.cz>2019-09-22 21:15:03 +0200
committerJan Sucan <sucanjan@fit.cvut.cz>2019-09-22 21:15:03 +0200
commitebf46497e114643b9d4d49dc9ef7d7ac52d89843 (patch)
tree5f67dd525af231deebbb013596a81f0a63ddc1a9 /tests
Initial commit
Diffstat (limited to 'tests')
-rw-r--r--tests/pins.asm228
-rw-r--r--tests/pins.hex17
-rw-r--r--tests/pins.lst422
-rw-r--r--tests/pwm.asm194
-rw-r--r--tests/pwm.hex14
-rw-r--r--tests/pwm.lst370
6 files changed, 1245 insertions, 0 deletions
diff --git a/tests/pins.asm b/tests/pins.asm
new file mode 100644
index 0000000..79f2384
--- /dev/null
+++ b/tests/pins.asm
@@ -0,0 +1,228 @@
+; Firmware pre testovanie kontaktov patice AT89Cx051 zariadenia pre
+; programovanie mikrokontrolerov AT89Cx051 seriovym ISP programatorom
+
+; Verzia 1.0
+
+; Copyright (C) 2012 Jan Sucan <sucan@runbox.com>
+
+; Permission is hereby granted, free of charge, to any person obtaining
+; a copy of this software and associated documentation files (the
+; "Software"), to deal in the Software without restriction, including
+; without limitation the rights to use, copy, modify, merge, publish,
+; distribute, sublicense, and/or sell copies of the Software, and to
+; permit persons to whom the Software is furnished to do so, subject to
+; the following conditions:
+
+; The above copyright notice and this permission notice shall be
+; included in all copies or substantial portions of the Software.
+
+; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+; IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+; CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+; ------------------------------------------------------------------------------
+; hardware
+; ------------------------------------------------------------------------------
+grnled equ p0.1 ; zelena LED
+redled equ p0.0 ; cervena LED
+button equ p1.0 ; ovladacie tlacidlo
+
+rdy equ p0.2 ; signaly pre AT89Cx051
+xtal equ p0.3
+prog equ p0.4
+m0 equ p0.5
+m1 equ p0.6
+m2 equ p0.7
+pdata equ p2
+rstsw equ p3.5 ; spinanie RST napatia
+vccsw equ p3.6 ; spinanie napajacieho napatia
+
+; ------------------------------------------------------------------------------
+; konstanty a premenne
+; ------------------------------------------------------------------------------
+dtctlim equ 500 ; hranicny pocet dobrych stavov pre vyhodnotenie
+ ; stlacenia alebo uvolnenia tlacidla
+
+; konstanty casovacov pri taktovacej frekvencii 24 MHz v jednotkach 0,5 us
+period equ 530 ; perioda PWM signalu
+volt equ 18 ; aktivna polperioda PWM signalu (pre 5 V)
+ ; odmeranie casu 0,5 ms
+halfmsl equ low (0ffffh - 1000)
+halfmsh equ high (0ffffh - 1000)
+
+; ------------------------------------------------------------------------------
+; kod programu
+; ------------------------------------------------------------------------------
+ cseg
+
+ org 00h
+ ajmp main ; hlavny program
+
+ org 0bh
+ ajmp rstpwm ; obsluha casovaca PWM generatoru
+
+; ------------------------------------------------------------------------------
+; hlavny program
+; ------------------------------------------------------------------------------
+main: setb grnled ; zhasni obe LED
+ setb redled
+
+ mov tmod,#00010001b ; dva 16 bitove casovace
+
+ setb ea ; povol vsetky prerusenia
+
+loop: setb redled ; 1. stav testovania
+ clr grnled
+
+ setb vccsw
+ mov a,#01010101b
+ acall putbyte
+ clr m2
+ setb m1
+ clr m0
+ setb prog
+ clr xtal
+ setb rdy
+ acall rst0v
+
+ acall press ; cakaj na stlacenie tlacidla
+ acall release ; cakaj na uvolnenie tlacidla
+
+ clr redled ; 2. stav testovania
+ setb grnled
+
+ clr vccsw
+ mov a,#10101010b
+ acall putbyte
+ setb m2
+ clr m1
+ setb m0
+ clr prog
+ setb xtal
+ clr rdy
+ acall rst12v
+
+ acall press ; cakaj na stlacenie tlacidla
+ acall release ; cakaj na uvolnenie tlacidla
+
+ ajmp loop
+
+; ------------------------------------------------------------------------------
+; obsluzne podprogramy
+; ------------------------------------------------------------------------------
+; obsluha casovaca PWM generatoru
+rstpwm: clr tr0 ; zastav casovac pre konzistentnu zmenu hodnoty
+ jbc rstsw,rstpwm_low
+ setb rstsw
+ mov tl0,#low (0ffffh - volt)
+ mov th0,#high (0ffffh - volt)
+rstpwm_exit:
+ setb tr0 ; znovu spust casovac
+ reti
+rstpwm_low:
+ mov tl0,#low (0ffffh - period + volt)
+ mov th0,#high (0ffffh - period + volt)
+ ajmp rstpwm_exit
+
+; nastavenie RST = 0 V
+rst0v: clr et0 ; nepotrebuje obsluhu casovaca 0
+ clr rstsw
+ mov r0,#low (580) ; cakaj >286,5 ms na dosiahnutie napatia 0,5 V
+ mov r1,#high (580)
+ ajmp rstwait
+
+; nastavenie RST = 5 V
+rst5v: jbc rstsw,rst5v_down
+ setb rstsw ; pull-up impulz
+ mov r0,#low (11) ; cakaj 5,5 ms
+ mov r1,#high (11)
+ ajmp rst5v_l0
+rst5v_down: ; pull-down impulz
+ mov r0,#low (159) ; cakaj 79,5 ms
+ mov r1,#high (159)
+rst5v_l0:
+ acall wait
+ setb et0 ; povol prerusenie od casovaca 0
+ setb tf0 ; vyvolaj obsluhu prerusenia od casovaca 0
+ mov r0,#low (40) ; cakaj 20 ms na ustalenie napatia 5 V
+ mov r1,#high (40)
+ ajmp rstwait
+
+; nastavenie RST = 12 V
+rst12v: clr et0 ; nepotrebuje obsluhu casovaca 0
+ setb rstsw
+ mov r0,#low (100) ; cakaj >44 ms na dosiahnutie napatia 12 V
+ mov r1,#high (100)
+rstwait:
+ acall wait
+ ret
+
+; ------------------------------------------------------------------------------
+; cakanie zadaneho poctu 0,5 ms
+wait: cjne r0,#0,wait_next ; detekuj koniec cakania
+ cjne r1,#0,wait_next
+ ret
+wait_next:
+ dec r0 ; zniz 16 bitove pocitadlo
+ cjne r0,#0ffh,$+4 ; detekuj vypozicku
+ dec r1
+ clr tr1 ; zastav casovac pre konzistentnu zmenu hodnoty
+ clr tf1
+ mov tl1,#halfmsl ; cakaj 0,5 ms
+ mov th1,#halfmsh
+ setb tr1 ; znovu spust casovac
+ jnb tf1,$
+ ajmp wait
+
+; bitove otocenie bajtu v ACC
+rotatebyte:
+ mov r7,#8 ; pocet bitov
+rotatebyte_l0:
+ rlc a ; MSB do C
+ xch a,r6 ; vymen A s R6
+ rrc a ; C do LSB
+ xch a,r6 ; vymen A s R6
+ djnz r7,rotatebyte_l0
+ xch a,r6 ; otoceny bajt do A
+ ret
+
+; zapisanie bajtu na datovy port AT89Cx051
+putbyte:
+ acall rotatebyte ; korekcia bitoveho otocenia datovej zbernice
+ mov pdata,a
+ ret
+
+; detekovanie stlacenia tlacidla
+press: clr f0
+ ajmp noise
+; detekovanie uvolnenia tlacidla
+release:
+ setb f0
+noise: mov dptr,#0 ; pouzi DPTR ako 16 bitove pocitadlo
+ clr tf1 ; analyzuj 10 ms interval
+ mov tl1,#low (65535 - 20000)
+ mov th1,#high (65535 - 20000)
+detect: mov c,button ; porovnaj aktualny stav tlacidla s
+ ; predpokladanym stavom
+ rlc a
+ xch a,b
+ mov c,f0
+ rlc a
+ xrl a,b
+ jb acc.0,$+4
+ inc dptr ; ak sa rovnaju, zapocitaj dobry stav
+ jnb tf1,detect ; opakuj do skoncenia intervalu
+
+ clr c ; porovnaj pocet dobrych stavov s hranicnou
+ mov a,dpl ; hodnotou
+ subb a,#low (dtctlim)
+ mov a,dph
+ subb a,#high (dtctlim)
+ jnc noise ; ak nebola prekrocena hranicna hodnota
+ ret ; analyzuj dalsi interval
+
+ end
diff --git a/tests/pins.hex b/tests/pins.hex
new file mode 100644
index 0000000..556a00f
--- /dev/null
+++ b/tests/pins.hex
@@ -0,0 +1,17 @@
+:02000000010DF0
+:10000B000150D281D280758911D2AFD280C281D2F8
+:10001B00B6745511BFC287D286C285D284C283D231
+:10002B0082116811C411C8C280D281C2B674AA11E0
+:10003B00BFD287C286D285C284D283C282118D1170
+:10004B00C411C80116C28C10B50BD2B5758AED75EB
+:10005B008CFFD28C32758AFF758CFD015DC2A9C2F3
+:10006B00B578447902019510B508D2B5780B7900B3
+:10007B000181789F79001198D2A9D28D78287900C7
+:10008B000195C2A9D2B578647900119822B8000401
+:10009B00B900012218B8FF0119C28EC28F758B17D8
+:1000AB00758DFCD28E308FFD01987F0833CE13CE29
+:1000BB00DFFACE2211B5F5A022C2D501CAD2D59056
+:1000CB000000C28F758BDF758DB1A29033C5F0A286
+:1000DB00D53365F020E001A3308FEFC3E58294F4B4
+:0700EB00E583940150D922C6
+:00000001FF
diff --git a/tests/pins.lst b/tests/pins.lst
new file mode 100644
index 0000000..95ca83f
--- /dev/null
+++ b/tests/pins.lst
@@ -0,0 +1,422 @@
+
+ASEM-51 V1.3 Copyright (c) 2002 by W.W. Heinz PAGE 1
+
+
+
+
+
+ MCS-51 Family Macro Assembler A S E M - 5 1 V 1.3
+ =====================================================
+
+
+
+ Source File: pins.asm
+ Object File: pins.hex
+ List File: pins.lst
+
+
+
+ Line I Addr Code Source
+
+ 1: ; Firmware pre testovanie kontaktov patice AT89Cx051 zariadenia pre
+ 2: ; programovanie mikrokontrolerov AT89Cx051 seriovym ISP programatorom
+ 3:
+ 4: ; Verzia 1.0
+ 5:
+ 6: ; Copyright (C) 2012 Jan Sucan <sucan@runbox.com>
+ 7:
+ 8: ; Permission is hereby granted, free of charge, to any person obtaining
+ 9: ; a copy of this software and associated documentation files (the
+ 10: ; "Software"), to deal in the Software without restriction, including
+ 11: ; without limitation the rights to use, copy, modify, merge, publish,
+ 12: ; distribute, sublicense, and/or sell copies of the Software, and to
+ 13: ; permit persons to whom the Software is furnished to do so, subject to
+ 14: ; the following conditions:
+ 15:
+ 16: ; The above copyright notice and this permission notice shall be
+ 17: ; included in all copies or substantial portions of the Software.
+ 18:
+ 19: ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ 20: ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ 21: ; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ 22: ; IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ 23: ; CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ 24: ; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ 25: ; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ 26:
+ 27: ; ------------------------------------------------------------------------------
+ 28: ; hardware
+ 29: ; ------------------------------------------------------------------------------
+ 30: B 0081 grnled equ p0.1 ; zelena LED
+ 31: B 0080 redled equ p0.0 ; cervena LED
+ 32: B 0090 button equ p1.0 ; ovladacie tlacidlo
+ 33:
+ 34: B 0082 rdy equ p0.2 ; signaly pre AT89Cx051
+ 35: B 0083 xtal equ p0.3
+ 36: B 0084 prog equ p0.4
+ 37: B 0085 m0 equ p0.5
+ 38: B 0086 m1 equ p0.6
+ 39: B 0087 m2 equ p0.7
+ 40: D 00A0 pdata equ p2
+ 41: B 00B5 rstsw equ p3.5 ; spinanie RST napatia
+ 42: B 00B6 vccsw equ p3.6 ; spinanie napajacieho napatia
+ 43:
+
+ASEM-51 V1.3 Copyright (c) 2002 by W.W. Heinz PAGE 2
+
+
+
+ Line I Addr Code Source
+
+ 44: ; ------------------------------------------------------------------------------
+ 45: ; konstanty a premenne
+ 46: ; ------------------------------------------------------------------------------
+ 47: N 01F4 dtctlim equ 500 ; hranicny pocet dobrych stavov pre vyhodnotenie
+ 48: ; stlacenia alebo uvolnenia tlacidla
+ 49:
+ 50: ; konstanty casovacov pri taktovacej frekvencii 24 MHz v jednotkach 0,5 us
+ 51: N 0212 period equ 530 ; perioda PWM signalu
+ 52: N 0012 volt equ 18 ; aktivna polperioda PWM signalu (pre 5 V)
+ 53: ; odmeranie casu 0,5 ms
+ 54: N 0017 halfmsl equ low (0ffffh - 1000)
+ 55: N 00FC halfmsh equ high (0ffffh - 1000)
+ 56:
+ 57: ; ------------------------------------------------------------------------------
+ 58: ; kod programu
+ 59: ; ------------------------------------------------------------------------------
+ 60: cseg
+ 61:
+ 62: N 0000 org 00h
+ 63: 0000 01 0D ajmp main ; hlavny program
+ 64:
+ 65: N 000B org 0bh
+ 66: 000B 01 50 ajmp rstpwm ; obsluha casovaca PWM generatoru
+ 67:
+ 68: ; ------------------------------------------------------------------------------
+ 69: ; hlavny program
+ 70: ; ------------------------------------------------------------------------------
+ 71: 000D D2 81 main: setb grnled ; zhasni obe LED
+ 72: 000F D2 80 setb redled
+ 73:
+ 74: 0011 75 89 11 mov tmod,#00010001b ; dva 16 bitove casovace
+ 75:
+ 76: 0014 D2 AF setb ea ; povol vsetky prerusenia
+ 77:
+ 78: 0016 D2 80 loop: setb redled ; 1. stav testovania
+ 79: 0018 C2 81 clr grnled
+ 80:
+ 81: 001A D2 B6 setb vccsw
+ 82: 001C 74 55 mov a,#01010101b
+ 83: 001E 11 BF acall putbyte
+ 84: 0020 C2 87 clr m2
+ 85: 0022 D2 86 setb m1
+ 86: 0024 C2 85 clr m0
+ 87: 0026 D2 84 setb prog
+ 88: 0028 C2 83 clr xtal
+ 89: 002A D2 82 setb rdy
+ 90: 002C 11 68 acall rst0v
+ 91:
+ 92: 002E 11 C4 acall press ; cakaj na stlacenie tlacidla
+ 93: 0030 11 C8 acall release ; cakaj na uvolnenie tlacidla
+ 94:
+ 95: 0032 C2 80 clr redled ; 2. stav testovania
+ 96: 0034 D2 81 setb grnled
+ 97:
+ 98: 0036 C2 B6 clr vccsw
+ 99: 0038 74 AA mov a,#10101010b
+
+ASEM-51 V1.3 Copyright (c) 2002 by W.W. Heinz PAGE 3
+
+
+
+ Line I Addr Code Source
+
+ 100: 003A 11 BF acall putbyte
+ 101: 003C D2 87 setb m2
+ 102: 003E C2 86 clr m1
+ 103: 0040 D2 85 setb m0
+ 104: 0042 C2 84 clr prog
+ 105: 0044 D2 83 setb xtal
+ 106: 0046 C2 82 clr rdy
+ 107: 0048 11 8D acall rst12v
+ 108:
+ 109: 004A 11 C4 acall press ; cakaj na stlacenie tlacidla
+ 110: 004C 11 C8 acall release ; cakaj na uvolnenie tlacidla
+ 111:
+ 112: 004E 01 16 ajmp loop
+ 113:
+ 114: ; ------------------------------------------------------------------------------
+ 115: ; obsluzne podprogramy
+ 116: ; ------------------------------------------------------------------------------
+ 117: ; obsluha casovaca PWM generatoru
+ 118: 0050 C2 8C rstpwm: clr tr0 ; zastav casovac pre konzistentnu zmenu hodnoty
+ 119: 0052 10 B5 0B jbc rstsw,rstpwm_low
+ 120: 0055 D2 B5 setb rstsw
+ 121: 0057 75 8A ED mov tl0,#low (0ffffh - volt)
+ 122: 005A 75 8C FF mov th0,#high (0ffffh - volt)
+ 123: 005D rstpwm_exit:
+ 124: 005D D2 8C setb tr0 ; znovu spust casovac
+ 125: 005F 32 reti
+ 126: 0060 rstpwm_low:
+ 127: 0060 75 8A FF mov tl0,#low (0ffffh - period + volt)
+ 128: 0063 75 8C FD mov th0,#high (0ffffh - period + volt)
+ 129: 0066 01 5D ajmp rstpwm_exit
+ 130:
+ 131: ; nastavenie RST = 0 V
+ 132: 0068 C2 A9 rst0v: clr et0 ; nepotrebuje obsluhu casovaca 0
+ 133: 006A C2 B5 clr rstsw
+ 134: 006C 78 44 mov r0,#low (580) ; cakaj >286,5 ms na dosiahnutie napatia 0,5 V
+ 135: 006E 79 02 mov r1,#high (580)
+ 136: 0070 01 95 ajmp rstwait
+ 137:
+ 138: ; nastavenie RST = 5 V
+ 139: 0072 10 B5 08 rst5v: jbc rstsw,rst5v_down
+ 140: 0075 D2 B5 setb rstsw ; pull-up impulz
+ 141: 0077 78 0B mov r0,#low (11) ; cakaj 5,5 ms
+ 142: 0079 79 00 mov r1,#high (11)
+ 143: 007B 01 81 ajmp rst5v_l0
+ 144: 007D rst5v_down: ; pull-down impulz
+ 145: 007D 78 9F mov r0,#low (159) ; cakaj 79,5 ms
+ 146: 007F 79 00 mov r1,#high (159)
+ 147: 0081 rst5v_l0:
+ 148: 0081 11 98 acall wait
+ 149: 0083 D2 A9 setb et0 ; povol prerusenie od casovaca 0
+ 150: 0085 D2 8D setb tf0 ; vyvolaj obsluhu prerusenia od casovaca 0
+ 151: 0087 78 28 mov r0,#low (40) ; cakaj 20 ms na ustalenie napatia 5 V
+ 152: 0089 79 00 mov r1,#high (40)
+ 153: 008B 01 95 ajmp rstwait
+ 154:
+ 155: ; nastavenie RST = 12 V
+
+ASEM-51 V1.3 Copyright (c) 2002 by W.W. Heinz PAGE 4
+
+
+
+ Line I Addr Code Source
+
+ 156: 008D C2 A9 rst12v: clr et0 ; nepotrebuje obsluhu casovaca 0
+ 157: 008F D2 B5 setb rstsw
+ 158: 0091 78 64 mov r0,#low (100) ; cakaj >44 ms na dosiahnutie napatia 12 V
+ 159: 0093 79 00 mov r1,#high (100)
+ 160: 0095 rstwait:
+ 161: 0095 11 98 acall wait
+ 162: 0097 22 ret
+ 163:
+ 164: ; ------------------------------------------------------------------------------
+ 165: ; cakanie zadaneho poctu 0,5 ms
+ 166: 0098 B8 00 04 wait: cjne r0,#0,wait_next ; detekuj koniec cakania
+ 167: 009B B9 00 01 cjne r1,#0,wait_next
+ 168: 009E 22 ret
+ 169: 009F wait_next:
+ 170: 009F 18 dec r0 ; zniz 16 bitove pocitadlo
+ 171: 00A0 B8 FF 01 cjne r0,#0ffh,$+4 ; detekuj vypozicku
+ 172: 00A3 19 dec r1
+ 173: 00A4 C2 8E clr tr1 ; zastav casovac pre konzistentnu zmenu hodnoty
+ 174: 00A6 C2 8F clr tf1
+ 175: 00A8 75 8B 17 mov tl1,#halfmsl ; cakaj 0,5 ms
+ 176: 00AB 75 8D FC mov th1,#halfmsh
+ 177: 00AE D2 8E setb tr1 ; znovu spust casovac
+ 178: 00B0 30 8F FD jnb tf1,$
+ 179: 00B3 01 98 ajmp wait
+ 180:
+ 181: ; bitove otocenie bajtu v ACC
+ 182: 00B5 rotatebyte:
+ 183: 00B5 7F 08 mov r7,#8 ; pocet bitov
+ 184: 00B7 rotatebyte_l0:
+ 185: 00B7 33 rlc a ; MSB do C
+ 186: 00B8 CE xch a,r6 ; vymen A s R6
+ 187: 00B9 13 rrc a ; C do LSB
+ 188: 00BA CE xch a,r6 ; vymen A s R6
+ 189: 00BB DF FA djnz r7,rotatebyte_l0
+ 190: 00BD CE xch a,r6 ; otoceny bajt do A
+ 191: 00BE 22 ret
+ 192:
+ 193: ; zapisanie bajtu na datovy port AT89Cx051
+ 194: 00BF putbyte:
+ 195: 00BF 11 B5 acall rotatebyte ; korekcia bitoveho otocenia datovej zbernice
+ 196: 00C1 F5 A0 mov pdata,a
+ 197: 00C3 22 ret
+ 198:
+ 199: ; detekovanie stlacenia tlacidla
+ 200: 00C4 C2 D5 press: clr f0
+ 201: 00C6 01 CA ajmp noise
+ 202: ; detekovanie uvolnenia tlacidla
+ 203: 00C8 release:
+ 204: 00C8 D2 D5 setb f0
+ 205: 00CA 90 00 00 noise: mov dptr,#0 ; pouzi DPTR ako 16 bitove pocitadlo
+ 206: 00CD C2 8F clr tf1 ; analyzuj 10 ms interval
+ 207: 00CF 75 8B DF mov tl1,#low (65535 - 20000)
+ 208: 00D2 75 8D B1 mov th1,#high (65535 - 20000)
+ 209: 00D5 A2 90 detect: mov c,button ; porovnaj aktualny stav tlacidla s
+ 210: ; predpokladanym stavom
+ 211: 00D7 33 rlc a
+
+ASEM-51 V1.3 Copyright (c) 2002 by W.W. Heinz PAGE 5
+
+
+
+ Line I Addr Code Source
+
+ 212: 00D8 C5 F0 xch a,b
+ 213: 00DA A2 D5 mov c,f0
+ 214: 00DC 33 rlc a
+ 215: 00DD 65 F0 xrl a,b
+ 216: 00DF 20 E0 01 jb acc.0,$+4
+ 217: 00E2 A3 inc dptr ; ak sa rovnaju, zapocitaj dobry stav
+ 218: 00E3 30 8F EF jnb tf1,detect ; opakuj do skoncenia intervalu
+ 219:
+ 220: 00E6 C3 clr c ; porovnaj pocet dobrych stavov s hranicnou
+ 221: 00E7 E5 82 mov a,dpl ; hodnotou
+ 222: 00E9 94 F4 subb a,#low (dtctlim)
+ 223: 00EB E5 83 mov a,dph
+ 224: 00ED 94 01 subb a,#high (dtctlim)
+ 225: 00EF 50 D9 jnc noise ; ak nebola prekrocena hranicna hodnota
+ 226: 00F1 22 ret ; analyzuj dalsi interval
+ 227:
+ 228: end
+
+
+
+
+
+ register banks used: ---
+
+ no errors
+
+
+
+
+ASEM-51 V1.3 Copyright (c) 2002 by W.W. Heinz PAGE 6
+
+
+
+
+
+ L I S T O F S Y M B O L S
+ =============================
+
+
+SYMBOL TYPE VALUE LINE
+------------------------------------------------------------
+??ASEM_51 NUMBER 8051
+??VERSION NUMBER 0130
+AC BIT D6
+ACC DATA E0
+B DATA F0
+BUTTON NUMBER 0090 32
+CY BIT D7
+DETECT CODE 00D5 209
+DPH DATA 83
+DPL DATA 82
+DTCTLIM NUMBER 01F4 47
+EA BIT AF
+ES BIT AC
+ET0 BIT A9
+ET1 BIT AB
+EX0 BIT A8
+EX1 BIT AA
+EXTI0 CODE 0003
+EXTI1 CODE 0013
+F0 BIT D5
+GRNLED NUMBER 0081 30
+HALFMSH NUMBER 00FC 55
+HALFMSL NUMBER 0017 54
+IE DATA A8
+IE0 BIT 89
+IE1 BIT 8B
+INT0 BIT B2
+INT1 BIT B3
+IP DATA B8
+IT0 BIT 88
+IT1 BIT 8A
+LOOP CODE 0016 78
+M0 NUMBER 0085 37
+M1 NUMBER 0086 38
+M2 NUMBER 0087 39
+MAIN CODE 000D 71
+NOISE CODE 00CA 205
+OV BIT D2
+P BIT D0
+P0 DATA 80
+P1 DATA 90
+P2 DATA A0
+P3 DATA B0
+PCON DATA 87
+PDATA NUMBER 00A0 40
+PERIOD NUMBER 0212 51
+PRESS CODE 00C4 200
+PROG NUMBER 0084 36
+PS BIT BC
+PSW DATA D0
+
+ASEM-51 V1.3 Copyright (c) 2002 by W.W. Heinz PAGE 7
+
+
+
+SYMBOL TYPE VALUE LINE
+------------------------------------------------------------
+PT0 BIT B9
+PT1 BIT BB
+PUTBYTE CODE 00BF 194
+PX0 BIT B8
+PX1 BIT BA
+RB8 BIT 9A
+RD BIT B7
+RDY NUMBER 0082 34
+REDLED NUMBER 0080 31
+RELEASE CODE 00C8 203
+REN BIT 9C
+RESET CODE 0000
+RI BIT 98
+ROTATEBYTE CODE 00B5 182
+ROTATEBYTE_L0 CODE 00B7 184
+RS0 BIT D3
+RS1 BIT D4
+RST0V CODE 0068 132
+RST12V CODE 008D 156
+RST5V CODE 0072 139
+RST5V_DOWN CODE 007D 144
+RST5V_L0 CODE 0081 147
+RSTPWM CODE 0050 118
+RSTPWM_EXIT CODE 005D 123
+RSTPWM_LOW CODE 0060 126
+RSTSW NUMBER 00B5 41
+RSTWAIT CODE 0095 160
+RXD BIT B0
+SBUF DATA 99
+SCON DATA 98
+SINT CODE 0023
+SM0 BIT 9F
+SM1 BIT 9E
+SM2 BIT 9D
+SP DATA 81
+T0 BIT B4
+T1 BIT B5
+TB8 BIT 9B
+TCON DATA 88
+TF0 BIT 8D
+TF1 BIT 8F
+TH0 DATA 8C
+TH1 DATA 8D
+TI BIT 99
+TIMER0 CODE 000B
+TIMER1 CODE 001B
+TL0 DATA 8A
+TL1 DATA 8B
+TMOD DATA 89
+TR0 BIT 8C
+TR1 BIT 8E
+TXD BIT B1
+VCCSW NUMBER 00B6 42
+VOLT NUMBER 0012 52
+WAIT CODE 0098 166
+WAIT_NEXT CODE 009F 169
+
+ASEM-51 V1.3 Copyright (c) 2002 by W.W. Heinz PAGE 8
+
+
+
+SYMBOL TYPE VALUE LINE
+------------------------------------------------------------
+WR BIT B6
+XTAL NUMBER 0083 35
diff --git a/tests/pwm.asm b/tests/pwm.asm
new file mode 100644
index 0000000..87c9a44
--- /dev/null
+++ b/tests/pwm.asm
@@ -0,0 +1,194 @@
+; Firmware pre kalibraciu PWM generatoru RST napatia zariadenia pre
+; programovanie mikrokontrolerov AT89Cx051 seriovym ISP programatorom
+
+; Verzia 1.0
+
+; Copyright (C) 2012 Jan Sucan <sucan@runbox.com>
+
+; Permission is hereby granted, free of charge, to any person obtaining
+; a copy of this software and associated documentation files (the
+; "Software"), to deal in the Software without restriction, including
+; without limitation the rights to use, copy, modify, merge, publish,
+; distribute, sublicense, and/or sell copies of the Software, and to
+; permit persons to whom the Software is furnished to do so, subject to
+; the following conditions:
+
+; The above copyright notice and this permission notice shall be
+; included in all copies or substantial portions of the Software.
+
+; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+; IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+; CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+; ------------------------------------------------------------------------------
+; hardware
+; ------------------------------------------------------------------------------
+grnled equ p0.1 ; zelena LED
+redled equ p0.0 ; cervena LED
+button equ p1.0 ; ovladacie tlacidlo
+
+rdy equ p0.2 ; signaly pre AT89Cx051
+xtal equ p0.3
+prog equ p0.4
+m0 equ p0.5
+m1 equ p0.6
+m2 equ p0.7
+pdata equ p2
+rstsw equ p3.5 ; spinanie RST napatia
+vccsw equ p3.6 ; spinanie napajacieho napatia
+
+; ------------------------------------------------------------------------------
+; konstanty a premenne
+; ------------------------------------------------------------------------------
+; konstanty casovacov pri taktovacej frekvencii 24 MHz v jednotkach 0,5 us
+period equ 530 ; perioda PWM signalu
+volt equ 18 ; aktivna polperioda PWM signalu (pre 5 V)
+ ; odmeranie casu 0,5 ms
+halfmsl equ low (0ffffh - 1000)
+halfmsh equ high (0ffffh - 1000)
+
+; ------------------------------------------------------------------------------
+; kod programu
+; ------------------------------------------------------------------------------
+ cseg
+
+ org 00h
+ ajmp main ; hlavny program
+
+ org 0bh
+ ajmp rstpwm ; obsluha casovaca PWM generatoru
+
+; ------------------------------------------------------------------------------
+; hlavny program
+; ------------------------------------------------------------------------------
+main: setb grnled ; zhasni obe LED
+ setb redled
+
+ mov tmod,#00010001b ; dva 16 bitove casovace
+
+ setb ea ; povol vsetky prerusenia
+
+ acall rst5v
+ clr grnled ; zasviet zelenu LED
+
+; pri testovani PWM generatoru RST napatia simuluj cinnost ostatnych signalov.
+; Nastavuj na ostatnych vyvodoch patice AT89Cx051 rozne logicke urovne po rozny
+; cas. Pseudonahodne hodnoty ziskavaj z neprazdnych bajtov pamate programu.
+ mov dptr,#0 ; vyberaj bajty od zaciatku pamate programu
+ clr f0
+loop: mov a,dph ; vyberaj len bajty z neprazdnej oblasti pamate
+ cjne a,#high (lastinst),next
+ mov a,dpl
+ cjne a,#low (lastinst),next
+ mov dptr,#0
+ cpl f0 ; kazdy druhy priechod ziskanu hodnotu zneguj
+
+next: mov a,#0 ; vyber bajt
+ movc a,@a+dptr
+
+ jb f0,nocpl
+ cpl a
+nocpl: mov pdata,a
+ subb a,b ; odcitaj hodnotu ziskanu z predchadzajuceho
+ ; bajtu
+ rrc a ; rozkopiruj bity na jednotlive vyvody
+ mov rdy,c
+ rrc a
+ mov xtal,c
+ rrc a
+ mov prog,c
+ rrc a
+ mov m0,c
+ rrc a
+ mov m1,c
+ rrc a
+ mov m2,c
+ rrc a
+ mov vccsw,c
+ acall pause ; cakaj
+ mov b,a ; uloz aktualnu hodnotu
+ inc dptr ; dalsi bajt
+ ajmp loop
+
+pause: mov r2,a
+ mov r1,b
+ djnz r1,$
+ djnz r2,$-2
+ ret
+
+; ------------------------------------------------------------------------------
+; obsluzne podprogramy
+; ------------------------------------------------------------------------------
+; obsluha casovaca PWM generatoru
+rstpwm: clr tr0 ; zastav casovac pre konzistentnu zmenu hodnoty
+ jbc rstsw,rstpwm_low
+ setb rstsw
+ mov tl0,#low (0ffffh - volt)
+ mov th0,#high (0ffffh - volt)
+rstpwm_exit:
+ setb tr0 ; znovu spust casovac
+ reti
+rstpwm_low:
+ mov tl0,#low (0ffffh - period + volt)
+ mov th0,#high (0ffffh - period + volt)
+ ajmp rstpwm_exit
+
+; nastavenie RST = 0 V
+rst0v: clr et0 ; nepotrebuje obsluhu casovaca 0
+ clr rstsw
+ mov r0,#low (580) ; cakaj >286,5 ms na dosiahnutie napatia 0,5 V
+ mov r1,#high (580)
+ ajmp rstwait
+
+; nastavenie RST = 5 V
+rst5v: jbc rstsw,rst5v_down
+ setb rstsw ; pull-up impulz
+ mov r0,#low (11) ; cakaj 5,5 ms
+ mov r1,#high (11)
+ ajmp rst5v_l0
+rst5v_down: ; pull-down impulz
+ mov r0,#low (159) ; cakaj 79,5 ms
+ mov r1,#high (159)
+rst5v_l0:
+ acall wait
+ setb et0 ; povol prerusenie od casovaca 0
+ setb tf0 ; vyvolaj obsluhu prerusenia od casovaca 0
+ mov r0,#low (40) ; cakaj 20 ms na ustalenie napatia 5 V
+ mov r1,#high (40)
+ ajmp rstwait
+
+; nastavenie RST = 12 V
+rst12v: clr et0 ; nepotrebuje obsluhu casovaca 0
+ setb rstsw
+ mov r0,#low (100) ; cakaj >44 ms na dosiahnutie napatia 12 V
+ mov r1,#high (100)
+rstwait:
+ acall wait
+ ret
+
+; ------------------------------------------------------------------------------
+; cakanie zadaneho poctu 0,5 ms
+wait: cjne r0,#0,wait_next ; detekuj koniec cakania
+ cjne r1,#0,wait_next
+ ret
+wait_next:
+ dec r0 ; zniz 16 bitove pocitadlo
+ cjne r0,#0ffh,$+4 ; detekuj vypozicku
+ dec r1
+ clr tr1 ; zastav casovac pre konzistentnu zmenu hodnoty
+ clr tf1
+ mov tl1,#halfmsl ; cakaj 0,5 ms
+ mov th1,#halfmsh
+ setb tr1 ; znovu spust casovac
+ jnb tf1,$
+ ajmp wait
+
+; ----------------------------------------------------------------------
+; adresa bajtu za poslednou instrukciou tohoto programu
+lastinst:
+
+ end
diff --git a/tests/pwm.hex b/tests/pwm.hex
new file mode 100644
index 0000000..94913f4
--- /dev/null
+++ b/tests/pwm.hex
@@ -0,0 +1,14 @@
+:02000000010DF0
+:10000B00015DD281D280758911D2AF117FC28190EF
+:10001B000000C2D5E583B4000AE582B4C2059000A6
+:10002B0000B2D574009320D501F4F5A095F013928E
+:10003B008213928313928413928513928613928761
+:10004B001392B61155F5F0A3011FFAA9F0D9FEDAF8
+:10005B00FC22C28C10B50BD2B5758AED758CFFD214
+:10006B008C32758AFF758CFD016AC2A9C2B57844C2
+:10007B00790201A210B508D2B5780B7900018E7800
+:10008B009F790011A5D2A9D28D7828790001A2C23F
+:10009B00A9D2B57864790011A522B80004B9000182
+:1000AB002218B8FF0119C28EC28F758B17758DFC84
+:0700BB00D28E308FFD01A57C
+:00000001FF
diff --git a/tests/pwm.lst b/tests/pwm.lst
new file mode 100644
index 0000000..d01a39e
--- /dev/null
+++ b/tests/pwm.lst
@@ -0,0 +1,370 @@
+
+ASEM-51 V1.3 Copyright (c) 2002 by W.W. Heinz PAGE 1
+
+
+
+
+
+ MCS-51 Family Macro Assembler A S E M - 5 1 V 1.3
+ =====================================================
+
+
+
+ Source File: pwm.asm
+ Object File: pwm.hex
+ List File: pwm.lst
+
+
+
+ Line I Addr Code Source
+
+ 1: ; Firmware pre kalibraciu PWM generatoru RST napatia zariadenia pre
+ 2: ; programovanie mikrokontrolerov AT89Cx051 seriovym ISP programatorom
+ 3:
+ 4: ; Verzia 1.0
+ 5:
+ 6: ; Copyright (C) 2012 Jan Sucan <sucan@runbox.com>
+ 7:
+ 8: ; Permission is hereby granted, free of charge, to any person obtaining
+ 9: ; a copy of this software and associated documentation files (the
+ 10: ; "Software"), to deal in the Software without restriction, including
+ 11: ; without limitation the rights to use, copy, modify, merge, publish,
+ 12: ; distribute, sublicense, and/or sell copies of the Software, and to
+ 13: ; permit persons to whom the Software is furnished to do so, subject to
+ 14: ; the following conditions:
+ 15:
+ 16: ; The above copyright notice and this permission notice shall be
+ 17: ; included in all copies or substantial portions of the Software.
+ 18:
+ 19: ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ 20: ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ 21: ; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ 22: ; IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ 23: ; CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ 24: ; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ 25: ; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ 26:
+ 27: ; ------------------------------------------------------------------------------
+ 28: ; hardware
+ 29: ; ------------------------------------------------------------------------------
+ 30: B 0081 grnled equ p0.1 ; zelena LED
+ 31: B 0080 redled equ p0.0 ; cervena LED
+ 32: B 0090 button equ p1.0 ; ovladacie tlacidlo
+ 33:
+ 34: B 0082 rdy equ p0.2 ; signaly pre AT89Cx051
+ 35: B 0083 xtal equ p0.3
+ 36: B 0084 prog equ p0.4
+ 37: B 0085 m0 equ p0.5
+ 38: B 0086 m1 equ p0.6
+ 39: B 0087 m2 equ p0.7
+ 40: D 00A0 pdata equ p2
+ 41: B 00B5 rstsw equ p3.5 ; spinanie RST napatia
+ 42: B 00B6 vccsw equ p3.6 ; spinanie napajacieho napatia
+ 43:
+
+ASEM-51 V1.3 Copyright (c) 2002 by W.W. Heinz PAGE 2
+
+
+
+ Line I Addr Code Source
+
+ 44: ; ------------------------------------------------------------------------------
+ 45: ; konstanty a premenne
+ 46: ; ------------------------------------------------------------------------------
+ 47: ; konstanty casovacov pri taktovacej frekvencii 24 MHz v jednotkach 0,5 us
+ 48: N 0212 period equ 530 ; perioda PWM signalu
+ 49: N 0012 volt equ 18 ; aktivna polperioda PWM signalu (pre 5 V)
+ 50: ; odmeranie casu 0,5 ms
+ 51: N 0017 halfmsl equ low (0ffffh - 1000)
+ 52: N 00FC halfmsh equ high (0ffffh - 1000)
+ 53:
+ 54: ; ------------------------------------------------------------------------------
+ 55: ; kod programu
+ 56: ; ------------------------------------------------------------------------------
+ 57: cseg
+ 58:
+ 59: N 0000 org 00h
+ 60: 0000 01 0D ajmp main ; hlavny program
+ 61:
+ 62: N 000B org 0bh
+ 63: 000B 01 5D ajmp rstpwm ; obsluha casovaca PWM generatoru
+ 64:
+ 65: ; ------------------------------------------------------------------------------
+ 66: ; hlavny program
+ 67: ; ------------------------------------------------------------------------------
+ 68: 000D D2 81 main: setb grnled ; zhasni obe LED
+ 69: 000F D2 80 setb redled
+ 70:
+ 71: 0011 75 89 11 mov tmod,#00010001b ; dva 16 bitove casovace
+ 72:
+ 73: 0014 D2 AF setb ea ; povol vsetky prerusenia
+ 74:
+ 75: 0016 11 7F acall rst5v
+ 76: 0018 C2 81 clr grnled ; zasviet zelenu LED
+ 77:
+ 78: ; pri testovani PWM generatoru RST napatia simuluj cinnost ostatnych signalov.
+ 79: ; Nastavuj na ostatnych vyvodoch patice AT89Cx051 rozne logicke urovne po rozny
+ 80: ; cas. Pseudonahodne hodnoty ziskavaj z neprazdnych bajtov pamate programu.
+ 81: 001A 90 00 00 mov dptr,#0 ; vyberaj bajty od zaciatku pamate programu
+ 82: 001D C2 D5 clr f0
+ 83: 001F E5 83 loop: mov a,dph ; vyberaj len bajty z neprazdnej oblasti pamate
+ 84: 0021 B4 00 0A cjne a,#high (lastinst),next
+ 85: 0024 E5 82 mov a,dpl
+ 86: 0026 B4 C2 05 cjne a,#low (lastinst),next
+ 87: 0029 90 00 00 mov dptr,#0
+ 88: 002C B2 D5 cpl f0 ; kazdy druhy priechod ziskanu hodnotu zneguj
+ 89:
+ 90: 002E 74 00 next: mov a,#0 ; vyber bajt
+ 91: 0030 93 movc a,@a+dptr
+ 92:
+ 93: 0031 20 D5 01 jb f0,nocpl
+ 94: 0034 F4 cpl a
+ 95: 0035 F5 A0 nocpl: mov pdata,a
+ 96: 0037 95 F0 subb a,b ; odcitaj hodnotu ziskanu z predchadzajuceho
+ 97: ; bajtu
+ 98: 0039 13 rrc a ; rozkopiruj bity na jednotlive vyvody
+ 99: 003A 92 82 mov rdy,c
+
+ASEM-51 V1.3 Copyright (c) 2002 by W.W. Heinz PAGE 3
+
+
+
+ Line I Addr Code Source
+
+ 100: 003C 13 rrc a
+ 101: 003D 92 83 mov xtal,c
+ 102: 003F 13 rrc a
+ 103: 0040 92 84 mov prog,c
+ 104: 0042 13 rrc a
+ 105: 0043 92 85 mov m0,c
+ 106: 0045 13 rrc a
+ 107: 0046 92 86 mov m1,c
+ 108: 0048 13 rrc a
+ 109: 0049 92 87 mov m2,c
+ 110: 004B 13 rrc a
+ 111: 004C 92 B6 mov vccsw,c
+ 112: 004E 11 55 acall pause ; cakaj
+ 113: 0050 F5 F0 mov b,a ; uloz aktualnu hodnotu
+ 114: 0052 A3 inc dptr ; dalsi bajt
+ 115: 0053 01 1F ajmp loop
+ 116:
+ 117: 0055 FA pause: mov r2,a
+ 118: 0056 A9 F0 mov r1,b
+ 119: 0058 D9 FE djnz r1,$
+ 120: 005A DA FC djnz r2,$-2
+ 121: 005C 22 ret
+ 122:
+ 123: ; ------------------------------------------------------------------------------
+ 124: ; obsluzne podprogramy
+ 125: ; ------------------------------------------------------------------------------
+ 126: ; obsluha casovaca PWM generatoru
+ 127: 005D C2 8C rstpwm: clr tr0 ; zastav casovac pre konzistentnu zmenu hodnoty
+ 128: 005F 10 B5 0B jbc rstsw,rstpwm_low
+ 129: 0062 D2 B5 setb rstsw
+ 130: 0064 75 8A ED mov tl0,#low (0ffffh - volt)
+ 131: 0067 75 8C FF mov th0,#high (0ffffh - volt)
+ 132: 006A rstpwm_exit:
+ 133: 006A D2 8C setb tr0 ; znovu spust casovac
+ 134: 006C 32 reti
+ 135: 006D rstpwm_low:
+ 136: 006D 75 8A FF mov tl0,#low (0ffffh - period + volt)
+ 137: 0070 75 8C FD mov th0,#high (0ffffh - period + volt)
+ 138: 0073 01 6A ajmp rstpwm_exit
+ 139:
+ 140: ; nastavenie RST = 0 V
+ 141: 0075 C2 A9 rst0v: clr et0 ; nepotrebuje obsluhu casovaca 0
+ 142: 0077 C2 B5 clr rstsw
+ 143: 0079 78 44 mov r0,#low (580) ; cakaj >286,5 ms na dosiahnutie napatia 0,5 V
+ 144: 007B 79 02 mov r1,#high (580)
+ 145: 007D 01 A2 ajmp rstwait
+ 146:
+ 147: ; nastavenie RST = 5 V
+ 148: 007F 10 B5 08 rst5v: jbc rstsw,rst5v_down
+ 149: 0082 D2 B5 setb rstsw ; pull-up impulz
+ 150: 0084 78 0B mov r0,#low (11) ; cakaj 5,5 ms
+ 151: 0086 79 00 mov r1,#high (11)
+ 152: 0088 01 8E ajmp rst5v_l0
+ 153: 008A rst5v_down: ; pull-down impulz
+ 154: 008A 78 9F mov r0,#low (159) ; cakaj 79,5 ms
+ 155: 008C 79 00 mov r1,#high (159)
+
+ASEM-51 V1.3 Copyright (c) 2002 by W.W. Heinz PAGE 4
+
+
+
+ Line I Addr Code Source
+
+ 156: 008E rst5v_l0:
+ 157: 008E 11 A5 acall wait
+ 158: 0090 D2 A9 setb et0 ; povol prerusenie od casovaca 0
+ 159: 0092 D2 8D setb tf0 ; vyvolaj obsluhu prerusenia od casovaca 0
+ 160: 0094 78 28 mov r0,#low (40) ; cakaj 20 ms na ustalenie napatia 5 V
+ 161: 0096 79 00 mov r1,#high (40)
+ 162: 0098 01 A2 ajmp rstwait
+ 163:
+ 164: ; nastavenie RST = 12 V
+ 165: 009A C2 A9 rst12v: clr et0 ; nepotrebuje obsluhu casovaca 0
+ 166: 009C D2 B5 setb rstsw
+ 167: 009E 78 64 mov r0,#low (100) ; cakaj >44 ms na dosiahnutie napatia 12 V
+ 168: 00A0 79 00 mov r1,#high (100)
+ 169: 00A2 rstwait:
+ 170: 00A2 11 A5 acall wait
+ 171: 00A4 22 ret
+ 172:
+ 173: ; ------------------------------------------------------------------------------
+ 174: ; cakanie zadaneho poctu 0,5 ms
+ 175: 00A5 B8 00 04 wait: cjne r0,#0,wait_next ; detekuj koniec cakania
+ 176: 00A8 B9 00 01 cjne r1,#0,wait_next
+ 177: 00AB 22 ret
+ 178: 00AC wait_next:
+ 179: 00AC 18 dec r0 ; zniz 16 bitove pocitadlo
+ 180: 00AD B8 FF 01 cjne r0,#0ffh,$+4 ; detekuj vypozicku
+ 181: 00B0 19 dec r1
+ 182: 00B1 C2 8E clr tr1 ; zastav casovac pre konzistentnu zmenu hodnoty
+ 183: 00B3 C2 8F clr tf1
+ 184: 00B5 75 8B 17 mov tl1,#halfmsl ; cakaj 0,5 ms
+ 185: 00B8 75 8D FC mov th1,#halfmsh
+ 186: 00BB D2 8E setb tr1 ; znovu spust casovac
+ 187: 00BD 30 8F FD jnb tf1,$
+ 188: 00C0 01 A5 ajmp wait
+ 189:
+ 190: ; ----------------------------------------------------------------------
+ 191: ; adresa bajtu za poslednou instrukciou tohoto programu
+ 192: 00C2 lastinst:
+ 193:
+ 194: end
+
+
+
+
+
+ register banks used: ---
+
+ no errors
+
+
+
+
+ASEM-51 V1.3 Copyright (c) 2002 by W.W. Heinz PAGE 5
+
+
+
+
+
+ L I S T O F S Y M B O L S
+ =============================
+
+
+SYMBOL TYPE VALUE LINE
+------------------------------------------------------------
+??ASEM_51 NUMBER 8051
+??VERSION NUMBER 0130
+AC BIT D6
+ACC DATA E0
+B DATA F0
+BUTTON NUMBER 0090 32
+CY BIT D7
+DPH DATA 83
+DPL DATA 82
+EA BIT AF
+ES BIT AC
+ET0 BIT A9
+ET1 BIT AB
+EX0 BIT A8
+EX1 BIT AA
+EXTI0 CODE 0003
+EXTI1 CODE 0013
+F0 BIT D5
+GRNLED NUMBER 0081 30
+HALFMSH NUMBER 00FC 52
+HALFMSL NUMBER 0017 51
+IE DATA A8
+IE0 BIT 89
+IE1 BIT 8B
+INT0 BIT B2
+INT1 BIT B3
+IP DATA B8
+IT0 BIT 88
+IT1 BIT 8A
+LASTINST CODE 00C2 192
+LOOP CODE 001F 83
+M0 NUMBER 0085 37
+M1 NUMBER 0086 38
+M2 NUMBER 0087 39
+MAIN CODE 000D 68
+NEXT CODE 002E 90
+NOCPL CODE 0035 95
+OV BIT D2
+P BIT D0
+P0 DATA 80
+P1 DATA 90
+P2 DATA A0
+P3 DATA B0
+PAUSE CODE 0055 117
+PCON DATA 87
+PDATA NUMBER 00A0 40
+PERIOD NUMBER 0212 48
+PROG NUMBER 0084 36
+PS BIT BC
+PSW DATA D0
+
+ASEM-51 V1.3 Copyright (c) 2002 by W.W. Heinz PAGE 6
+
+
+
+SYMBOL TYPE VALUE LINE
+------------------------------------------------------------
+PT0 BIT B9
+PT1 BIT BB
+PX0 BIT B8
+PX1 BIT BA
+RB8 BIT 9A
+RD BIT B7
+RDY NUMBER 0082 34
+REDLED NUMBER 0080 31
+REN BIT 9C
+RESET CODE 0000
+RI BIT 98
+RS0 BIT D3
+RS1 BIT D4
+RST0V CODE 0075 141
+RST12V CODE 009A 165
+RST5V CODE 007F 148
+RST5V_DOWN CODE 008A 153
+RST5V_L0 CODE 008E 156
+RSTPWM CODE 005D 127
+RSTPWM_EXIT CODE 006A 132
+RSTPWM_LOW CODE 006D 135
+RSTSW NUMBER 00B5 41
+RSTWAIT CODE 00A2 169
+RXD BIT B0
+SBUF DATA 99
+SCON DATA 98
+SINT CODE 0023
+SM0 BIT 9F
+SM1 BIT 9E
+SM2 BIT 9D
+SP DATA 81
+T0 BIT B4
+T1 BIT B5
+TB8 BIT 9B
+TCON DATA 88
+TF0 BIT 8D
+TF1 BIT 8F
+TH0 DATA 8C
+TH1 DATA 8D
+TI BIT 99
+TIMER0 CODE 000B
+TIMER1 CODE 001B
+TL0 DATA 8A
+TL1 DATA 8B
+TMOD DATA 89
+TR0 BIT 8C
+TR1 BIT 8E
+TXD BIT B1
+VCCSW NUMBER 00B6 42
+VOLT NUMBER 0012 49
+WAIT CODE 00A5 175
+WAIT_NEXT CODE 00AC 178
+WR BIT B6
+XTAL NUMBER 0083 35