Thermostat listing file
From Just in Time
Here is the code for thermostat.lst
1 ;======================================================================= 2 ;TITLE: <filetitle.src> 3 ; 4 ;PURPOSE: <brief description of program's purpose and use> 5 ; <rest of brief description> 6 ; 7 ;AUTHOR: <name>, <company>. 8 ; 9 ;REVISIONS: 10 ; <mm/dd/yy> - <details of revision> 11 ; <more details of same revision> 12 ; 13 ;CONNECTIONS: 14 ; <I/O pin connections and purpose> 15 ; 16 ;DETAILS: 17 ; <very descriptive details about the purpose and operation of the 18 ; program, special options, modification notes, etc> 19 ;======================================================================= 20 21 22 ;-------------------------- DEVICE DIRECTIVES -------------------------- 23 24 07F8 0F7F DEVICE SX28,OSCHS1,TURBO 25 07F8 0F7F DEVICE STACKX, OPTIONX 26 27 =00000000 IRC_CAL IRC_SLOW 28 29 07FF 0B00 RESET Initialize 30 31 ;------------------------------ CONSTANTS ------------------------------ 32 ;SIMULATION EQU 1 33 =003D0900 Frequency EQU 4_000_000 ; clock frequency 34 =00002580 BaudRate EQU 9600 ; serial port baudrate 35 =00000003 InterruptsPerBit EQU 3 ; samples per serial bit 36 37 ; uncomment the following EQU if using a MAX232, since we need to 38 ; reverse the rs-232 signals while not using a MAX232 39 ;UsingMAX232 EQU 1 ; we're using a max232 40 41 ;------------------------------ --------- ------------------------------ 42 ; some derived constants (derived from the ones above) 43 ; These are not meant to be changed manually. 44 ; 45 ; clock ticks per interrupt 46 =0000008B InterruptPeriod EQU Frequency/(InterruptsPerBit * BaudRate) + 1 47 ; value to put in W to obtain the clock ticks per interrupt 48 ; formulated in this particular way to get rid of 'Literal 49 ; truncated to 8 bits' warning 50 =00000075 RetiwValue EQU 256-InterruptPeriod 51 52 53 =00000006 SerialOut EQU rb.0 ; 54 ;SerialIn EQU rb.0 ; input respectively. 55 56 ;------------------------------ VARIABLES ------------------------------ 57 =00000008 ORG $08 58 =00000008 spi_bank EQU $ 59 =00000008 spi_value DS 2 60 =0000000A spi_bit DS 1 61 62 =00000007.7 spi_clock EQU rc.7 63 =00000007.6 spi_cs EQU rc.6 64 =00000007.5 spi_so EQU rc.5 65 66 =00000010 ORG $10 67 =00000010 WAIT = $ 68 =00000010 cnt0 DS 1 69 =00000011 cnt1 DS 1 70 =00000012 cnt2 DS 1 71 =00000050 ORG $50 72 =00000050 SERIAL = $ ;UART bank 73 =00000050 tx_high ds 1 ;hi byte to transmit 74 =00000051 tx_low ds 1 ;low byte to transmit 75 =00000052 tx_count ds 1 ;number of bits sent 76 =00000053 tx_divide ds 1 ;xmit timing (/16) counter 77 =00000054 rx_count ds 1 ;number of bits received 78 =00000055 rx_divide ds 1 ;receive timing counter 79 =00000056 rx_byte ds 1 ;buffer for incoming byte 80 =00000057 flags ds 1 ;only contains the rx_flag 81 =00000057 rx_flag EQU flags.0 82 =00000058 string ds 1 ;used by send_string to store the address in memory 83 =00000059 byte ds 1 ;used by serial routines 84 85 ; These macros control whether our serial line is high-active 86 ; or low-active. 87 Rs232Up MACRO pin 88 IFDEF UsingMAX232 THEN 89 setb pin 90 ELSE 91 clrb pin 92 ENDIF 93 ENDM 94 95 Rs232Down MACRO pin 96 IFDEF UsingMAX232 THEN 97 clrb pin 98 ELSE 99 setb pin 100 ENDIF 101 ENDM 102 103 ; transfer the state of the rs232 input pin to the carry flag 104 Rs232PinToCarry MACRO pin 105 sb pin ;get current rx bit 106 IFDEF UsingMAX232 THEN 107 clc 108 ELSE 109 stc 110 ENDIF 111 snb pin ; 112 IFDEF UsingMAX232 THEN 113 stc 114 ELSE 115 clc 116 ENDIF 117 ENDM 118 119 120 ;---------------------------- DEBUG SETTINGS --------------------------- 121 122 =003D0900 FREQ Frequency 123 124 125 =0000000A WKED_W equ $0A ;Write MIWU/RB Interrupt edge setup, 0 = falling, 1 = rising 126 =0000000B WKEN_W equ $0B ;Write MIWU/RB Interrupt edge setup, 0 = enabled, 1 = disabled 127 =0000000C ST_W equ $0C ;Write Port Schmitt Trigger setup, 0 = enabled, 1 = disabled 128 =0000000D LVL_W equ $0D ;Write Port Schmitt Trigger setup, 0 = enabled, 1 = disabled 129 =0000000E PLP_W equ $0E ;Write Port Schmitt Trigger setup, 0 = enabled, 1 = disabled 130 =0000000F DDIR_W equ $0F ;Write Port Direction 131 132 =000000FF RA_latch equ %11111111 ;SX18/20/28/48/52 port A latch init 133 =000000FF RA_DDIR equ %11111111 ;see under pin definitions for port A DDIR value 134 =00000000 RA_LVL equ %00000000 ;SX18/20/28/48/52 port A LVL value 135 =000000FF RA_PLP equ %11111111 ;SX18/20/28/48/52 port A PLP value 136 137 =00000000 RB_latch equ %00000000 ;SX18/20/28/48/52 port B latch init 138 =000000FE RB_DDIR equ %11111110 ;SX18/20/28/48/52 port B DDIR value 139 =000000FF RB_ST equ %11111111 ;SX18/20/28/48/52 port B ST value 140 =00000000 RB_LVL equ %00000000 ;SX18/20/28/48/52 port B LVL value 141 =000000FF RB_PLP equ %11111111 ;SX18/20/28/48/52 port B PLP value 142 143 =00000000 RC_latch equ %00000000 ;SX18/20/28/48/52 port C latch init 144 =0000003F RC_DDIR equ %00111111 ;SX18/20/28/48/52 port C DDIR value 145 =000000FF RC_ST equ %11111111 ;SX18/20/28/48/52 port C ST value 146 =00000020 RC_LVL equ %00100000 ;SX18/20/28/48/52 port C LVL value 147 =000000FF RC_PLP equ %11111111 ;SX18/20/28/48/52 port C PLP value 148 149 ;-------------------------- INTERRUPT ROUTINE -------------------------- 150 =00000000 ORG 0 151 152 =00000000 Interrupt 153 =00000000 SerialVP 154 0000 001A bank SERIAL ;switch to serial register bank 155 0001 02F3 :transmit decsz tx_divide ;only execute the transmit routine 156 0002 0A10 jmp EndInterrupt ; 157 0003 0C03 mov w,#InterruptsPerBit ; 158 0004 0033 mov tx_divide,w ; 159 0005 0232 test tx_count ;are we sending? 160 0006 0643 snz ; 161 0007 0A10 jmp EndInterrupt ; 162 0008 0503 stc ;yes, ready stop bit 163 0009 0330 rr tx_high ; and shift to next bit 164 000A 0331 rr tx_low ; 165 000B 00F2 dec tx_count ;decrement bit counter 166 000C 06D1 snb tx_low.6 ;output next bit 167 Rs232Up SerialOut ; 168 m IFDEF UsingMAX232 THEN 169 m setb SerialOut 170 m ELSE 171 000D 0406 m clrb SerialOut 172 m ENDIF 174 000E 07D1 sb tx_low.6 ; 175 Rs232Down SerialOut ; 176 m IFDEF UsingMAX232 THEN 177 m clrb SerialOut 178 m ELSE 179 000F 0506 m setb SerialOut 180 m ENDIF 182 0010 0C75 EndInterrupt mov w, #RetiwValue 183 0011 000F retiw 184 185 186 ;------------------------ INITIALIZATION ROUTINE ----------------------- 187 =00000100 org $0100 188 =00000100 Initialize 189 0100 005C mov m, #ST_W ;point MODE to write ST register 190 0101 0CFF mov !rb,#RB_ST ;Setup RB Schmitt Trigger, 0 = enabled, 1 = disabled 0102 0006 191 0103 0CFF mov !rc,#RC_ST ;Setup RC Schmitt Trigger, 0 = enabled, 1 = disabled 0104 0007 192 193 0105 005D mov m, #LVL_W ;point MODE to write LVL register 194 0106 0C00 mov !ra,#RA_LVL ;Setup RA CMOS or TTL levels, 0 = TTL, 1 = CMOS 0107 0005 195 0108 0C00 mov !rb,#RB_LVL ;Setup RB CMOS or TTL levels, 0 = TTL, 1 = CMOS 0109 0006 196 010A 0C20 mov !rc,#RC_LVL ;Setup RC CMOS or TTL levels, 0 = TTL, 1 = CMOS 010B 0007 197 198 010C 005E mov m, #PLP_W 199 010D 0CFF mov !ra,#RA_PLP ;Setup RA Weak Pull-up, 0 = enabled, 1 = disabled 010E 0005 200 010F 0CFF mov !rb,#RB_PLP ;Setup RB Weak Pull-up, 0 = enabled, 1 = disabled 0110 0006 201 0111 0CFF mov !rc,#RC_PLP ;Setup RC Weak Pull-up, 0 = enabled, 1 = disabled 0112 0007 202 203 0113 0CFF mov ra,#RA_latch ;Initialize RA data latch 0114 0025 204 0115 0C00 mov rb,#RB_latch ;Initialize RB data latch 0116 0026 205 0117 0C00 mov rc,#RC_latch ;Initialize RC data latch 0118 0027 206 207 0119 005F mov m, #DDIR_W ;point MODE to write DDIR register 208 011A 0CFF mov !ra,#RA_DDIR ;Setup RA Direction register, 0 = output, 1 = input 011B 0005 209 011C 0CFE mov !rb,#RB_DDIR ;Setup RB Direction register, 0 = output, 1 = input 011D 0006 210 011E 0C3F mov !rc,#RC_DDIR ;Setup RC Direction register, 0 = output, 1 = input 011F 0007 211 212 213 ; zero all ram (SX28) 214 0120 0064 clr fsr ;reset all ram banks 215 0121 0784 :zero_ram sb fsr.4 ;are we on low half of bank? 216 0122 0564 setb fsr.3 ;If so, don't touch regs 0-7 217 0123 0060 clr ind ;clear using indirect addressing 218 0124 03E4 incsz fsr ;repeat until done 219 0125 0B21 jmp :zero_ram 220 221 0126 001A bank SERIAL 222 0127 0C03 mov tx_divide, #InterruptsPerBit 0128 0033 223 0129 0C9F mov !option,#%10011111 ;enable rtcc interrupt 012A 0002 224 225 ;---------------------------- MAIN PROGRAM ----------------------------- 226 =0000012B BREAK MainLoop 227 =0000012B Main 228 IFNDEF SIMULATION 229 012B 0C00 mov w, #OpeningMessage // 256 230 012C 0012 call @send_string 012D 090A 231 ENDIF 232 =0000012E MainLoop 233 012E 0011 call @SpiRead 012F 0900 234 0130 0648 jb spi_value.2, :no_sensor 0131 0B49 235 236 0132 0403 clc 237 0133 0329 rr spi_value + 1 238 0134 0328 rr spi_value 239 0135 0403 clc 240 0136 0329 rr spi_value + 1 241 0137 0328 rr spi_value 242 0138 0403 clc 243 0139 0329 rr spi_value + 1 244 013A 0328 rr spi_value 245 013B 0403 clc 246 013C 0329 rr spi_value + 1 247 013D 0328 rr spi_value 248 013E 0403 clc 249 013F 0329 rr spi_value + 1 250 0140 0328 rr spi_value 251 252 IFDEF SIMULATION 253 mov spi_value, #23 254 mov spi_value + 1, #0 255 ENDIF 256 0141 0011 call @send_decimal 0142 0912 257 0143 0C46 mov w, #CRLF // 256 258 0144 0012 call @send_string 0145 090A 259 0146 0012 call @WaitASec 0147 0925 260 0148 0B2E jmp MainLoop 261 262 0149 0C3D :no_sensor mov w, #NoSensorMessage // 256 263 014A 0012 call @send_string 014B 090A 264 014C 0012 call @WaitASec 014D 0925 265 014E 0B2E jmp MainLoop 266 267 268 SpiDelay MACRO 269 ENDM 270 271 SpiClock MACRO clock_bit 272 setb clock_bit 273 nop 274 clrb clock_bit 275 nop 276 ENDM 277 278 SpiShift MACRO so_bit, register 279 sb so_bit 280 clc 281 snb so_bit 282 stc 283 rl register 284 rl register + 1 285 ENDM 286 287 =00000200 org $0200 288 =00000200 SpiRead 289 0200 0018 bank spi_bank 290 0201 04C7 clrb spi_cs ; lower ~CS, this will give us the first bit. 291 SpiDelay 293 0202 0C10 mov spi_bit, #16 ; reading 16 bits 0203 002A 294 =00000204 :bit_loop 295 SpiShift spi_so, spi_value ; read bit-value 296 0204 07A7 m sb spi_so 297 0205 0403 m clc 298 0206 06A7 m snb spi_so 299 0207 0503 m stc 300 0208 0368 m rl spi_value 301 0209 0369 m rl spi_value + 1 303 SpiClock spi_clock ; move to next bit 304 020A 05E7 m setb spi_clock 305 020B 0000 m nop 306 020C 04E7 m clrb spi_clock 307 020D 0000 m nop 309 SpiDelay 311 020E 02EA djnz spi_bit, :bit_loop ; do next bit 020F 0A04 312 0210 05C7 setb spi_cs ; set ~CS 313 0211 000D retp 314 315 =00000009 HI EQU spi_value + 1 316 =00000008 LO EQU spi_value 317 =0000000A temp EQU spi_bit 318 =00000212 send_decimal: 319 320 ; by Rich Leggitt with tweaks by Scott Dattalo and bugfix by Dmitry Kiryashov and Nikolai Golovchenko and Ted Inoue. 321 ; given 16 bit data in HI and LO, extract decimal digits 322 ; requires one Output register called temp, HI and LO are destroyed. 323 ; 42 instructions and less than 290 instructions executed 324 0212 006A clr temp 325 0213 0602 skip 326 0214 02AA sub10k inc temp 327 0215 0C10 mov W, #10000 & 255 328 0216 00A8 sub LO, W 329 330 ;Scott Dattalo says: 331 ;If you have a ram location that's known to be zero, then 332 ;the following [the IF] can be replaced with [the ELSE] 333 334 IFNDEF known_zero 335 0217 0C27 mov W, #10000 >> 8 336 0218 0703 sb C 337 0219 0C28 mov W, #(10000 >> 8)+1 338 ELSE 339 mov W, << known_zero 340 add W, #(1000 >> 8) + 1 341 ENDIF 342 021A 00A9 sub HI, W 343 021B 0603 jc sub10k ;11*7=77 inst in loop for 60900 (worst) 021C 0A14 344 021D 020A mov w, temp 345 021E 0012 call @send_digit 021F 0900 346 347 0220 0C0A mov W, #10 348 0221 002A mov temp, W 349 0222 00EA add1K dec temp 350 0223 0CE8 mov W, #1000 & 255 351 0224 01E8 add LO, W 352 353 ;Scott Dattalo says: 354 ;If you have a ram location that's known to be zero, then 355 ;the following [the IF] can be replaced with [the ELSE] 356 357 IFNDEF known_zero 358 0225 0C03 mov W, #1000 >> 8 359 0226 0603 snb C 360 0227 0C04 mov W, #(1000 >> 8)+1 361 ELSE 362 mov W, << known_zero 363 add W, #1000 > > 8 364 ENDIF 365 0228 01E9 add HI, W 366 0229 0703 jnc add1k ;10*10=100 inst in loop for 60900 022A 0A22 367 022B 020A mov w, temp 368 022C 0012 call @send_digit 022D 0900 369 370 371 ;Scott takes over here 372 022E 006A clr temp 373 022F 0C64 mov W, #100 374 0230 0702 skip 375 =00000231 sub100 376 0231 02AA inc temp 377 0232 00A8 sub LO, W 378 0233 0603 snb C 379 0234 0A31 jmp sub100 380 381 0235 00E9 dec HI 382 0236 07E9 sb HI.7 ;Check msb instead of carry for underflow. 383 0237 0A31 jmp sub100 ;4 inst per loop to 200 then 7 per loop to 900. 384 ;Total 64(?) in loop for worst case 385 386 ;at this point, HI = 0xff, and 0 <= LO <= 99 387 388 0238 020A mov w, temp 389 0239 0012 call @send_digit 023A 0900 390 391 023B 0C0A mov W, #10 392 023C 002A mov temp, W 393 023D 00EA add10 dec temp 394 023E 01E8 add LO, W 395 023F 0703 jnc add10 ;40 inst in loop for worst case. 0240 0A3D 396 0241 020A mov w, temp 397 0242 0012 call @send_digit 0243 0900 398 0244 0208 mov w, LO 399 0245 0012 call @send_digit 0246 0900 400 0247 000D retp 401 402 =00000400 ORG $400 403 ;***************************************************************************************** 404 ; UART Subroutines 405 ;***************************************************************************************** 406 407 ;********************************************************************************* 408 ; Function: send_byte 409 ; Send byte via serial port 410 ; INPUTS: 411 ; w - The byte to be sent via RS-232 412 ; OUTPUTS: 413 ; outputs the byte via RS-232 414 ;********************************************************************************* 415 0400 0D30 send_digit or w, #'0' 416 0401 001A send_byte bank SERIAL 417 418 0402 0232 :wait test tx_count ;wait for not busy 419 0403 0743 sz 420 0404 0A02 jmp :wait ; 421 422 0405 0030 mov tx_high,w ; store data byte 423 0406 04F1 clrb tx_low.7 ; set up start bit 424 0407 0C0A mov w,#10 ;1 start + 8 data + 1 stop bit 425 0408 0032 mov tx_count,w 426 0409 000D retp ;leave and fix page bits 427 428 ;********************************************************************************* 429 ; Function: send_string 430 ; Send string pointed to by address in W register 431 ; INPUTS: 432 ; w - The address of a null-terminated string in program 433 ; memory 434 ; OUTPUTS: 435 ; outputs the string via RS-232 436 ;********************************************************************************* 437 040A 001A send_string bank SERIAL 438 040B 0038 mov string,w ;store string address 439 040C 0218 :loop mov w,string ;read next string character 440 040D 0055 mov m,#(StringPage>>8) ;with indirect addressing 441 040E 0041 iread ;using the mode register 442 040F 0D00 test w ;are we at the last char? 443 0410 0643 snz ;if not=0, skip ahead 444 0411 0A15 jmp :exit ;yes, leave & fix page bits 445 0412 0901 call send_byte ;not 0, so send character 446 0413 02B8 inc string ;point to next character 447 0414 0A0C jmp :loop ;loop until done 448 0415 005F :exit mov m,#$0f ;reset the mode register 449 0416 000D retp 450 451 0417 001A send_word bank SERIAL 452 0418 0C10 mov spi_bit, #16 0419 002A 453 041A 0368 :bit_loop rl spi_value 454 041B 0369 rl spi_value + 1 455 041C 0C31 mov w, #'1' 456 041D 0703 sc 457 041E 0C30 mov w, #'0' 458 041F 0901 call send_byte 459 0420 02EA djnz spi_bit, :bit_loop 0421 0A1A 460 0422 0C0A mov w, #10 461 0423 0901 call send_byte 462 0424 000D retp 463 464 =00000425 WaitASec 465 IFNDEF SIMULATION 466 0425 0018 bank WAIT 467 0426 0070 clr cnt0 468 0427 0071 clr cnt1 469 0428 0C0A mov cnt2, #10 0429 0032 470 042A 02F0 :loop djnz cnt0, :loop 042B 0A2A 471 042C 02F1 djnz cnt1, :loop 042D 0A2A 472 042E 02F2 djnz cnt2, :loop 042F 0A2A 473 ENDIF 474 0430 000D retp 475 476 ;***************************************************************************************** 477 ; String constants 478 ;***************************************************************************************** 479 =00000500 org $500 480 =00000500 StringPage EQU $ 481 0500 0054 OpeningMessage DW 'Temperature Sensor', 13, 10, 'Copyright (c) 2006,2007 Danny Havenith', 13, 10, 0 0501 0065 006D 0070 0065 0505 0072 0061 0074 0075 0509 0072 0065 0020 0053 050D 0065 006E 0073 006F 0511 0072 000D 000A 0043 0515 006F 0070 0079 0072 0519 0069 0067 0068 0074 051D 0020 0028 0063 0029 0521 0020 0032 0030 0030 0525 0036 002C 0032 0030 0529 0030 0037 0020 0044 052D 0061 006E 006E 0079 0531 0020 0048 0061 0076 0535 0065 006E 0069 0074 0539 0068 000D 000A 0000 482 483 053D 004E NoSensorMessage DW 'No Sensor' 053E 006F 0020 0053 0065 0542 006E 0073 006F 0072 484 0546 000D CRLF DW 13, 10, 0 0547 000A 0000 485 486 Cross Reference 92 symbols Symbol Type Value Line __SASM DATA 00000001 0000 __SX_BREAK ADDR 0000012B 0226 __SX_FREQ DATA 003D0900 0122 __SX_IRC_CAL DATA 00000000 0027 __SX_RESET RESB 00000B00 0029 add10 ADDR 0000023D 0393 add1K ADDR 00000222 0349 BaudRate DATA 00002580 0034 byte MEMV 00000059 0083 C RESB 00000003 0336 cnt0 MEMV 00000010 0068 cnt1 MEMV 00000011 0069 cnt2 MEMV 00000012 0070 CRLF ADDR 00000546 0484 DDIR_W DATA 0000000F 0130 EndInterrupt ADDR 00000010 0182 flags MEMV 00000057 0080 Frequency DATA 003D0900 0033 fsr RESV 00000004 0214 HI DATA 00000009 0315 ind RESV 00000000 0217 Initialize ADDR 00000100 0188 Initialize:zero_ram ADDR 00000121 0215 Interrupt ADDR 00000000 0152 InterruptPeriod DATA 0000008B 0046 InterruptsPerBit DATA 00000003 0035 LO DATA 00000008 0316 LVL_W DATA 0000000D 0128 Main ADDR 0000012B 0227 MainLoop ADDR 0000012E 0232 MainLoop:no_sensor ADDR 00000149 0262 NoSensorMessage ADDR 0000053D 0483 OpeningMessage ADDR 00000500 0481 PLP_W DATA 0000000E 0129 ra RESV 00000005 0203 RA_DDIR DATA 000000FF 0133 RA_latch DATA 000000FF 0132 RA_LVL DATA 00000000 0134 RA_PLP DATA 000000FF 0135 rb RESV 00000006 0053 RB_DDIR DATA 000000FE 0138 RB_latch DATA 00000000 0137 RB_LVL DATA 00000000 0140 RB_PLP DATA 000000FF 0141 RB_ST DATA 000000FF 0139 rc RESV 00000007 0062 RC_DDIR DATA 0000003F 0144 RC_latch DATA 00000000 0143 RC_LVL DATA 00000020 0146 RC_PLP DATA 000000FF 0147 RC_ST DATA 000000FF 0145 RetiwValue DATA 00000075 0050 rx_byte MEMV 00000056 0079 rx_count MEMV 00000054 0077 rx_divide MEMV 00000055 0078 rx_flag DATA 00000057 0081 send_byte ADDR 00000401 0416 send_byte:wait ADDR 00000402 0418 send_decimal ADDR 00000212 0318 send_digit ADDR 00000400 0415 send_string ADDR 0000040A 0437 send_string:exit ADDR 00000415 0448 send_string:loop ADDR 0000040C 0439 send_word ADDR 00000417 0451 send_word:bit_loop ADDR 0000041A 0453 SERIAL VAR 00000050 0072 SerialOut DATA 00000006 0053 SerialVP ADDR 00000000 0153 SerialVP:transmit ADDR 00000001 0155 spi_bank DATA 00000008 0058 spi_bit MEMV 0000000A 0060 spi_clock DATA 00000007.7 0062 spi_cs DATA 00000007.6 0063 spi_so DATA 00000007.5 0064 spi_value MEMV 00000008 0059 SpiRead ADDR 00000200 0288 SpiRead:bit_loop ADDR 00000204 0294 ST_W DATA 0000000C 0127 string MEMV 00000058 0082 StringPage DATA 00000500 0480 sub100 ADDR 00000231 0375 sub10k ADDR 00000214 0326 temp DATA 0000000A 0317 tx_count MEMV 00000052 0075 tx_divide MEMV 00000053 0076 tx_high MEMV 00000050 0073 tx_low MEMV 00000051 0074 WAIT VAR 00000010 0067 WaitASec ADDR 00000425 0464 WaitASec:loop ADDR 0000042A 0470 WKED_W DATA 0000000A 0125 WKEN_W DATA 0000000B 0126