Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 1 0000 1 $BASE 10T 2 ;*************************************************** *********************** 3 ; "EXERCISER" 4 ; DIGITAL QRP BREADBOARD 5 ; 6 ; Version 2.0 05/4/2003 7 ; 8 ; George Heron, N2APB 9 ; 2419 Feather Mae Ct. 10 ; Forest Hill, MD 21050 11 ; email: n2apb@amsat.org 12 ; 13 ; This program is the initial application that comes pre-loaded on the HC908 Daughtercard. 14 ; It sits in "User Application" area of memory ($8000-$EEFF) and co-resides 15 ; with the HCmon debug monitor also on the Daughterc ard (at $EF00-$FFDE). 16 ; 17 ; "Exerciser" is a simple application that is controlled via the RS-232 serial port 18 ; and is used to demonstrate use of typical I/O peripherals one might use with the 19 ; processor. Exerciser provides a set of library routines and drivers for the various 20 ; hardware components comprising the Digital Breadboard project: LCD, keypad, 21 ; DDS, A/D Converter, shaft encoder and EEPROM. These library routines 22 ; are individually selectable from a menu presented sent to the serial 23 ; port, allowing the user to invoke any of the functions for test purposes. 24 ; Further, the user may conveniently modify the Exerciser program to serve as the starting 25 ; point for custom program development. 26 ; 27 ; For complete documentation and design details, see the web pages devoted for this 28 ; project at www.njqrp.org/hc908_resource_page 29 ; 30 ; This code is intended to run on a Motorola 68HC908AB32 microcontroller and is 31 ; best assembled within the Integrated Development Environment editor, provided free 32 ; by Motorola as part of their HC908 development tool suite. See the HC908 Resource Page 33 ; for full details on obtaining this development software. 34 ; 35 ; Revision History: 36 ; ---------------- 37 ; 1.0 04/10/2003 Initial release 38 ; 2.0 06/16/2003 Adds Piezo tone generatio n on Timer A Chan 0 (Piezo wired to port E2). 39 ; Added Piezo_Beep command (P) to menu and command processors. Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 2 40 ; Corrected Timer interrupt timing (Timer A Chan 1 now = 1.000 ms). 41 ; Change Keyline output to Port D0. User can drive the base of 2N2222 42 ; through a 10K resistor, and transistor can drive transmitter directly 43 ; or Sonalert for added volume (over Piezo) for use with the Keyer program. 44 ; Corrected pointer increment in DispMsg routine of Driver.s module (changed INX to AIX #1) 45 ; Added paddle input to ports C5 and C2. (Disconnected these from LEDs) 46 ; Fixed piezo (timeout2), changed include files to *.asm, added delay for initial LCD display 47 ; 48 ;*************************************************** *********************** 49 ; Copyright 2003 by G. Heron, N2APB. All rights reserved. For personal, non-profit use only. 50 ;*************************************************** *********************** 51 0000 52 include "../AB_REGS.asm" ;MC68HC908GP32 register defimitions 53 ; 68HC908AB32 Equates 54 0000 55 PTA EQU $0000 ; Ports and data direction 0000 56 PORTA EQU $0000 0000 57 PTB EQU $0001 0000 58 PORTB EQU $0001 0000 59 PTC EQU $0002 0000 60 PORTC EQU $0002 0000 61 PTD EQU $0003 0000 62 PORTD EQU $0003 0000 63 DDRA EQU $0004 0000 64 DDRB EQU $0005 0000 65 DDRC EQU $0006 0000 66 DDRD EQU $0007 67 0000 68 PTE EQU $0008 0000 69 PORTE EQU $0008 0000 70 PTF EQU $0009 0000 71 PORTF EQU $0009 0000 72 PTG EQU $000A 0000 73 PORTG EQU $000A 0000 74 PTH EQU $000B 0000 75 PORTH EQU $000B 76 0000 77 DDRE EQU $000C 0000 78 DDRF EQU $000D 0000 79 DDRG EQU $000E 0000 80 DDRH EQU $000F 81 82 ;* Serial Peripheral Interface Module (SPI) ******************************** Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 3 83 0000 84 spcr equ $10 ; SPI Control Register 0000 85 SPRIE equ 7 ; SPI receiver interrupt enable bit 0000 86 SPMSTR equ 5 ; SPI master bit 0000 87 CPOL equ 4 ; clock polarity bit 0000 88 CPHA equ 3 ; clock phase bit 0000 89 SPWOM equ 2 ; SPI wired-or mode bit 0000 90 SPE equ 1 ; SPI enable 0000 91 SPTIE equ 0 ; SPI transmit interrupt enable 92 0000 93 spscr equ $11 ; SPI Status and Control Register 0000 94 SPRF equ 7 ; SPI receiver full bit 0000 95 ERRIE equ 6 ; error interrupt enable bit 0000 96 OVRF equ 5 ; overflow bit 0000 97 MODF equ 4 ; mode fault bit 0000 98 SPTE equ 3 ; SPI transmitter empty bit 0000 99 MODFEN equ 2 ; mode fault enable bit 0000 100 SPR1 equ 1 ; SPI baud rate 0000 101 SPR0 equ 0 ; select bits 102 0000 103 spdr equ $12 ; SPI Data Register 104 105 106 ;* Serial Communications Interface (SCI) ********* ************************* 107 0000 108 scc1 equ $13 ; SCI Control Register 1 0000 109 LOOPS equ 7 ; loop mode select bit 0000 110 ENSCI equ 6 ; enable SCI bit 0000 111 TXINV equ 5 ; transmit inversion bit 0000 112 M equ 4 ; mode bit 0000 113 WAKE equ 3 ; wakeup condition bit 0000 114 ILTY equ 2 ; idle line type bit 0000 115 PEN equ 1 ; parity enable bit Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 4 0000 116 PTY equ 0 ; parity bit 117 0000 118 scc2 equ $14 ; SCI Control Register 2 0000 119 SCTIE equ 7 ; SCI transmit interrupt enable bit 0000 120 TCIE equ 6 ; transmissi on complete int enable bit 0000 121 SCRIE equ 5 ; SCI receive interrupt enable bit 0000 122 ILIE equ 4 ; idle line interrupt enable bit 0000 123 TE equ 3 ; transmitte r enable bit 0000 124 RE equ 2 ; receiver enable bit 0000 125 RWU equ 1 ; receiver wakeup bit 0000 126 SBK equ 0 ; send break bit 127 0000 128 scc3 equ $15 ; SCI Control Register 3 0000 129 R8 equ 7 ; received bit 8 0000 130 T8 equ 6 ; transmitte d bit 8 0000 131 ORIE equ 3 ; receiver overrun interrupt enable bit 0000 132 NEIE equ 2 ; receiver noise error int enable bit 0000 133 FEIE equ 1 ; receiver framing error int enable bit 0000 134 PEIE equ 0 ; receiver parity error int enable bit 135 0000 136 scs1 equ $16 ; SCI Status Register 1 0000 137 SCTE equ 7 ; SCI transmitter empty bit 0000 138 TC equ 6 ; transmissi on complete bit 0000 139 SCRF equ 5 ; SCI receiver full bit 0000 140 IDLE equ 4 ; receiver idle bit 0000 141 OR equ 3 ; receiver overrun bit 0000 142 NF equ 2 ; receiver noise flag bit 0000 143 FE equ 1 ; receiver framing error bit 0000 144 PE equ 0 ; receiver parity error bit 145 0000 146 scs2 equ $17 ; SCI Status Register 2 0000 147 BKF equ 1 ; break Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 5 flag bit 0000 148 RPF equ 0 ; reception in progress flag bit 149 ; 0000 150 scdr equ $18 ; SCI Data Register 0000 151 scbr equ $19 ; SCI Baud Rate Register 152 153 154 ;* External Interrupt (IRQ) ********************** ************************* 155 0000 156 intscr equ $1D ; IRQ Status and Control Register 0000 157 IRQF equ 3 ; IRQ flag bit 0000 158 ACK equ 2 ; IRQ interrupt request acknowledge bit 0000 159 IMASK equ 1 ; IRQ interrupt mask bit 0000 160 MODE equ 0 ; IRQ edge/level select bit 161 0000 162 ISCR EQU $001A 163 164 165 ;* Keyboard Interrupt Module (KBI) *************** ************************* 166 0000 167 intkbscr equ $1B ; Keyboard Status and Control Register 0000 168 KBSCR EQU $001B 0000 169 KEYF equ 3 ; keyboard flag bit 0000 170 ACKK equ 2 ; keyboard acknowledge bit 0000 171 IMASKK equ 1 ; keyboard interrupt mask bit 0000 172 MODEK equ 0 ; keyboard triggering sensitivity bit 173 ; 0000 174 intkbier equ $21 ; Keyboard Interrupt Enable Register 0000 175 KBICR EQU $0021 0000 176 KBIE4 equ 4 0000 177 KBIE3 equ 3 0000 178 KBIE2 equ 2 0000 179 KBIE1 equ 1 0000 180 KBIE0 equ 0 181 182 183 ;* Clock Generator Module (CGMC) ***************** ************************* 184 0000 185 pctl equ $1C ; PLL Control Register 0000 186 PLLIE equ 7 ; PLL Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 6 interrupt enable bit 0000 187 PLLF equ 6 ; PLL interrupt flag bit 0000 188 PLLON equ 5 ; PLL on bit 0000 189 BCS equ 4 ; base clock select bit 190 ; 0000 191 pbwc equ $1D ; PLL Bandwidth Control Register 0000 192 AUTO equ 7 ; automatic bandwidth control bit 0000 193 LOCK equ 6 ; lock indicator bit 0000 194 ACQ equ 5 ; acquisitio n mode bit 195 0000 196 PPG equ $001E ; PLL Programmin g Register 197 ; Multiplier Select bits [7:4] 198 ; VCO Frequency Multiplier bit [3:0] 199 200 ;* Configuration Registers (CONFIG) ************** ************************* 201 0000 202 CONFIG EQU $001F ; System configuration 0000 203 CONFIG1 EQU $001F 0000 204 CONFIG2 EQU $003F 205 0000 206 TASC EQU $0020 ; Timer A 0000 207 TACNTH EQU $0022 0000 208 TACNTL EQU $0023 0000 209 TAMODH EQU $0024 0000 210 TAMODL EQU $0025 0000 211 TASC0 EQU $0026 0000 212 TACH0H EQU $0027 0000 213 TACH0L EQU $0028 0000 214 TASC1 EQU $0029 0000 215 TACH1H EQU $002A 0000 216 TACH1L EQU $002B 0000 217 TASC2 EQU $002C 0000 218 TACH2H EQU $002D 0000 219 TACH2L EQU $002E 0000 220 TASC3 EQU $002F 0000 221 TACH3H EQU $0030 0000 222 TACH3L EQU $0031 223 0000 224 TBSC EQU $0041 ; Timer B 0000 225 TBCNTH EQU $0042 0000 226 TBCNTL EQU $0043 0000 227 TBMODH EQU $0044 0000 228 TBMODL EQU $0045 0000 229 TBSC0 EQU $0046 0000 230 TBCH0H EQU $0047 0000 231 TBCH0L EQU $0048 0000 232 TBSC1 EQU $0049 0000 233 TBCH1H EQU $004A Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 7 0000 234 TBCH1L EQU $004B 0000 235 TBSC2 EQU $0032 0000 236 TBCH2H EQU $0033 0000 237 TBCH2L EQU $0034 0000 238 TBSC3 EQU $0035 0000 239 TBCH3H EQU $0036 0000 240 TBCH3L EQU $0037 241 0000 242 TSC EQU $004B ; Timer 0000 243 TCNTH EQU $004C 0000 244 TCNTL EQU $004D 0000 245 TMODH EQU $004E 0000 246 TMODL EQU $004F 247 248 249 250 ;* Analog-to-Digital Converter (ADC) ************* ************************* 251 0000 252 adscr equ $38 ; ADC Status and Control Register 0000 253 COCO equ 7 ; conversion s complete flag 0000 254 AIEN equ 6 ; ADC interrupt enable bit 0000 255 ADCO equ 5 ; ADC continuous conversion bit 0000 256 ADCH4 equ 4 ; \ 0000 257 ADCH3 equ 3 ; \ 0000 258 ADCH2 equ 2 ; ADC channel select bits 0000 259 ADCH1 equ 1 ; / 0000 260 ADCH0 equ 0 ; / 261 0000 262 adr equ $39 ; ADC Data Register 263 0000 264 adclk equ $3A ; ADC Clock Register 0000 265 ADIV2 equ 7 ; \ 0000 266 ADIV1 equ 6 ; ADC clock prescaler bits 0000 267 ADIV0 equ 5 ; / 0000 268 ADICLK equ 4 ; ADC input clock select bit 269 270 ;* Pullup Registers ******************************* ******* 271 0000 272 PTDPUE EQU $003D 0000 273 PTFPUE EQU $003E 0000 274 PRTFPU EQU $003E 275 276 ;* System Integration Module (SIM) *************** ************************* 277 0000 278 sbsr equ $FE00 ; SIM Break Status Register Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 8 0000 279 SBSW equ 1 ; SIM break stop/wait 280 0000 281 srsr equ $FE01 ; SIM Reset Status Register 0000 282 POR equ 7 ; power-on reset bit 0000 283 PIN equ 6 ; external reset bit 0000 284 COP equ 5 ; COP reset bit 0000 285 ILOP equ 4 ; illegal opcode reset bit 0000 286 ILAD equ 3 ; illegal opcode address reset bit 287 ;MODRST equ 2 ; monitor mode entry module reset bit 0000 288 LVI equ 1 ; LVI reset bit 289 0000 290 sbfcr equ $FE03 ; SIM Break Flag Control Register 0000 291 BCFE equ 7 ; break clear flag enable bit 292 293 ;* Flash Memory ********************************** ************************* 294 0000 295 flcr equ $FE08 ; Flash Control Register 0000 296 HVEN equ %00001000 ; high-voltage enable bit mask 0000 297 MASS equ %00000100 ; mass erase control bit mask 0000 298 ERASE equ %00000010 ; erase control bit mask 0000 299 PGM equ %00000001 ; program control bit mask 300 0000 301 flbpr equ $FF7E ; Flash Block Protect Register 302 303 ;* Breakpoint Module (BRK) *********************** ************************* 304 0000 305 brkh equ $FE0C ; Break Address Register High 0000 306 brkl equ $FE0D ; Break Address Register Low 0000 307 brkscr equ $FE0E ; Break Status and Control Register 0000 308 BRKE equ 7 ; break enable bit 0000 309 BRKA equ 6 ; break active bit 310 311 ;* Low-Voltage Inhibit (LVI) ********************* ************************* Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 9 312 0000 313 lvisr equ $FE0F ; LVI Status Register 0000 314 LVIOUT equ 7 ; LVI output bit 315 316 ;* EEPROM programming registers ******************* *************************** 317 0000 318 EEDIVHNVR equ $FE10 319 0000 320 EEDIVLNVR equ $FE11 321 0000 322 EEDIVH equ $FE1A 323 0000 324 EEDIVL equ $FE1B 325 0000 326 eenvr equ $FE1C ;EEPROM Array Config Reg 0000 327 EEPRTCT equ 16 ;protection bit 0000 328 EEBP3 equ 8 ;block potection bit 3 0000 329 EEBP2 equ 4 ;block potection bit 2 0000 330 EEBP1 equ 2 ;block potection bit 1 0000 331 EEBP0 equ 1 ;block potection bit 0 332 0000 333 eecr equ $FE1D ;EEPROM Control Reg 0000 334 EEDUM equ 128 ;dummy bit 0000 335 EEOFF equ 32 ;power off 0000 336 EERAS1 equ 16 ;erase/program mode select bit 1 0000 337 EERAS0 equ 8 ;erase/program mode select bit 0 0000 338 EELAT equ 4 ;latch control 0000 339 EEAUTO equ 2 ;automatic termination of prgm/erase cycle 0000 340 EEPGM equ 1 ;program/erase enable 341 0000 342 EEACR equ $FE1F 343 344 ;* Computer Operating Properly (COP) ************* ************************* 345 0000 346 copctl equ $FFFF ; COP Control Register 347 348 ;*************************************************** ********* 349 ; VECTORS Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 10 350 ;*************************************************** ********* 351 0000 352 dbg_vectors equ $FAD0 ; Debug Vectors 353 0000 354 Vectors: equ $ffd0 355 0000 356 ivadc: equ $ffd0 ; Vector for A/D conversion Complete 0000 357 ivkey: equ $ffd2 ; Vector for Keyboard 0000 358 ivsctx: equ $ffd4 ; Vector for SCI Tx 0000 359 ivscrx: equ $ffd6 ; Vector for SCI Rx 0000 360 ivscer: equ $ffd8 ; Vector for SCI Error 0000 361 equ $ffda ; Reserved 0000 362 equ $ffdc ; Reserved 0000 363 ivtb3: equ $ffde ; TIMB Channel 3 Vector 0000 364 ivtb2: equ $ffe0 ; TIMB Channel 2 Vector 0000 365 ivsptx: equ $ffe2 ; Vector for SPI Tx 0000 366 ivsprx: equ $ffe4 ; Vector for SPI Rx 0000 367 ivtbof: equ $ffe6 ; TIMB Overflow Vector 0000 368 ivtb1: equ $ffe8 ; TIMB Channel 1 Vector 0000 369 ivtb0: equ $ffea ; TIMB Channel 0 Vector 0000 370 ivtao: equ $ffec ; TIMA Overflow Vector 0000 371 ivt1c1: equ $ffee ; TIMA Channel 3 Vector 0000 372 ivta2: equ $fff0 ; TIMA Channel 2 Vector 0000 373 ivta1: equ $fff2 ; TIMA Channel 1 Vector 0000 374 ivta0: equ $fff4 ; TIMA Channel 0 Vector 0000 375 ivtof: equ $fff6 ; TIM Overflow Vector 0000 376 ivpll: equ $fff8 ; PLL Vector 0000 377 ivirq: equ $fffa ; ~IRQ1 Vector 0000 378 ivswi: equ $fffc ; SWI Vector 0000 379 ivrst: equ $fffe ; Reset Vector 380 381 382 ;*************************************************** ********* 383 ;* Memory Map 384 ;*************************************************** ********* 385 0000 386 ram_start equ $0050 ; start of RAM 0000 387 zpage_end equ $00FF ; End of zero page ram 0000 388 extraram equ $0100 ; Start of Extra RAM Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 11 0000 389 usr_stack equ $01ff ; Bottom of user stack 0000 390 ram_last equ $023F ; last RAM location 0000 391 rom_start equ $8000 ; start of ROM 0000 392 rom_last equ $FAFF ; last ROM location ($FDFF??) 393 394 395 ;(C)opywrite P&E Microcomputer Systems, 2000 (www.pemicro.com) 396 ; You may use this code freely as long as this copyright notice 397 ; and website address is included and un-modified. 398 0000 399 include "../macros.asm" ;Macro instruction definition 400 ; -------------------------------------------------- ----------------- 401 ; Macro Definitions 402 ; -------------------------------------------------- ----------------- 403 0000 404 #macro aax macro 405 psha 406 pshx 407 add 1,sp 408 pulx 409 tax 410 bcc *+7 ; Branch to below 411 pshh 412 inc 1,sp 413 pulh 414 ; Branch to here 415 pula 0000 416 #macroend 417 0000 418 #macro inch macro 419 pshh 420 inc 1,sp 421 pulh 0000 422 #macroend 423 0000 424 #macro tha macro 425 pshh 426 pula 0000 427 #macroend 428 0000 429 #macro tah macro 430 psha 431 pulh 0000 432 #macroend 433 0000 434 #macro pshhx macro 435 pshx 436 pshh 0000 437 #macroend 438 Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 12 0000 439 #macro pulhx macro 440 pulh 441 pulx 0000 442 #macroend 443 0000 444 #macro ldhxx macro 445 lda ,x 446 ldx 1,x 447 psha 448 pulh 0000 449 #macroend 450 0000 451 include "../local.asm" ;Local system variables 452 ; 453 ; Conditional Assembly Directives *************** ************************* 454 ; 455 0000 456 #setnot HYPERTERM ; enable slow Hyperterminal communications 457 458 ; 459 ; Microcontroller Peripheral Equates ************ ************************* 460 ; 461 0000 462 boot_start equ $E000 ; start of protected Bootloader 0000 463 flash_protect equ {(boot_start>7)&$FF} ; Flash Block Protect Reg value 0000 464 flash_page equ 128T ; Flash Erase Page size 465 0000 466 init_config1 equ %00000011 ; initial Configurat ion Register 1 467 ; Bit_7=0 - LVISTOP - LVI disabled during stop mode 468 ; Bit_6 unused 469 ; Bit_5=0 - LVIRSTD - LVI reset enabled during run mode 470 ; Bit_4=0 - LVIPWRD - Power enabled to LVI module 471 ; Bit_3=0 - SSREC - Stop recovery after 4096 cycles 472 ; Bit_2=0 - COPRS - COP rate (2**18 - 2**4) 473 ; Bit_1=1 - STOP - Stop Instruction disabled 474 ; Bit_0=1 - COPD - COP Disabled 475 ; 0000 476 RXBLEN equ 14T ; Serial I/O Receive buffer length 0000 477 STACK_ALLOC equ 32T ; Monitor Stack Allocation 478 ; 0000 479 init_scc1 equ %01000000 ; enable SCI, 8-bits, no par, 1 stop Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 13 0000 480 init_scc2 equ %00001100 ; no interupts, rcvr and tmtr enabled 0000 481 init_scbr equ %00000011 ; set SCI for 9600 baud 482 ; 483 ; ASCII character definitions 484 0000 485 SPACE equ $20 ; ASCII space 0000 486 CR equ $0D ; ASCII carriage return 0000 487 LF equ $0A ; ASCII linefeed 0000 488 NUL equ $00 ; ASCII linefeed 0000 489 BS equ $08 ; ASCII Backspace key 0000 490 XOFF equ $13 ; ASCII X-Off key (^S or DC3) 0000 491 XON equ $11 ; ASCII X-On key (^S or DC1) 0000 492 ESC equ $1B ; ASCII Escape Character 493 494 ;--------------------------------------------------- ---- 495 ; TIMING FOR fbus = 0.407 us 496 ;the internal clock fBUS runs at 1/2.4576 ^6 = 0.407 uS. 497 ;The DBNZ instruction takes 3 cycles, which makes 1.22 uS 498 ;us5 EQU 5 ;5 * 1.22 = 6.1 uS 499 ;us10 EQU 9 ;9 * 1.22 = 10.9 uS 500 ;us30 EQU 25 ;25 * 1.22 = 30.5 uS 501 ;us100 EQU 82 ;82 * 1.22 = 100 502 ;ms1 EQU 10 ;10 * 82 * 1.22 = 1.00 mS 503 504 ;--------------------------------------------------- ----- 505 ; TIMING FOR fbus = 0.115 us 506 ;The DBNZ instruction takes 3 cycles, which makes 0.344 uS 0000 507 us1 EQU 3 ;3 * 0.344 = 1.032 uS 0000 508 us5 EQU 18 ;18 * 0.344 = 6.1 uS 0000 509 us10 EQU 32 ;32 * 0.344 = 10.9 uS 0000 510 us30 EQU 89 ;89 * 0.344 = 30.5 uS 0000 511 us50 EQU 148 ;148 * 0.344 = 51 us 0000 512 ms1 EQU 36 ;36 * 82 * 0.344 = 1.00 mS 513 0000 514 tpgs EQU us5 ;times taken from MC68HC908AB32/D rev 1 0000 515 tnvs EQU us10 0000 516 tprog EQU us30 0000 517 tnvh EQU us5 0000 518 terase EQU ms1 519 0000 520 RAMStart equ $0053 ;User App RAM is Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 14 from 53 to 3FF. (HCmon RAM from 400-44F) 0000 521 EEPROM equ $800 ;EEPROM mem is 800-9FF (512 bytes) 0000 522 RomStart equ $8000 ;Flash mem is 8000 to FFFF (32 MB) 523 524 ;Port A pin usage 0000 525 LCD_e equ 3 ;LCD enable = bit 3 of porta 0000 526 LCD_rw equ 2 ;LCD read/write. 0=write, 1=read 0000 527 LCD_rs equ 1 ;LCD register select. 0=instruction, 1=data 528 529 ;Port B pin usage 0000 530 Reflect-FWD equ 2 ;Reflectometer Forward Voltage 0000 531 Reflect-REF equ 1 ;Reflectometer Reflected Voltage 0000 532 Reflect-Z equ 0 ;Reflectometer Impedance Voltage 533 534 ;Port C Usage 0000 535 Dah equ 5 ;Dah paddle input 0000 536 Dit equ 2 ;Dit paddle input 0000 537 FreqCntr equ 0 ;Frequency counter input 538 539 ;Port D pin usage 0000 540 Tones equ 2 ;Tones signal to audio amp 0000 541 Keyline equ 0 ;Keyline control to transmitter 542 543 ;Port E Usage 0000 544 Piezo equ 2 ;Piezo sounder 0000 545 RxData equ 1 ;serial port receive 0000 546 TxData equ 0 ;serial port transmit 547 548 ;PortF pin usage 0000 549 Mon_Jumper equ 7 ;Monitor jumper 0000 550 HeartbeatLED equ 6 ;Heartbeat LED 0000 551 ENC_A equ 5 ;Encoder-A pin 0000 552 ENC_B equ 4 ;Encoder-B pin 0000 553 ENC_pb equ 3 ;Encoder-Pushbutto n pin 0000 554 DDS_load equ 2 ;DDS load pin 0000 555 DDS_clk equ 1 ;DDS clock pin 0000 556 DDS_data equ 0 ;DDS data pin 557 0053 558 org RamStart 559 0053 560 _hbufpos rmb 2 ;buffer position temp storage 561 562 ;three 1ms Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 15 timeout counters used in TACH1 Timer ISR 0055 563 Timeout1 ds 1 ;8-bit timeout counter used for HeartBeat LED 0056 564 Timeout2 ds 2 ;16-bit timeout counter used for PIezo tones (and Keyer output) 0058 565 Timeout3 ds 3 ;16-bit timeout counter is undedicated (for general purpose) 566 005B 567 Enc_tens ds 1 ;encoder display digit (tens) 005C 568 Enc_units ds 1 ;encoder display digit (ones) 569 005D 570 LCD_timer ds 1 ;counter for timeout check in LCD busy_check 005E 571 LCD_read ds 1 ;temp store for status read in LCD busy_check 005F 572 LCD_char ds 1 ;temp for LCD data written (cmnd2LCD & data2LCD) 0060 573 temp1 ds 1 ;temp store used in write_LCD 0061 574 temp2 ds 1 575 0062 576 temp ds 1 ;temp used in EEPROM driver 577 0063 578 enc_new ds 1 ;new reading of encoder 0064 579 enc_old ds 1 ;last reading of encoder 0065 580 enc_temp ds 1 ;temp location for encoder bits 0066 581 A_flag ds 1 ;enc line A hi/lo status 0067 582 B_flag ds 1 ;enc line B hi/lo status 583 0068 584 a2d_last ds 1 ;previous A/D reading 0069 585 a2d_lasta ds 1 ;previous A/D reading + 1 006A 586 a2d_lastb ds 1 ;previous A/D reading - 1 587 006B 588 bit_count ds 1 ;DDS bit counter 006C 589 byte_count ds 1 ;DDS byte counter 006D 590 byte2send ds 1 ;DDS byte to send 006E 591 DDS_w4 ds 1 ;DDS programming register W4 (freq-b7 ... freq-b0) 006F 592 DDS_w3 ds 1 ;DDS programming register W3 (freq-b15 ... freq-b8) 0070 593 DDS_w2 ds 1 ;DDS programming register W2 (freq-b23 ... freq-b16) 0071 594 DDS_w1 ds 1 ;DDS programming register W1 (freq-b31 ... freq-b24) 0072 595 DDS_w0 ds 1 ;DDS programming register W0 (phase-b4 ... control-0) 596 Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 16 0073 597 count_lo ds 1 0074 598 count_hi ds 1 0075 599 to_addr ds 2 ;index pointer storage locs 0077 600 from_addr ds 2 601 0079 602 EEbyte_count ds 1 ;EEPROM byte counter 007A 603 EEline_count ds 1 ;EEPROM line counter 604 040A 605 org $040A ;common "_inbuf" buffer with HCmon 040A 606 _inbuf rmb RXBLEN ;Input Buffer 607 8000 608 org RomStart 609 610 ;*************************************************** *********************** 611 ; Vector Jump Table (located at start of User Area = 8000) 612 ;*************************************************** *********************** 613 8000 [03] CC879A 614 _user_adc jmp Dummy_ISR ; Insert jump to ADC vector code 8003 [03] CC879A 615 _user_keyboard jmp Dummy_ISR ; Insert jump to Keyboard vector code 8006 [03] CC879A 616 _user_scitx jmp Dummy_ISR ; Insert jump to SCI transmit vector code 8009 [03] CC879A 617 _user_scirx jmp Dummy_ISR ; Insert jump to SCI receive vector code 800C [03] CC879A 618 _user_scierr jmp Dummy_ISR ; Insert jump to SCI error vector code 800F [03] CC879A 619 _user_timbch3 jmp Dummy_ISR ; Insert jump to TIMB Channel 3 Vector code 8012 [03] CC879A 620 _user_timbch2 jmp Dummy_ISR ; Insert jump to TIMB Channel 2 Vector code 8015 [03] CC879A 621 _user_spitx jmp Dummy_ISR ; Insert jump to SPI transmit vector code 8018 [03] CC879A 622 _user_spirx jmp Dummy_ISR ; Insert jump to SPI receive vector code 801B [03] CC879A 623 _user_timb_of jmp Dummy_ISR ; Insert jump to TIMB Overflow Vector code 801E [03] CC879A 624 _user_timb_ch1 jmp Dummy_ISR ; Insert jump to TIMB Channel 1 Vector code 8021 [03] CC879A 625 _user_timb_ch0 jmp Dummy_ISR ; Insert jump to TIMB Channel 0 Vector code 8024 [03] CC879A 626 _user_tima_of jmp Dummy_ISR ; Insert jump to TIMA Overflow Vector code 8027 [03] CC879A 627 _user_tima_ch3 jmp Dummy_ISR ; Insert jump to TIMA Channel 3 Vector code 802A [03] CC879A 628 _user_tima_ch2 jmp Dummy_ISR ; Insert jump to TIMA Channel 2 Vector code 802D [03] CC873B 629 _user_tima_ch1 jmp T_ISR_A1 ; Insert jump to TIMA Channel 1 Vector code 8030 [03] CC877E 630 _user_tima_ch0 jmp T_ISR_A0 ; Insert jump to TIMA Channel 0 Vector code Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 17 8033 [03] CC879A 631 _user_tim_of jmp Dummy_ISR ; Insert jump to TIM Overflow Vector code 8036 [03] CC879A 632 _user_pll jmp Dummy_ISR ; Insert jump to PLL Vector code 8039 [03] CC879A 633 _user_irq jmp Dummy_ISR ; Insert jump to ~IRQ1 Vector code 634 803C [03] CC868F 635 _HCmon_LCD_disp jmp HCmon_LCD_disp ; vector (at $803C) for HCmon 636 ; to display message to LCD 637 638 ;*************************************************** *********************** 639 ;********************** USER APP ENTRY POINT ********************* 640 ;*************************************************** *********************** 641 ; This is the point ($8040) where User Code starts executing * 642 ; after coming from the Monitor "X" command (eXecute User App) * 643 ; or after board gets a RESET (when Monitor jumper is off) * 644 ;*************************************************** *********************** 645 8040 646 org $8040 647 648 Start: 8040 [02] 9B 649 sei ;disable all interrupts 8041 [03] 4501FF 650 ldhx #$01FF ;initialize 8044 [02] 94 651 txs ; the stack pointer (why not 3FF?) 652 653 ;configure the output ports 8045 [04] 6EFC0C 654 mov #$FC,ddre ;set port E7-E2 as outputs 8048 [04] 6E470D 655 mov #$47,ddrf ;set port F6, F2-F0 as outputs 804B [04] 6EFE05 656 mov #$FE,ddrb ;set port B7-B1 as outputs 804E [04] 6E030F 657 mov #$03,ddrh ;set port H1-H0 as outputs 8051 [04] 6E070E 658 mov #$07,ddrg ;set port G2-G0 as outputs 8054 [04] 6EFF07 659 mov #$FF,ddrd ;set port D7-D0 as outputs 8057 [04] 6E1006 660 mov #$10,ddrc ;set port C4 as output 661 662 ;initialize the output ports 805A [04] 6EFF01 663 mov #$FF,portb 805D [04] 6EFF02 664 mov #$FF,portC 8060 [04] 6EFF03 665 mov #$FF,portd 8063 [04] 6EFF08 666 mov #$FF,porte 8066 [04] 6EFF0A 667 mov #$FF,portg Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 18 8069 [04] 6EFF0B 668 mov #$FF,porth 806C [04] 1409 669 bset 2,portF 806E [04] 1209 670 bset 1,portf 8070 [04] 1009 671 bset 0,portf 672 8072 [03] B609 673 lda portf ;get initial encoder position 8074 [02] A430 674 and #$30 ;isolate the encoder bits 8076 [03] B764 675 sta enc_old ;initialize encoder old value 8078 [03] B763 676 sta enc_new ;initialize encoder new value 677 807A [04] 6EFF66 678 mov #$FF,A_flag 807D [04] 6EFF67 679 mov #$FF,B_flag 680 8080 [05] CD872B 681 jsr Init_Timer 8083 [05] CD89ED 682 jsr Init_EEPROM 8086 [03] 3F55 683 clr timeout1 ;init timeouts (0=off) 8088 [03] 3F56 684 clr timeout2 808A [03] 3F57 685 clr timeout2+1 ;(timeout2 is 2-byte value) 808C [03] 3F58 686 clr timeout3 687 808E [02] 9A 688 cli ;allow interrupts to happen 689 690 ;*************************************************** *********************** 691 ;***************** USER APPPLICATION MAINLINE ******************* 692 ;*************************************************** *********************** 693 694 User_Main: 808F [04] 6E0355 695 mov #3,timeout1 ;I'm not sure why this is needed (but it is!) 8092 [05] CD88B3 696 jsr LCD_init 8095 [05] CD86E1 697 jsr wait100ms 8098 [04] C7FFFF 698 sta copctl ;clear the COP counter 809B [02] A664 699 lda #100 809D [05] CD86C4 700 jsr delay 701 80A0 [03] 4580D7 702 ldhx #ExerciserBanner 80A3 [05] CD8AA1 703 jsr _puts ;print Exerciser Banner message 80A6 [05] CD890E 704 jsr LCD_clear ;clear the LCD 80A9 [05] CD86EA 705 jsr Wait64ms 80AC [03] 458144 706 ldhx #ExerciserMsg 80AF [05] CD896F 707 jsr disp_msg 708 80B2 [03] 45810B 709 um1: ldhx #Prompt 80B5 [05] CD8AA1 710 jsr _puts ;print prompt ("Exerciser> ") Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 19 80B8 [05] CD8A59 711 jsr _gets ;get an input string 80BB [03] 25F5 712 bcs um1 ;not valid char (ctl+C or ESC), try again 80BD [04] C6040A 713 lda _inbuf ;get the character 80C0 [03] 27F0 714 beq um1 ;nothing entered (just ENTER), try again 80C2 [02] A4DF 715 and #$DF ;turn to capital letter 80C4 [03] 458153 716 ldhx #_cmdtab ;point to the command table 80C7 [05] CD8AA7 717 jsr _get_atbl ;get the routine corresponding to the menu entry 80CA [03] 2403 718 bcc um2 ;menu item not recognized, print error and try again 80CC [04] FD 719 jsr ,x ;call the selected menu routine 80CD [03] 20E3 720 bra um1 ;go get another command 721 80CF [03] 45813C 722 um2: ldhx #Err_Msg ;"What?" 80D2 [05] CD8AA1 723 jsr _puts 80D5 [03] 20DB 724 bra um1 725 80D7 0D0A0D0A 726 ExerciserBanner: fcb CR,LF,CR,LF,'~~ Digital Breadboard Exerciser v2.0 N2APB ~~',CR,LF,0 7E7E2044 69676974 616C2042 72656164 626F6172 64204578 65726369 73657220 76322E30 204E3241 5042207E 7E0D0A00 810B 0D0A0D0A 727 Prompt: fcb CR,LF,CR,LF,'Excerciser 2.0 (D,S,L,V,Y,E,W,P,R,T,A,X,H) >',0 45786365 72636973 65722032 2E302028 442C532C 4C2C562C 592C452C 572C502C 522C542C 412C582C 4829203E 00 813C 0D0A5768 728 Err_Msg: fcb CR,LF,'What?',0 61743F00 8144 45786572 729 ExerciserMsg: fcb 'Exerciser v2.0',0 63697365 72207632 Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 20 2E3000 730 731 ;*************************************************** ***************** 732 ;**************** COMMAND LOOKUP TABLE ***************** 733 ;*************************************************** ***************** 734 _cmdtab: 8153 44 735 fcb 'D' 8154 8178 736 fdb DDS 8156 53 737 fcb 'S' 8157 81AC 738 fdb Shaft_Encoder 8159 4C 739 fcb 'L' 815A 8271 740 fdb LED_Port_Test 815C 59 741 fcb 'Y' 815D 84AE 742 fdb Display_Test 815F 45 743 fcb 'E' 8160 8428 744 fdb Erase_EEPROM 8162 57 745 fcb 'W' 8163 845B 746 fdb Write_EEPROM 8165 52 747 fcb 'R' 8166 83E7 748 fdb Read_EEPROM 8168 50 749 fcb 'P' 8169 8359 750 fdb Piezo_Beep 816B 54 751 fcb 'T' 816C 83B7 752 fdb Timing_Test 816E 41 753 fcb 'A' 816F 8507 754 fdb ADC_Test 8171 48 755 fcb 'H' 8172 857A 756 fdb Help 8174 58 757 fcb 'X' 8175 8578 758 fdb Monitor 8177 00 759 fcb NUL 760 Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 21 8178 761 $page 762 ;*************************************************** ***************** 763 ;***************** COMMAND PROCESSORS ***************** 764 ;*************************************************** ***************** 765 766 ;------------------------ 767 ; DDS -- Command 'D' 768 ;------------------------ 769 DDS: 8178 [03] 458191 770 ldhx #Freq_Msg ;"DDS Freq set to 10 MHz" 817B [05] CD8AA1 771 jsr _puts ;put string to serial terminal 817E [04] 6E016E 772 mov #$01,DDS_w4 ;test DDS programming data 8181 [04] 6EEE6F 773 mov #$EE,DDS_w3 8184 [04] 6E0970 774 mov #$09,DDS_w2 8187 [04] 6E0071 775 mov #$00,DDS_w1 818A [04] 6E0072 776 mov #$00,DDS_w0 818D [05] CD879C 777 jsr set_dds ;set the DDS 8190 [04] 81 778 rts 779 780 Freq_Msg: 8191 0D0A2020 781 fcb CR,LF,' DDS Freq set to 10 MHz',0 44445320 46726571 20736574 20746F20 3130204D 487A00 782 783 ;------------------------------ 784 ; Shaft Encoder -- Command 'S' 785 ;------------------------------ 786 Shaft_Encoder: 81AC [03] 4581DF 787 ldhx #Enc_Msg ;"Shaft Encoder (Special)" 81AF [05] CD8AA1 788 jsr _puts ;put string to serial terminal 81B2 [05] CD890E 789 jsr LCD_Clear 81B5 [05] CD86EA 790 jsr Wait64ms 81B8 [05] CD893D 791 jsr ClearLCDLine2 81BB [05] CD86EA 792 jsr Wait64ms 81BE [02] A6C0 793 lda #$C0 ;point to 2nd line on LCD 81C0 [05] CD8834 794 jsr Cmnd2LCD 81C3 [03] 45820D 795 ldhx #EncoderMsg 81C6 [05] CD896F 796 jsr Disp_Msg 81C9 [04] 6E305B 797 mov #$30,enc_tens ;init the turns counter 81CC [04] 6E305C 798 mov #$30,enc_units 81CF [05] CD87C4 799 se1: jsr Do_Special_Encoder ;process the encoder turns 81D2 [03] 2605 800 bne se2 Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 22 81D4 [05] CD821A 801 jsr decrease_digit_display ;CCW turn detected 81D7 [03] 20F6 802 bra se1 81D9 [05] CD823B 803 se2: jsr increase_digit_display ;CW turn detected 81DC [03] 20F1 804 bra se1 81DE [04] 81 805 rts 806 807 Enc_Msg: 81DF 0D0A2020 808 fcb CR,LF,' Shaft Encoder (Special) - to exit',0 53686166 7420456E 636F6465 72202853 70656369 616C2920 2D203C72 65736574 3E20746F 20657869 7400 809 EncoderMsg: 820D 456E636F 810 fcb 'Encoder = 00',0 64657220 3D203030 00 811 812 ;----------------------- 813 ;encoder turned down (ccw) 814 815 Decrease_Digit_Display: 821A [04] 3A5C 816 dec enc_units ;decrement units digit 821C [02] A62F 817 lda #$2F ;units at min? 821E [03] B15C 818 cmp enc_units 8220 [03] 2702 819 beq dwn1a ;yes, roll down 8222 [03] 2013 820 bra dwn1b ;no,just continue 821 8224 [04] 6E395C 822 dwn1a: mov #$39,enc_units ;roll down units to 9 8227 [04] 3A5B 823 dec enc_tens ;and decr tens 8229 [02] A62F 824 lda #$2F 822B [03] B15B 825 cmp enc_tens ;tens at min? 822D [03] 2702 826 beq dwn1c ;yes, reset cntr to 00 822F [03] 2006 827 bra dwn1b ;no, just continue 828 8231 [02] A639 829 dwn1c: lda #$39 8233 [03] B75C 830 sta enc_units ;reset tens to zero 8235 [03] B75B 831 sta enc_tens ; and units to zero 832 8237 [05] CD825C 833 dwn1b: jsr update_digits ;update Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 23 counter digits 823A [04] 81 834 rts 835 836 ;----------------------------------- 837 ;encoder turned up (cw) 838 839 Increase_Digit_Display: 823B [04] 3C5C 840 inc enc_units ;increment units digit 823D [02] A63A 841 lda #$3A ;units at max? 823F [03] B15C 842 cmp enc_units 8241 [03] 2702 843 beq up1a ;yes, roll over 8243 [03] 2013 844 bra up1b ;no, just continue 845 8245 [04] 6E305C 846 up1a: mov #$30,enc_units ;roll over units to zero 8248 [04] 3C5B 847 inc enc_tens ;and bump tens 824A [02] A63A 848 lda #$3A ;tens at max? 824C [03] B15B 849 cmp enc_tens 824E [03] 2702 850 beq up1c ;yes, reset cntr to 00 8250 [03] 2006 851 bra up1b ;no, just continue 852 8252 [02] A630 853 up1c: lda #$30 8254 [03] B75C 854 sta enc_units ;reset tens to zero 8256 [03] B75B 855 sta enc_tens ; and units to zero 856 8258 [05] CD825C 857 up1b: jsr update_digits ;update counter digits 825B [04] 81 858 rts 859 860 ;------------- 861 update_digits: 825C [02] A6CA 862 lda #$CA ;point to tens digit on 2nd line 825E [05] CD8834 863 jsr Cmnd2LCD 8261 [03] B65B 864 lda enc_tens ;send the tens digit there 8263 [05] CD8846 865 jsr Data2LCD 8266 [02] A6CB 866 lda #$CB ;point to units digit on 2nd line 8268 [05] CD8834 867 jsr Cmnd2LCD 826B [03] B65C 868 lda enc_units ;send the units digit there 826D [05] CD8846 869 jsr Data2LCD 8270 [04] 81 870 rts 871 872 ;------------------------------ 873 ; LED Port Test -- Command 'L' 874 ;------------------------------ 875 LED_Port_Test: 8271 [03] 458347 876 ldhx #LED_Msg ;"LED Port Test" Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 24 8274 [05] CD8AA1 877 jsr _puts ;put string to serial terminal 878 8277 [04] 1902 879 bclr 4,portc 8279 [05] CD8343 880 jsr Wait_LED 827C [04] 1802 881 bset 4,portc 827E [04] 1509 882 bclr 2,portf 8280 [05] CD8343 883 jsr Wait_LED 8283 [04] 1409 884 bset 2,portf 8285 [04] 1309 885 bclr 1,portf 8287 [05] CD8343 886 jsr Wait_LED 828A [04] 1209 887 bset 1,portf 828C [04] 1109 888 bclr 0,portf 828E [05] CD8343 889 jsr Wait_LED 8291 [04] 1009 890 bset 0,portf 8293 [04] 130A 891 bclr 1,portg 8295 [05] CD8343 892 jsr Wait_LED 8298 [04] 120A 893 bset 1,portg 829A [04] 110A 894 bclr 0,portg 829C [05] CD8343 895 jsr Wait_LED 829F [04] 100A 896 bset 0,portg 82A1 [04] 1F08 897 bclr 7,porte 82A3 [05] CD8343 898 jsr Wait_LED 82A6 [04] 1E08 899 bset 7,porte 82A8 [04] 1D08 900 bclr 6,porte 82AA [05] CD8343 901 jsr Wait_LED 82AD [04] 1C08 902 bset 6,porte 82AF [04] 1303 903 bclr 1,portd 82B1 [05] CD8343 904 jsr Wait_LED 82B4 [04] 1203 905 bset 1,portd 82B6 [04] 150A 906 bclr 2,portg 82B8 [05] CD8343 907 jsr Wait_LED 82BB [04] 140A 908 bset 2,portg 82BD [04] 1301 909 bclr 1,portb 82BF [05] CD8343 910 jsr Wait_LED 82C2 [04] 1201 911 bset 1,portb 82C4 [04] 1701 912 bclr 3,portb 82C6 [05] CD8343 913 jsr Wait_LED 82C9 [04] 1601 914 bset 3,portb 82CB [04] 1B01 915 bclr 5,portb 82CD [05] CD8343 916 jsr Wait_LED 82D0 [04] 1A01 917 bset 5,portb 82D2 [04] 1F01 918 bclr 7,portb 82D4 [05] CD8343 919 jsr Wait_LED 82D7 [04] 1E01 920 bset 7,portb 82D9 [04] 1501 921 bclr 2,portb 82DB [05] CD8343 922 jsr Wait_LED 82DE [04] 1401 923 bset 2,portb 82E0 [04] 1901 924 bclr 4,portb 82E2 [05] CD8343 925 jsr Wait_LED 82E5 [04] 1801 926 bset 4,portb 82E7 [04] 1D01 927 bclr 6,portb 82E9 [05] CD8343 928 jsr Wait_LED 82EC [04] 1C01 929 bset 6,portb 82EE [04] 1103 930 bclr 0,portd 82F0 [05] CD8343 931 jsr Wait_LED 82F3 [04] 1003 932 bset 0,portd 82F5 [04] 1703 933 bclr 3,portd Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 25 82F7 [05] CD8343 934 jsr Wait_LED 82FA [04] 1603 935 bset 3,portd 82FC [04] 1503 936 bclr 2,portd 82FE [05] CD8343 937 jsr Wait_LED 8301 [04] 1403 938 bset 2,portd 8303 [04] 110B 939 bclr 0,porth 8305 [05] CD8343 940 jsr Wait_LED 8308 [04] 100B 941 bset 0,porth 830A [04] 1903 942 bclr 4,portd 830C [05] CD8343 943 jsr Wait_LED 830F [04] 1803 944 bset 4,portd 8311 [04] 1D03 945 bclr 6,portd 8313 [05] CD8343 946 jsr Wait_LED 8316 [04] 1C03 947 bset 6,portd 8318 [04] 130B 948 bclr 1,porth 831A [05] CD8343 949 jsr Wait_LED 831D [04] 120B 950 bset 1,porth 831F [04] 1B03 951 bclr 5,portd 8321 [05] CD8343 952 jsr Wait_LED 8324 [04] 1A03 953 bset 5,portd 8326 [04] 1F03 954 bclr 7,portd 8328 [05] CD8343 955 jsr Wait_LED 832B [04] 1E03 956 bset 7,portd 832D [04] 1708 957 bclr 3,porte 832F [05] CD8343 958 jsr Wait_LED 8332 [04] 1608 959 bset 3,porte 8334 [04] 1908 960 bclr 4,porte 8336 [05] CD8343 961 jsr Wait_LED 8339 [04] 1808 962 bset 4,porte 833B [04] 1B08 963 bclr 5,porte 833D [05] CD8343 964 jsr Wait_LED 8340 [04] 1A08 965 bset 5,porte 8342 [04] 81 966 rts 967 968 Wait_LED: 8343 [05] CD86EA 969 jsr Wait64ms 8346 [04] 81 970 rts 971 972 LED_Msg: 8347 0D0A2020 973 fcb CR,LF,' LED Port Test',0 4C454420 506F7274 20546573 7400 974 975 976 ;------------------------------ 977 ; Piezo_Beep -- Command 'P' 978 ;------------------------------ 979 Piezo_Beep: 8359 [03] 458388 980 ldhx #Piezo_Msg ;"Piezo should be beeping. Reset to exit..." 835C [05] CD8AA1 981 jsr _puts ;put string to serial terminal 982 835F [04] 5522 983 ldhx tacntH ;get the current counter 8361 [02] AF2C 984 aix #44 ;44 clicks = Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 26 (360us, or 2.6 kHz) 8363 [04] 3527 985 sthx tach0H ;set Output Compare to happen 8365 [04] 6E5426 986 mov #$54,tasc0 ;CH0IE, MS0A, ELS0A = unbuffered Output Compare = toggle output (???) 987 8368 [03] 4503E8 988 pb1: ldhx #1000 836B [04] 3556 989 sthx timeout2 ;set timer2 for 1000ms 990 836D [04] 1F26 991 bclr 7,tasc0 ;clear OC flag 836F [04] 5522 992 ldhx tacntH 8371 [02] AF2C 993 aix #44 ;setup another interrupt in 44 clicks (Piezo ~2.6 KHz) 8373 [04] 3527 994 sthx tach0H 8375 [04] 1C26 995 bset 6,tasc0 ;enable TACH0 interrupts 8377 [04] 1103 996 bclr Keyline,portD ;key the transmitter (or driver transistor for Sonalert, etc.) 997 8379 [04] 5556 998 pb2: ldhx timeout2 837B [03] 650000 999 cphx #0 ;timeout2 = 0 yet? 837E [03] 26F9 1000 bne pb2 ;wait for 2-byte timeout2 value to reach zero 8380 [05] CD86CF 1001 jsr wait500ms 8383 [05] CD86CF 1002 jsr wait500ms 8386 [03] 20E0 1003 bra pb1 1004 1005 Piezo_Msg: 8388 0D0A2020 1006 fcb CR,LF,' Piezo should be beeping. Reset to exit...',0 5069657A 6F207368 6F756C64 20626520 62656570 696E672E 20205265 73657420 746F2065 7869742E 2E2E00 1007 1008 1009 ;------------------------------ 1010 ; Timing Test -- Command 'T' 1011 ;------------------------------ 1012 Timing_Test: 83B7 [03] 4583C6 1013 ldhx #Timing_Msg ;"Timing Test (reset to exit)" 83BA [05] CD8AA1 1014 jsr _puts ;put string to serial terminal 83BD [02] 9B 1015 sei 83BE [04] 1C09 1016 tt1: bset HeartbeatLED,portF 1017 ; jsr Wait100us ;change this Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 27 Wait to reflect desired test 83C0 [04] 1D09 1018 bclr HeartbeatLED,portF ;else, without the waits, it's a cycle timing test 1019 ; jsr Wait100us ;change this Wait to reflect desired test 83C2 [03] 20FA 1020 bra tt1 83C4 [02] 9A 1021 cli 83C5 [04] 81 1022 rts 1023 1024 Timing_Msg: 83C6 0D0A2020 1025 fcb CR,LF,' Cycle Timing (reset to exit)',0 4379636C 65205469 6D696E67 20287265 73657420 746F2065 78697429 00 1026 1027 ;------------------------------ 1028 ; Read EEPROM -- Command 'R' 1029 ;------------------------------ 1030 Read_EEPROM: 83E7 [03] 458409 1031 ldhx #Read_Msg ;"EEPROM = " 83EA [05] CD8AA1 1032 jsr _puts ;put string to serial terminal 83ED [03] 450800 1033 ldhx #$800 ;EEPROM mem is 800-9FF 83F0 [04] 6E207A 1034 mov #32,EEline_count ;32 lines of EEPROM to display 83F3 [04] 6E1079 1035 ree1: mov #16,EEbyte_count ;display 16 bytes/line 83F6 [02] F6 1036 ree2: lda ,x ;get the EEPROM byte 83F7 [05] CD8A8F 1037 jsr _pbyte ;else print the char to the terminal 83FA [05] CD8A7A 1038 jsr _space 83FD [02] AF01 1039 aix #1 83FF [05] 3B79F4 1040 dbnz EEbyte_count,ree2 ;not done with current line of 16 yet 8402 [05] CD8A74 1041 jsr _crlf 8405 [05] 3B7AEB 1042 dbnz EEline_count,ree1 ;not do with all 32 lines of EEPROM yet 8408 [04] 81 1043 rts 1044 1045 Read_Msg: 8409 0D0A2020 1046 fcb CR,LF,' EEPROM Memory (800-9FF):',C R,LF,0 45455052 4F4D204D 656D6F72 79202838 30302D39 4646293A 0D0A00 1047 Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 28 1048 ;------------------------------ 1049 ; Erase EEPROM -- Command 'E' 1050 ;------------------------------ 1051 Erase_EEPROM: 8428 [05] CD89AF 1052 jsr Erase_EEPROM_All ;clear all 512 locations 842B [03] 458432 1053 ldhx #Erase_Msg ;"EEPROM addresses 800-9FF now erased!" 842E [05] CD8AA1 1054 jsr _puts ;put string to serial terminal 8431 [04] 81 1055 rts 1056 1057 Erase_Msg: 8432 0D0A2020 1058 fcb CR,LF,' EEPROM addresses 800-9FF now erased!',0 45455052 4F4D2061 64647265 73736573 20383030 2D394646 206E6F77 20657261 73656421 00 1059 1060 ;------------------------------ 1061 ; Write EEPROM -- Command 'W' 1062 ;------------------------------ 1063 Write_EEPROM: 845B [03] 458488 1064 ldhx #Write_Msg ;"Enter EEPROM data to be written: " 845E [05] CD8AA1 1065 jsr _puts ;put string to serial terminal 8461 [05] CD8A59 1066 jsr _gets ;get an input string 8464 [03] 2521 1067 bcs we_exit ;if ctl+C or ESC, exit 8466 [04] C6040A 1068 lda _inbuf ;get the character 8469 [03] 271C 1069 beq we_exit ;nothing entered (just ENTER), exit 1070 1071 ;transfer from input buffer to EEPROM 1072 846B [03] 450800 1073 ldhx #$800 ;start of EEPROM = 800 846E [04] 3575 1074 sthx to_addr 8470 [03] 45040A 1075 ldhx #_inbuf ;point to start of input buffer 8473 [04] 3577 1076 sthx from_addr 8475 [04] 5577 1077 we1: ldhx from_addr 8477 [02] F6 1078 lda ,x ;get char from input buffer 8478 [03] 270D 1079 beq we_exit ;exit if EOT terminator found (0) 847A [01] 5C 1080 incx 847B [04] 3577 1081 sthx from_addr Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 29 847D [04] 5575 1082 ldhx to_addr 847F [05] CD897A 1083 jsr Write_EEPROM_byte ;write reg A to loc (hx) in EEPROM area 8482 [01] 5C 1084 incx 8483 [04] 3575 1085 sthx to_addr 8485 [03] 20EE 1086 bra we1 1087 1088 we_exit: 8487 [04] 81 1089 rts 1090 1091 Write_Msg: 8488 0D0A2020 1092 fcb CR,LF,' Enter EEPROM data to be written: ',0 456E7465 72204545 50524F4D 20646174 6120746F 20626520 77726974 74656E3A 2000 1093 1094 1095 ;------------------------------ 1096 ; Display Test -- Command 'Y' 1097 ;------------------------------ 1098 Display_Test: 84AE [05] CD893D 1099 jsr ClearLCDline2 84B1 [03] 4584D4 1100 ldhx #DispTst_Msg ;"LCD Display Test" 84B4 [05] CD8AA1 1101 jsr _puts ;put string to serial terminal 84B7 [05] CD890E 1102 jsr LCD_clear ;clear the LCD 84BA [05] CD86EA 1103 jsr Wait64ms 84BD [02] A680 1104 lda #$80 ;point to first char, line 1 84BF [05] CD8834 1105 jsr Cmnd2LCD 84C2 [03] 4584E5 1106 ldhx #Line1Msg 84C5 [05] CD896F 1107 jsr Disp_Msg ;display line 1 test message 84C8 [02] A6C0 1108 lda #$C0 ;point to first char, line 2 84CA [05] CD8834 1109 jsr Cmnd2LCD 84CD [03] 4584F6 1110 ldhx #Line2Msg 84D0 [05] CD896F 1111 jsr Disp_Msg 84D3 [04] 81 1112 rts 1113 1114 DispTst_Msg: 84D4 0D0A2020 1115 fcb CR,LF,' Display Test',0 44697370 6C617920 54657374 00 1116 Line1Msg: 84E5 41424344 1117 fcb 'ABCDefghIJKLmnop',0 65666768 Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 30 494A4B4C 6D6E6F70 00 1118 Line2Msg: 84F6 51525354 1119 fcb 'QRSTuv0123456789',0 75763031 32333435 36373839 00 1120 1121 ;-------------------------------------- 1122 ; Analog-to-Digital Test -- Command 'A' 1123 ;-------------------------------------- 1124 ADC_Test: 8507 [03] 458551 1125 ldhx #ADC_Msg ;"Analog-To-Di gital (ADC) Test" 850A [05] CD8AA1 1126 jsr _puts ;put string to serial terminal 850D [03] 458571 1127 ldhx #ADC_Msg_LCD 8510 [02] A6C0 1128 lda #$C0 ;point to 1st char line 2 8512 [05] CD8834 1129 jsr Cmnd2LCD 8515 [05] CD896F 1130 jsr Disp_Msg ;put string to LCD 8518 [04] 6E703A 1131 mov #$70,ADCLK ;select clock divide of 011 1132 ; and set the ADICLK bit 1133 adc_start: 851B [04] 6E0038 1134 mov #$00,ADSCR ;clear COCO, AIEN, ADCO 1135 ; and specify port 0, and start a conversion 1136 adc_wait: 851E [05] 0F38FD 1137 brclr 7,ADSCR,adc_wait ;wait for Conversion Complete (COCO) 8521 [03] B639 1138 lda ADR ;read the A/D register 8523 [02] 87 1139 psha 8524 [03] B068 1140 sub a2d_last ;compare to last reading 8526 [02] 86 1141 pula 8527 [03] 27F2 1142 beq adc_start ;go back and read again if same 8529 [03] B768 1143 sta a2d_last ;else save new value 852B [05] CD8A8F 1144 jsr _pbyte ;and output it 852E [05] CD8A74 1145 jsr _crlf 8531 [02] A6C6 1146 lda #$C6 ;point to digit position on 2nd line 8533 [05] CD8834 1147 jsr Cmnd2LCD 8536 [03] B668 1148 lda a2d_last ;get the A/D data value back again 8538 [03] 62 1149 nsa ;swap upper/lower nibbles 8539 [05] CD8A65 1150 jsr _nib_to_asc ;convert the upper nibble to ascii 853C [05] CD8846 1151 jsr data2LCD ;and display Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 31 it 853F [02] A6C7 1152 lda #$C7 ;point to digit position on 2nd line 8541 [05] CD8834 1153 jsr Cmnd2LCD 8544 [03] B668 1154 lda a2d_last ;get the A/D data value back again 8546 [05] CD8A65 1155 jsr _nib_to_asc ;convert the lower nibble to ascii 8549 [05] CD8846 1156 jsr data2LCD ;and display it 854C [05] CD86EA 1157 jsr Wait64ms 854F [03] 20CA 1158 bra adc_start ;go trigger another conversion 1159 1160 ADC_Msg: 8551 0D0A2020 1161 fcb CR,LF,' Analog-To-Digital Converter ',0 416E616C 6F672D54 6F2D4469 67697461 6C20436F 6E766572 74657200 1162 1163 ADC_Msg_LCD: 8571 412F4420 1164 fcb 'A/D = ',0 3D2000 1165 1166 ;------------------------------ 1167 ; Exit to Monitor -- Command 'X' 1168 ;------------------------------ 1169 Monitor: 8578 [09] 83 1170 swi ; Software Interrupt enters HCmon 8579 [04] 81 1171 rts 1172 1173 ;------------------------------------------- 1174 ; Help -- Command 'H' 1175 ;------------------------------------------- 1176 Help: 857A [03] 458581 1177 ldhx #Help_Msg ;"Help Menu" 857D [05] CD8AA1 1178 jsr _puts ;put string to serial terminal 8580 [04] 81 1179 rts 1180 1181 Help_Msg: 8581 0D0A 1182 fcb CR,LF 8583 48656C70 1183 fcb 'Help Menu ',CR,LF 204D656E 75202020 20202020 200D0A 8596 3D3D3D3D 1184 fcb '========= ',CR,LF 3D3D3D3D 3D202020 20202020 200D0A Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 32 85A9 2044203D 1185 fcb ' D = DDS Set ',CR,LF 20444453 20536574 20202020 200D0A 85BC 2053203D 1186 fcb ' S = Shaft Enc ',CR,LF 20536861 66742045 6E632020 200D0A 85CF 204C203D 1187 fcb ' L = LED Ports ',CR,LF 204C4544 20506F72 74732020 200D0A 85E2 2059203D 1188 fcb ' Y = Display Test',CR,LF 20446973 706C6179 20546573 740D0A 85F5 2045203D 1189 fcb ' E = Erase EEPROM',CR,LF 20457261 73652045 4550524F 4D0D0A 8608 2057203D 1190 fcb ' W = Write EEPROM',CR,LF 20577269 74652045 4550524F 4D0D0A 861B 2050203D 1191 fcb ' P = Piezo beeper',CR,LF 20506965 7A6F2062 65657065 720D0A 862E 2052203D 1192 fcb ' R = Read EEPROM ',CR,LF 20526561 64204545 50524F4D 200D0A 8641 2054203D 1193 fcb ' T = Timing Test ',CR,LF 2054696D 696E6720 54657374 200D0A 8654 2041203D 1194 fcb ' A = ADC Test ',CR,LF 20414443 20546573 74202020 200D0A 8667 2058203D 1195 fcb ' X = Exit to HCmon',CR,LF 20457869 7420746F 2048436D 6F6E0D0A 867B 2048203D 1196 fcb ' H = Help ',CR,LF 2048656C 70202020 Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 33 20202020 200D0A 868E 00 1197 fcb 0 1198 1199 ;*************************************************** *********************** 1200 ;*************** HCmon_LCD_disp ******************************* 1201 ;* Routine called from HCmon to display message to LCD * 1202 ;*************************************************** *********************** 1203 1204 HCmon_LCD_disp: 868F [05] CD88B3 1205 jsr LCD_init 8692 [05] CD890E 1206 jsr LCD_clear 8695 [03] 4586A7 1207 ldhx #mon_msg1 8698 [05] CD896F 1208 jsr disp_msg 869B [02] A6C0 1209 lda #$C0 869D [05] CD8834 1210 jsr cmnd2lcd 86A0 [03] 4586B6 1211 ldhx #mon_msg2 86A3 [05] CD896F 1212 jsr disp_msg 86A6 [04] 81 1213 rts 1214 1215 mon_msg1: 86A7 48436D6F 1216 fcb 'HCmonitor v1.0',0 6E69746F 72207631 2E3000 1217 1218 mon_msg2: 86B6 472E4865 1219 fcb 'G.Heron N2APB',0 726F6E20 4E324150 4200 1220 1221 Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 34 86C4 1222 $page 1223 ;*************************************************** *********************** 1224 ;***************** DELAY ROUTINES ******************************* 1225 ;*************************************************** *********************** 1226 1227 ;--------------------------------------------------- ----------------------- 1228 ; Delay -- This subroutine performs a simple software delay loop based upon 1229 ; the value passed in ACC. The following timing calculation applies: 1230 ; delay = ((ACC * 74) + 12) (tcyc) 1231 1232 delay: 86C4 [02] 87 1233 psha ;[2] save delay parameter temporarily 1234 delay1: 86C5 [02] A616 1235 lda #22T ;[2] initialize 5us loop counter 1236 ; (repeat for timing) 1237 delay2: 86C7 [03] 4BFE 1238 dbnza delay2 ;[3] decrement inner delay loop counter 86C9 [06] 9E6B01F8 1239 dbnz 1,sp,delay1 ;[6] decrement outer delay loop counter 86CD [02] 86 1240 pula ;[2] deallocate local variable 86CE [04] 81 1241 rts ;[4] return 1242 1243 ;--------------------------------------------------- ----------------------- 1244 ; Wait500ms -- Waits here for (10 x 50 x 1ms) = 500ms 1245 1246 wait500ms: 86CF [02] A60A 1247 lda #10 86D1 [03] B774 1248 sta count_hi 86D3 [02] A650 1249 w500m1: lda #$50 86D5 [03] B773 1250 sta count_lo 86D7 [05] CD8716 1251 w500m2: jsr wait1ms 86DA [05] 3B73FA 1252 dbnz count_lo,w500m2 86DD [05] 3B74F3 1253 dbnz count_hi,w500m1 86E0 [04] 81 1254 rts 1255 1256 ;--------------------------------------------------- ----------------------- 1257 ; Wait100ms-- Waits here for 100ms 1258 1259 wait100ms: 86E1 [02] A664 1260 lda #100 86E3 [02] 87 1261 w100a: psha 86E4 [04] AD30 1262 bsr wait1ms 86E6 [02] 86 1263 pula Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 35 86E7 [03] 4BFA 1264 dbnza w100a 86E9 [04] 81 1265 rts 1266 1267 ;--------------------------------------------------- ----------------------- 1268 ; Wait64ms-- Waits here for 64ms 1269 1270 wait64ms: 86EA [02] A640 1271 lda #64 86EC [02] 87 1272 w64a: psha 86ED [04] AD27 1273 bsr wait1ms 86EF [02] 86 1274 pula 86F0 [03] 4BFA 1275 dbnza w64a 86F2 [04] 81 1276 rts 1277 1278 ;--------------------------------------------------- ----------------------- 1279 ; Wait50ms-- Waits here for 50ms 1280 1281 wait50ms: 86F3 [04] 6E3255 1282 mov #50,timeout1 86F6 [03] 3D55 1283 w50a: tst timeout1 86F8 [03] 26FC 1284 bne w50a 86FA [04] 81 1285 rts 1286 1287 ;--------------------------------------------------- ----------------------- 1288 ; Wait32ms-- Waits here for 32ms 1289 1290 wait32ms: 86FB [02] A620 1291 lda #32 86FD [02] 87 1292 w32a: psha 86FE [04] AD16 1293 bsr wait1ms 8700 [02] 86 1294 pula 8701 [03] 4BFA 1295 dbnza w32a 8703 [04] 81 1296 rts 1297 1298 ;--------------------------------------------------- ----------------------- 1299 ; Wait64ms-- Waits here for 16ms 1300 1301 wait16ms: 8704 [02] A610 1302 lda #16 8706 [02] 87 1303 w16a: psha 8707 [04] AD0D 1304 bsr wait1ms 8709 [02] 86 1305 pula 870A [03] 4BFA 1306 dbnza w16a 870C [04] 81 1307 rts 1308 1309 ;--------------------------------------------------- ----------------------- 1310 ; Wait10ms-- Waits here for 10ms 1311 1312 Wait10ms: 870D [02] A60A 1313 lda #10 870F [02] 87 1314 w10a: psha 8710 [04] AD04 1315 bsr wait1ms 8712 [02] 86 1316 pula Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 36 8713 [03] 4BFA 1317 dbnza w10a 8715 [04] 81 1318 rts 1319 1320 ;--------------------------------------------------- ----------------------- 1321 ; Wait1ms-- Waits here for 1ms 1322 1323 wait1ms: 8716 [02] A60A 1324 lda #10 8718 [02] 87 1325 w1msa: psha 8719 [04] AD04 1326 bsr wait100us 871B [02] 86 1327 pula 871C [03] 4BFA 1328 dbnza w1msa 871E [04] 81 1329 rts 1330 1331 ;--------------------------------------------------- ----------------------- 1332 ; Wait100us -- Waits here for 100us 1333 ; 1 cycle = .11454545 US 1334 ; (137 x (5 x .11454545)) + (6 x .11454545) 1335 ; (174 x .5727) + .687 = 100 us 1336 1337 wait100us: 871F [02] A6AE 1338 lda #174 ; [2] 8721 [01] 4A 1339 w100u: deca ; [1] 8722 [01] 9D 1340 nop ; [1] 8723 [03] 26FC 1341 bne w100u ; [3] 8725 [04] 81 1342 rts ; [4] 1343 1344 ;--------------------------------------------------- ----------------------- 1345 ; Wait1us -- Waits here for 1us 1346 1347 wait1us: 8726 [03] B603 1348 lda us1 8728 [03] 4BFE 1349 dbnza * 872A [04] 81 1350 rts 1351 1352 ;*************************************************** ********** 1353 ;***************** TIMER MODULE ************* ********** 1354 ;*************************************************** ********** 1355 1356 ;--------------------------------------------------- ---------- 1357 ; Init_Timer - Turns on timer A channel 1 for an Output 1358 ; Compare in 1ms. Creates an interrupt 1359 ; vector to the Timer ISR (T_ISR_A1), where Timeout1, 1360 ; Timeout2 and Timeout3 are decremeted. If a timer 1361 ; reaches 0, then a user-specified operation is 1362 ; done. Thus, the user can either set Exerciser_v2.asm Assembled with CASM08Z 6/16/2003 10:04:33 PM PAGE 37 a timer in his 1363 ; code and sit there waiting on it to become 0, or 1364 ; he may place the timeout action routine right here 1365 ; in the Timer Handlers. We use the latter technique 1366 ; for the "heartbeat" LED blink. We set Timeout1 to 1367 ; 255 in the Timer1 Handler below, and when 255 ticks 1368 ; of the 1ms timer interrupt occur, we toggle the state 1369 ; of the heartbeat LED and reset Timeout1 to occur again 1370 ; in another 255 ticks. 1371 1372 Init_Timer: 872B [04] 6E3620 1373 mov #$36,tasc ; Timer A cleared + stopped. Clicks every 64 bus cycles 872E [04] 6E002A 1374 mov #0,tach1H ; Set Output Compare to happen in 136 clicks (1ms) 8731 [04] 6E882B 1375 mov #136,tach1L ; after we start the timer. 8734 [04] 6E5429 1376 mov #$54,tasc1 ; Set Timer A Chan 1 for Output Compare operation. 8737 [04] 6E0620 1377 mov #$06,tasc ; Start the timer 873A [04] 81 1378 rts 1379 1380 ;*************************************************** ****************** 1381 ; T_ISR_A1 - 1ms Timer Interrupt Service Routine for Timer A Chan 1 1382 ;*************************************************** ****************** 1383 1384 T_ISR_A1: 873B [02] 8B 1385 pshh 873C [02] 89 1386 pshx 873D [02] 87 1387 psha