A51 MACRO ASSEMBLER STEPPER 22/07/99 14:17:14 PAGE 1 DOS MACRO ASSEMBLER A51 V5.28m OBJECT MODULE PLACED IN STEPPER.OBJ ASSEMBLER INVOKED BY: C:\ANCHOR\KEIL2K\BIN\A51.EXE STEPPER.A51 RB(0) DB EP LOC OBJ LINE SOURCE 1 NAME StepperMotorController 2 3 $INCLUDE(../Declare.A51) =1 4 ; This module declares the variables and constants used in the examples =1 5 ; It is common to all of the examples =1 6 ; =1 7 ; Declare Special Function Registers used 00A8 =1 8 EI DATA 0A8H 00E8 =1 9 EIE DATA 0E8H ; EZ-USB specific 0091 =1 10 EXIF DATA 091H ; EZ-USB specific 00D8 =1 11 EICON DATA 0D8H ; EZ-USB specific 0092 =1 12 PageReg DATA 092H ; EZ-USB specific, used with MOVX @Ri 0086 =1 13 DPS DATA 086H ; EZ-USB specific, used with dual data pointers =1 14 ; =1 15 ; "External" memory locations used, EZ-USB specific =1 16 ; Note that most of these variables are in Page 7FH 7FE8 =1 17 SETUPDAT EQU 07FE8H 7FD4 =1 18 SUDPTR EQU 07FD4H 7FB4 =1 19 EP0Control EQU 07FB4H 7F00 =1 20 EP0InBuffer EQU 07F00H 7EC0 =1 21 EP0OutBuffer EQU 07EC0H ; Not in Page 7FH 7E80 =1 22 EP1InBuffer EQU 07E80H ; Not in Page 7FH 7FB5 =1 23 IN0ByteCount EQU 07FB5H 7FC5 =1 24 Out0ByteCount EQU 07FC5H 7FB7 =1 25 IN1ByteCount EQU 07FB7H 7FAC =1 26 IN07IEN EQU 07FACH 7FA9 =1 27 IN07IRQ EQU 07FA9H 7FAD =1 28 OUT07IEN EQU 07FADH 7FAA =1 29 OUT07IRQ EQU 07FAAH 7FAE =1 30 USBIEN EQU 07FAEH 7FAB =1 31 USBIRQ EQU 07FABH 7FD6 =1 32 USBControl EQU 07FD6H 7FA6 =1 33 I2CData EQU 07FA6H 7FA5 =1 34 I2CControl EQU 07FA5H 7F99 =1 35 PortA_PINS EQU 07F99H 7F9A =1 36 PortB_PINS EQU 07F9AH 7F93 =1 37 PortA_Config EQU 07F93H 7F94 =1 38 PortB_Config EQU 07F94H 7F96 =1 39 PortA_OUT EQU 07F96H 7F9C =1 40 PortA_OE EQU 07F9CH 7F9D =1 41 PortB_OE EQU 07F9DH =1 42 ; =1 43 ; Byte Variables =1 44 ---- =1 45 DSEG AT 20H 0020 =1 46 FLAGS: DS 1 ; This register is bit-addressable =1 47 ; Bit Variables 0000 =1 48 Configured EQU FLAGS.0 ; Is this device configured 0001 =1 49 STALL EQU FLAGS.1 ; Need to STALL endpoint 0 0002 =1 50 SendData EQU FLAGS.2 ; Need to send data to PC Host 0003 =1 51 IsDescriptor EQU FLAGS.3 ; Enable a shortcut reply =1 52 ; 0021 =1 53 MonitorSpace: DS 1FH ; Used by Dscope 0040 =1 54 Temp: DS 1 ; A temporary working register 0041 =1 55 Idle_Time: DS 1 ; The time the PC host wants us to wait 0042 =1 56 Expired_Time: DS 1 ; A downcounter for timed Reports 0043 =1 57 ReplyBuffer: DS 3 ; First byte is Count =1 58 ; A51 MACRO ASSEMBLER STEPPER 22/07/99 14:17:14 PAGE 2 =1 59 ; Declare the specific variables used by each of the examples 0046 =1 60 Overlay EQU $ 0046 =1 61 Old_Buttons: DS 1 ; Used by BAL: stores current button position 0047 =1 62 LEDstrobe: DS 1 ; Used by BAL: strobe one LED on at a time 0048 =1 63 LEDvalue: DS 1 ; Used by BAL: stores current LED value 0049 =1 64 Msec_Counter: DS 1 ; Used by BAL: counts up to 4 msec =1 65 0046 =1 66 ORG Overlay ; Overlay the variables (only one set in use at any one tim e) 0046 =1 67 I2CDataByte: DS 1 ; Used by I2C: keep a local copy of data read from I2C bus =1 68 0046 =1 69 ORG Overlay 0046 =1 70 LightValues: DS 6 ; Used by LP: local buffer for light brightness =1 71 0046 =1 72 ORG Overlay 0046 =1 73 MotorControl: DS 3 ; Used by Stepper: direction, Low(count) and High(count) 0049 =1 74 CurrentPosition:DS 1 ; Used by Stepper: motor has 16 stable positions =1 75 0046 =1 76 ORG Overlay 0046 =1 77 LimitValues: DS 12 ; Used by Temps: local buffer for limits =1 78 0046 =1 79 ORG Overlay 0046 =1 80 LEDBuffer: DS 42 ; Used by RB: local buffer for reader board =1 81 ; 82 $INCLUDE(../Vectors.A51) =1 83 ; This module is common to all of the examples. =1 84 ; It contains all of the interrupt vector declarations and =1 85 ; the first level interrupt servicing (register save, call subroutine, =1 86 ; clear interrupt source, restore registers, return) =1 87 ; Suspend and Resume are handled totally in this module =1 88 ; =1 89 ; A Reset sends us to Program space location 0 ---- =1 90 CSEG AT 0 ; Code space =1 91 USING 0 ; Reset forces Register Bank 0 0000 020357 =1 92 LJMP Reset =1 93 ; =1 94 ; The interrupt vector table is also located here =1 95 ; EZ-USB has two levels of USB interrupts: =1 96 ; 1-the main level is described in this table (at ORG 43H) =1 97 ; 2-there are 21 sources of USB interrupts and these are described in USB_ISR =1 98 ; This means that two levels of acknowledgement and clearing will be required =1 99 ; LJMP INT0_ISR ; Features not used are commented out =1 100 ; ORG 0BH =1 101 ; LJMP Timer0_ISR =1 102 ; ORG 13H =1 103 ; LJMP INT1_ISR =1 104 ; ORG 1BH =1 105 ; LJMP Timer1_ISR =1 106 ; ORG 23H =1 107 ; LJMP UART0_ISR =1 108 ; ORG 2BH =1 109 ; LJMP Timer2_ISR =1 110 ; ORG 33H =1 111 ; LJMP WakeUp_ISR =1 112 ; ORG 3BH =1 113 ; LJMP UART1_ISR 0043 =1 114 ORG 43H 0043 020100 =1 115 LJMP USB_ISR ; Auto Vector will replace byte 45H =1 116 ; ORG 4BH =1 117 ; LJMP I2C_ISR =1 118 ; ORG 53H =1 119 ; LJMP INT4_ISR =1 120 ; ORG 5BH =1 121 ; LJMP INT5_ISR =1 122 ; ORG 63H =1 123 ; LJMP INT6_ISR A51 MACRO ASSEMBLER STEPPER 22/07/99 14:17:14 PAGE 3 =1 124 00E0 =1 125 ORG 0E0H ; Keep out of the way of dScope monitor =1 126 ; If you are not using dScope then this memory hole =1 127 ; may be used for useful routines. 0100 =1 128 ORG 100H 0100 02013C =1 129 USB_ISR:LJMP SUDAV_ISR 0103 00 =1 130 DB 0 ; Pad entries to 4 bytes 0104 020158 =1 131 LJMP SOF_ISR 0107 00 =1 132 DB 0 0108 020118 =1 133 LJMP SUTOK_ISR 010B 00 =1 134 DB 0 010C 020129 =1 135 LJMP Suspend_ISR 010F 00 =1 136 DB 0 0110 020120 =1 137 LJMP USBReset_ISR 0113 00 =1 138 DB 0 0114 020118 =1 139 LJMP Reserved 0117 00 =1 140 DB 0 =1 141 ; LJMP EP0In_ISR ; Endpoint Interrupts are not used in these examples =1 142 ; DB 0 ; Comment out features not used =1 143 ; LJMP EP0Out_ISR =1 144 ; DB 0 =1 145 ; LJMP EP1In_ISR =1 146 ; DB 0 =1 147 ; LJMP EP1Out_ISR =1 148 ; DB 0 =1 149 ; LJMP EP2In_ISR =1 150 ; DB 0 =1 151 ; LJMP EP2Out_ISR =1 152 ; DB 0 =1 153 ; LJMP EP3In_ISR =1 154 ; DB 0 =1 155 ; LJMP EP3Out_ISR =1 156 ; DB 0 =1 157 ; LJMP EP4In_ISR =1 158 ; DB 0 =1 159 ; LJMP EP4Out_ISR =1 160 ; DB 0 =1 161 ; LJMP EP5In_ISR =1 162 ; DB 0 =1 163 ; LJMP EP5Out_ISR =1 164 ; DB 0 =1 165 ; LJMP EP6In_ISR =1 166 ; DB 0 =1 167 ; LJMP EP6Out_ISR =1 168 ; DB 0 =1 169 ; LJMP EP7In_ISR =1 170 ; DB 0 =1 171 ; LJMP EP7Out_ISR =1 172 ; End of Interrupt Vector tables =1 173 =1 174 ; When a feature is used insert the required interrupt processing here =1 175 ; The example use only used Endpoints 0 and 1 and also SOF for timing 0118 =1 176 Reserved: 0118 =1 177 INT0_ISR: 0118 =1 178 Timer0_ISR: 0118 =1 179 INT1_ISR: 0118 =1 180 Timer1_ISR: 0118 =1 181 UART0_ISR: 0118 =1 182 Timer2_ISR: 0118 =1 183 UART1_ISR: 0118 =1 184 I2C_ISR: 0118 =1 185 INT4_ISR: 0118 =1 186 INT5_ISR: 0118 =1 187 INT6_ISR: 0118 =1 188 SUTOK_ISR: 0118 =1 189 EP0In_ISR: A51 MACRO ASSEMBLER STEPPER 22/07/99 14:17:14 PAGE 4 0118 =1 190 EP0Out_ISR: 0118 =1 191 EP1In_ISR: 0118 =1 192 EP1Out_ISR: 0118 =1 193 EP2In_ISR: 0118 =1 194 EP2Out_ISR: 0118 =1 195 EP3In_ISR: 0118 =1 196 EP3Out_ISR: 0118 =1 197 EP4In_ISR: 0118 =1 198 EP4Out_ISR: 0118 =1 199 EP5In_ISR: 0118 =1 200 EP5Out_ISR: 0118 =1 201 EP6In_ISR: 0118 =1 202 EP6Out_ISR: 0118 =1 203 EP7In_ISR : 0118 =1 204 EP7Out_ISR: 0118 =1 205 Not_Used: ; Should not get any of these 0118 32 =1 206 RETI =1 207 0119 =1 208 ClearINT2: ; Tell the hardware that we're done 0119 E591 =1 209 MOV A, EXIF 011B C2E4 =1 210 CLR ACC.4 ; Clear the Interrupt 2 bit 011D F591 =1 211 MOV EXIF, A 011F 22 =1 212 RET =1 213 0120 =1 214 USBReset_ISR: ; Bus has been Reset, move to DEFAULT state 0120 C0E0 =1 215 PUSH ACC 0122 C200 =1 216 CLR Configured 0124 3119 =1 217 CALL ClearINT2 =1 218 ; No need to clear source of interrupt 0126 D0E0 =1 219 POP ACC 0128 32 =1 220 RETI =1 221 0129 =1 222 Suspend_ISR: ; SIE detected an Idle bus 0129 C0E0 =1 223 PUSH ACC 012B E587 =1 224 MOV A, PCON 012D 4401 =1 225 ORL A, #1 012F F587 =1 226 MOV PCON, A ; Go to sleep! 0131 00 =1 227 NOP 0132 00 =1 228 NOP ; Wake up here due to a USBResume 0133 00 =1 229 NOP 0134 3119 =1 230 CALL ClearINT2 0136 D0E0 =1 231 POP ACC 0138 32 =1 232 RETI =1 233 0139 =1 234 WakeUp_ISR: ; Not using external WAKEUP in these examples =1 235 ; So this must be due to a USBResume 0139 C2DC =1 236 CLR EICON.4 ; Clear the wakeup interrupt source 013B 32 =1 237 RETI =1 238 013C =1 239 SUDAV_ISR: ; A Setup packet has been received 013C C0D0 =1 240 PUSH PSW ; Save Registers before the service routine 013E C0E0 =1 241 PUSH ACC 0140 C082 =1 242 PUSH DPL 0142 C083 =1 243 PUSH DPH 0144 120169 =1 244 CALL ServiceSetupPacket 0147 3119 =1 245 CALL ClearINT2 =1 246 ; Clear the source of the interrupt 0149 7401 =1 247 MOV A, #00000001b 014B 907FAB =1 248 ExitISR:MOV DPTR, #USBIRQ 014E F0 =1 249 MOVX @DPTR, A 014F D083 =1 250 POP DPH ; Restore Registers 0151 D082 =1 251 POP DPL 0153 D0E0 =1 252 POP ACC 0155 D0D0 =1 253 POP PSW 0157 32 =1 254 RETI =1 255 A51 MACRO ASSEMBLER STEPPER 22/07/99 14:17:14 PAGE 5 0158 =1 256 SOF_ISR: ; A Start-Of-Frame packet has been received 0158 C0D0 =1 257 PUSH PSW ; Save Registers before the service routine 015A C0E0 =1 258 PUSH ACC 015C C082 =1 259 PUSH DPL 015E C083 =1 260 PUSH DPH 0160 1203AF =1 261 CALL ServiceTimerRoutine 0163 3119 =1 262 CALL ClearINT2 =1 263 ; Clear the source of the interrupt 0165 7402 =1 264 MOV A, #00000010b 0167 80E2 =1 265 JMP ExitISR =1 266 =1 267 268 $INCLUDE(../USB_INT.A51) =1 269 ; This module is common to all of the examples. =1 270 ; It services USB Requests from the SIE. =1 271 ; Interpretation of the Output Reports is handled by MAIN =1 272 ; ---- =1 273 CSEG 0169 =1 274 ServiceSetupPacket: 0169 907FE8 =1 275 MOV DPTR, #SETUPDAT ; Point to Setup Packet data 016C E0 =1 276 MOVX A, @DPTR ; Get the RequestType 016D A2E7 =1 277 MOV C, ACC.7 ; Bit 7 = 1 means IO device needs to send data to P C Host 016F 9202 =1 278 MOV SendData, C 0171 545C =1 279 ANL A, #01011100b ; IF RequestType[6.4.3.2] = 1 THEN goto BadRequest 0173 7051 =1 280 JNZ BadRequest 0175 E0 =1 281 MOVX A, @DPTR ; IF RequestType[1&0] = 1 THEN goto BadRequest 0176 A2E0 =1 282 MOV C, ACC.0 0178 82E1 =1 283 ANL C, ACC.1 017A 404A =1 284 JC BadRequest 017C 30E502 =1 285 JNB ACC.5, NotB5 ; IF RequestType[5] = 1 THEN RequestType[1,0] = [1, 1] 017F 7403 =1 286 MOV A, #00000011b 0181 5403 =1 287 NotB5: ANL A, #00000011b ; Set CommandIndex[5,4] = RequestType[1,0] 0183 C4 =1 288 SWAP A 0184 F540 =1 289 MOV Temp, A ; Save HI nibble of CommandIndex =1 290 ; Set CommandIndex[3,0] = Request[3,0] 0186 A3 =1 291 INC DPTR ; Point to Request 0187 E0 =1 292 MOVX A, @DPTR 0188 540F =1 293 ANL A, #00001111b ; Only 13 are defined today, handle in table 018A 4540 =1 294 ORL A, Temp 018C 1201D5 =1 295 CALL CorrectSubroutine ; goto CommandTable(CommandIndex) =1 296 ; Returns STALL=1 if a stall is required 018F 200134 =1 297 JB STALL, BadRequest 0192 300218 =1 298 JNB SendData, HandShake 0195 200320 =1 299 JB IsDescriptor, LoadSUDPTR; EZ-USB has a short cut for descriptors =1 300 ; Send data in ReplyBuffer 0198 907F02 =1 301 MOV DPTR, #EP0InBuffer+2 019B 7846 =1 302 MOV R0, #ReplyBuffer+3 019D 754003 =1 303 MOV Temp, #3 ; Copy maximum byte count 01A0 E6 =1 304 CopyRB: MOV A, @R0 01A1 F0 =1 305 MOVX @DPTR, A 01A2 1582 =1 306 DEC DPL 01A4 18 =1 307 DEC R0 01A5 D540F8 =1 308 DJNZ Temp, CopyRB 01A8 E6 =1 309 MOV A, @R0 ; Get real byte count 01A9 =1 310 SendEP0InBuffer: 01A9 907FB5 =1 311 MOV DPTR, #In0ByteCount 01AC =1 312 StartXfer: 01AC F0 =1 313 MOVX @DPTR, A ; This write initiates the transfer 01AD =1 314 HandShake: ; Handshake with host 01AD 754002 =1 315 MOV Temp, #00000010b ; Set HSNAK to tell the SIE that we're done 01B0 =1 316 SetEP0Control: 01B0 907FB4 =1 317 MOV DPTR, #EP0Control 01B3 E0 =1 318 MOVX A, @DPTR 01B4 4540 =1 319 ORL A, Temp A51 MACRO ASSEMBLER STEPPER 22/07/99 14:17:14 PAGE 6 01B6 F0 =1 320 MOVX @DPTR, A 01B7 22 =1 321 RET 01B8 =1 322 LoadSUDPTR: ; Send the data pointed to by DPTR 01B8 858240 =1 323 MOV Temp, DPL 01BB E583 =1 324 MOV A, DPH 01BD 907FD4 =1 325 MOV DPTR, #SUDPTR 01C0 F0 =1 326 MOVX @DPTR, A 01C1 E540 =1 327 MOV A, Temp 01C3 A3 =1 328 INC DPTR 01C4 80E6 =1 329 JMP StartXfer 01C6 =1 330 BadRequest: ; Invalid Request was received 01C6 754003 =1 331 MOV Temp, #00000011b ; Set EP0STALL and HSNAK 01C9 80E5 =1 332 JMP SetEP0Control =1 333 01CB =1 334 NextDPTR: ; Returns (DPTR + byte DPTR is pointing to) 01CB E0 =1 335 MOVX A, @DPTR 01CC =1 336 BumpDPTR: ; Returns (DPTR + ACC) 01CC 2582 =1 337 ADD A, DPL 01CE F582 =1 338 MOV DPL, A 01D0 5002 =1 339 JNC Skip 01D2 0583 =1 340 INC DPH ; Need 16 bit arithmetic here 01D4 22 =1 341 Skip: RET =1 342 01D5 =1 343 CorrectSubroutine: ; Jump to the subroutine that DPTR is pointing to 01D5 9001FA =1 344 MOV DPTR, #CommandTable 01D8 31CC =1 345 CALL BumpDPTR ; Point to entry 01DA E0 =1 346 MOVX A, @DPTR ; Get the offset 01DB 9001FA =1 347 MOV DPTR, #CommandTable 01DE 31CC =1 348 CALL BumpDPTR ; Get the routine address 01E0 C082 =1 349 PUSH DPL ; Create a RETURN address on stack 01E2 C083 =1 350 PUSH DPH ; Note: JMP @A+DPTR not used since A, DPTR needed 01E4 7845 =1 351 MOV R0, #ReplyBuffer+2 01E6 E4 =1 352 CLR A 01E7 F6 =1 353 MOV @R0, A ; Clear ReplyBuffer 01E8 18 =1 354 DEC R0 01E9 F6 =1 355 MOV @R0, A 01EA 18 =1 356 DEC R0 01EB 7601 =1 357 MOV @R0, #1 ; Default non-descriptor reply 01ED 907FEA =1 358 MOV DPTR, #SETUPDAT+2 ; Point to LOW(wValue) 01F0 E0 =1 359 MOVX A, @DPTR ; Many of the routines need these 01F1 F5F0 =1 360 MOV B, A ; LOW(wValue) in B 01F3 A3 =1 361 INC DPTR 01F4 E0 =1 362 MOVX A, @DPTR ; HIGH(wValue) in A 01F5 C201 =1 363 CLR STALL 01F7 C203 =1 364 CLR IsDescriptor 01F9 22 =1 365 RET ; Go to service routine =1 366 =1 367 ; Since the table only contains byte offsets, it is important that all these routines are =1 368 ; within one page (100H) of CommandTable =1 369 ; 01FA =1 370 CommandTable: =1 371 ; First 16 commands are for the Device 01FA 6D =1 372 DB Device_Get_Status - CommandTable 01FB 40 =1 373 DB Device_Clear_Feature - CommandTable 01FC 40 =1 374 DB Invalid - CommandTable 01FD 40 =1 375 DB Device_Set_Feature - CommandTable 01FE 40 =1 376 DB Invalid - CommandTable 01FF 40 =1 377 DB Invalid - CommandTable ; SIE implements Device_Set_Address 0200 81 =1 378 DB Get_Descriptor - CommandTable 0201 40 =1 379 DB Set_Descriptor - CommandTable 0202 6A =1 380 DB Get_Configuration - CommandTable 0203 74 =1 381 DB Set_Configuration - CommandTable 0204 40 =1 382 DB Invalid - CommandTable 0205 40 =1 383 DB Invalid - CommandTable 0206 40 =1 384 DB Invalid - CommandTable 0207 40 =1 385 DB Invalid - CommandTable A51 MACRO ASSEMBLER STEPPER 22/07/99 14:17:14 PAGE 7 0208 40 =1 386 DB Invalid - CommandTable 0209 40 =1 387 DB Invalid - CommandTable =1 388 ; Next 16 commands are for the Interface 020A 71 =1 389 DB Interface_Get_Status - CommandTable 020B 40 =1 390 DB Interface_Clear_Feature - CommandTable 020C 40 =1 391 DB Invalid - CommandTable 020D 40 =1 392 DB Interface_Set_Feature - CommandTable 020E 40 =1 393 DB Invalid - CommandTable 020F 40 =1 394 DB Invalid - CommandTable 0210 A5 =1 395 DB Get_Class_Descriptor - CommandTable 0211 40 =1 396 DB Set_Class_Descriptor - CommandTable 0212 40 =1 397 DB Invalid - CommandTable 0213 40 =1 398 DB Invalid - CommandTable 0214 40 =1 399 DB Get_Interface - CommandTable 0215 40 =1 400 DB Set_Interface - CommandTable 0216 40 =1 401 DB Invalid - CommandTable 0217 40 =1 402 DB Invalid - CommandTable 0218 40 =1 403 DB Invalid - CommandTable 0219 40 =1 404 DB Invalid - CommandTable =1 405 ; Next 16 commands are for the Endpoint 021A 71 =1 406 DB Endpoint_Get_Status - CommandTable 021B 42 =1 407 DB Endpoint_Clear_Feature - CommandTable 021C 40 =1 408 DB Invalid - CommandTable 021D 40 =1 409 DB Endpoint_Set_Feature - CommandTable 021E 40 =1 410 DB Invalid - CommandTable 021F 40 =1 411 DB Invalid - CommandTable 0220 40 =1 412 DB Invalid - CommandTable 0221 40 =1 413 DB Invalid - CommandTable 0222 40 =1 414 DB Invalid - CommandTable 0223 40 =1 415 DB Invalid - CommandTable 0224 40 =1 416 DB Invalid - CommandTable 0225 40 =1 417 DB Invalid - CommandTable 0226 40 =1 418 DB Endpoint_Sync_Frame - CommandTable 0227 40 =1 419 DB Invalid - CommandTable 0228 40 =1 420 DB Invalid - CommandTable 0229 40 =1 421 DB Invalid - CommandTable =1 422 ; Next 16 commands are Class Requests 022A 40 =1 423 DB Invalid - CommandTable 022B 56 =1 424 DB Get_Report - CommandTable 022C 63 =1 425 DB Get_Idle - CommandTable 022D 40 =1 426 DB Get_Protocol - CommandTable 022E 40 =1 427 DB Invalid - CommandTable 022F 40 =1 428 DB Invalid - CommandTable 0230 40 =1 429 DB Invalid - CommandTable 0231 40 =1 430 DB Invalid - CommandTable 0232 40 =1 431 DB Invalid - CommandTable 0233 43 =1 432 DB Set_Report - CommandTable 0234 5D =1 433 DB Set_Idle - CommandTable 0235 40 =1 434 DB Set_Protocol - CommandTable 0236 40 =1 435 DB Invalid - CommandTable 0237 40 =1 436 DB Invalid - CommandTable 0238 40 =1 437 DB Invalid - CommandTable 0239 40 =1 438 DB Invalid - CommandTable =1 439 ; =1 440 ; Many requests are INVALID for this example 023A =1 441 Get_Protocol: ; We are not a Boot device 023A =1 442 Set_Protocol: ; We are not a Boot device 023A =1 443 Set_Descriptor: ; Our Descriptors are static 023A =1 444 Set_Class_Descriptor: ; Our Descriptors are static 023A =1 445 Set_Interface: ; We only have one Interface 023A =1 446 Get_Interface: ; We do not have an Alternate setting 023A =1 447 Device_Set_Feature: ; We have no features that can be set or cleared 023A =1 448 Interface_Set_Feature: ; We have no features that can be set or cleared 023A =1 449 Endpoint_Set_Feature: ; We have no features that can be set or cleared 023A =1 450 Device_Clear_Feature: ; We have no features that can be set or cleared 023A =1 451 Interface_Clear_Feature: ; We have no features that can be set or cleared A51 MACRO ASSEMBLER STEPPER 22/07/99 14:17:14 PAGE 8 023A =1 452 Endpoint_Sync_Frame: ; We are not an Isonchronous device =1 453 023A =1 454 Invalid: ; Invalid Request made, STALL the Endpoint 023A D201 =1 455 SETB STALL =1 456 ; 023C =1 457 Endpoint_Clear_Feature: ; We have no features that can be set or cleared =1 458 ; 023C 22 =1 459 Reply: RET =1 460 023D =1 461 Set_Report: ; Host wants to sent us a Report. =1 462 ; The ONLY case in this example where host sends data to us 023D 3000FA =1 463 JNB Configured, Invalid ; Need to be Configured to do this command 0240 907FC5 =1 464 MOV DPTR, #Out0ByteCount ; Enable EP0OutBuffer to receive data 0243 F0 =1 465 MOVX @DPTR, A ; Any value will do 0244 907FAA =1 466 MOV DPTR, #OUT07IRQ ; Wait for valid data in EP0OutBuffer 0247 E0 =1 467 Wait4D: MOVX A, @DPTR 0248 5401 =1 468 ANL A, #00000001b 024A 60FB =1 469 JZ Wait4D 024C F0 =1 470 MOVX @DPTR, A ; Clear the interrupt 024D 0203A1 =1 471 JMP ProcessOutputReport ; RETurn via this subroutine 0250 =1 472 Get_Report: ; Host wants a Report 0250 3000E7 =1 473 JNB Configured, Invalid ; Need to be Configured to do this command 0253 08 =1 474 INC R0 ; Point to ReplyBuffer(1) 0254 7618 =1 475 MOV @R0, #18H ; Reply with a recognizable (arbitary) value 0256 22 =1 476 RET 0257 =1 477 Set_Idle: ; Host wants to tell us how often we should talk 0257 3000E0 =1 478 JNB Configured, Invalid ; Need to be Configured to do this command 025A F541 =1 479 MOV Idle_Time, A 025C 22 =1 480 RET ; Handshake with host 025D =1 481 Get_Idle: ; Host must have forgotten what he told us to do 025D 3000DA =1 482 JNB Configured, Invalid ; Need to be Configured to do this command 0260 08 =1 483 INC R0 ; Point to ReplyBuffer(1) 0261 A641 =1 484 MOV @R0, Idle_Time 0263 22 =1 485 RET 0264 =1 486 Get_Configuration: 0264 3000D5 =1 487 JNB Configured, Reply =1 488 ; If configured return a 1 (via Device_Get_Status) 0267 =1 489 Device_Get_Status: ; Only two bits of Device Status are defined 0267 08 =1 490 INC R0 ; Point to ReplyBuffer(1) 0268 7601 =1 491 MOV @R0, #1 ; Bit 1=Remote Wakeup(=0), Bit 0=Self Powered(=1) 026A 22 =1 492 RET =1 493 026B =1 494 Interface_Get_Status: ; Interface Status is currently defined as 0 026B =1 495 Endpoint_Get_Status: 026B 7602 =1 496 MOV @R0, #2 026D 22 =1 497 RET 026E =1 498 Set_Configuration: ; Valid values are 0 and 1 026E E5F0 =1 499 MOV A, B ; Get LOW(wValue) 0270 6006 =1 500 JZ Deconfigured 0272 14 =1 501 DEC A 0273 70C5 =1 502 JNZ Invalid 0275 D200 =1 503 SETB Configured 0277 22 =1 504 RET 0278 =1 505 Deconfigured: 0278 C200 =1 506 CLR Configured 027A 22 =1 507 RET 027B =1 508 Get_Descriptor: ; Host wants to know who/what we are 027B D203 =1 509 SETB IsDescriptor 027D 14 =1 510 DEC A ; Valid Values are 1, 2 and 3 027E 9002C5 =1 511 MOV DPTR, #DeviceDescriptor 0281 60B9 =1 512 JZ Reply 0283 14 =1 513 DEC A 0284 9002D7 =1 514 MOV DPTR, #ConfigurationDescriptor 0287 60B3 =1 515 JZ Reply 0289 14 =1 516 DEC A 028A 70AE =1 517 JNZ Invalid A51 MACRO ASSEMBLER STEPPER 22/07/99 14:17:14 PAGE 9 =1 518 ; Request is for a String Descriptor 028C 900309 =1 519 MOV DPTR, #String0 ; Point to String 0 028F E5F0 =1 520 MOV A, B ; Get String Index 0291 =1 521 NextString: 0291 601E =1 522 JZ FixUpthenReply 0293 F540 =1 523 MOV Temp, A ; Save String Index 0295 31CB =1 524 CALL NextDPTR 0297 E0 =1 525 MOVX A, @DPTR ; Get the String Length (= 0 means we're at Backsto p) 0298 60A0 =1 526 JZ Invalid ; Asked for a string I don't have 029A E540 =1 527 MOV A, Temp 029C 14 =1 528 DEC A 029D 80F2 =1 529 JMP NextString ; Check if we are there yet 029F =1 530 Get_Class_Descriptor: ; Valid values are 21H, 22H, 23H for Class Request 029F D203 =1 531 SETB IsDescriptor 02A1 C3 =1 532 CLR C 02A2 9421 =1 533 SUBB A, #21H 02A4 9002E9 =1 534 MOV DPTR, #HIDDescriptor 02A7 6093 =1 535 JZ Reply 02A9 14 =1 536 DEC A 02AA 9002F2 =1 537 MOV DPTR, #ReportDescriptor 02AD 608D =1 538 JZ Reply =1 539 ; DEC A ; This example does not use Physical Descriptors =1 540 ; JZ Send_Physical_Descriptor 02AF 8089 =1 541 JMP Invalid =1 542 ; =1 543 ; Error check: this MUST be on within a page of CommandTable 00B7 =1 544 WithinSamePage EQU $ - CommandTable =1 545 ; 02B1 =1 546 FixUpthenReply: ; EZ-USB Rev D has a String Descriptor bug =1 547 ; Need to fill the IN0BUF (@ 7F00H) myself 02B1 E0 =1 548 MOVX A, @DPTR ; Get the string length 02B2 FF =1 549 MOV R7, A ; Save counter 02B3 F5F0 =1 550 MOV B, A 02B5 7800 =1 551 MOV R0, #LOW(EP0InBuffer) ; PageReg = 7FH = HIGH(EP0InBuffer) 02B7 F2 =1 552 CopySD: MOVX @R0, A 02B8 08 =1 553 INC R0 02B9 A3 =1 554 INC DPTR 02BA E0 =1 555 MOVX A, @DPTR 02BB DFFA =1 556 DJNZ R7, CopySD =1 557 ; Fixup complete, get back to the program flow 02BD D0E0 =1 558 POP ACC ; Get rid of the return address 02BF D0E0 =1 559 POP ACC 02C1 E5F0 =1 560 MOV A, B ; Retrieve byte count 02C3 21A9 =1 561 JMP SendEP0InBuffer 562 $INCLUDE(DTables.A51) =1 563 ; This module declares the descriptors =1 564 ; =1 565 ; This example has one Device Descriptor with: =1 566 ; One Configuration - single IN port and single OUT port =1 567 ; One Interface - there is only one method of accessing the ports =1 568 ; One HID Descriptor - to make PC host software simpler =1 569 ; No Endpoint Descriptors - HID Output Reports use EP0 =1 570 ; One Report Descriptor - three bytes OUT =1 571 ; Multiple Sting Descriptors - to aid the user =1 572 ; ---- =1 573 CSEG 02C5 =1 574 DeviceDescriptor: 02C5 1201 =1 575 DB 18, 1 ; Length, Type 02C7 0101 =1 576 DW 101H ; USB Rev 1.1 02C9 000000 =1 577 DB 0, 0, 0 ; Class, Subclass and Protocol 02CC 40 =1 578 DB 64 ; EP0 size 02CD 4242 =1 579 DW 4242H, 1, 1 ; Vendor ID, Product ID and Version 02CF 0001 02D1 0001 02D3 010200 =1 580 DB 1, 2, 0 ; Manufacturer, Product & Serial# Names A51 MACRO ASSEMBLER STEPPER 22/07/99 14:17:14 PAGE 10 02D6 01 =1 581 DB 1 ; #Configs 02D7 =1 582 ConfigurationDescriptor: 02D7 0902 =1 583 DB 9, 2 ; Length, Type 02D9 1B00 =1 584 DB LOW(ConfigLength), HIGH(ConfigLength) 02DB 010100 =1 585 DB 1, 1, 0 ; #Interfaces, Configuration#, Config. Name 02DE 80 =1 586 DB 10000000b ; Attributes = Bus Powered 02DF 32 =1 587 DB 50 ; Max. Power is 50x2 = 100mA 02E0 =1 588 InterfaceDescriptor: 02E0 0904 =1 589 DB 9, 4 ; Length, Type 02E2 000000 =1 590 DB 0, 0, 0 ; No alternate setting, HID OUTPUT uses EP0 02E5 03 =1 591 DB 3 ; Class = Human Interface Device 02E6 0000 =1 592 DB 0, 0 ; Subclass and Protocol 02E8 00 =1 593 DB 0 ; Interface Name 02E9 =1 594 HIDDescriptor: 02E9 0921 =1 595 DB 9, 21H ; Length, Type 02EB 0001 =1 596 DB 0, 1 ; HID Class Specification compliance 02ED 00 =1 597 DB 0 ; Country localization (=none) 02EE 01 =1 598 DB 1 ; Number of descriptors to follow 02EF 22 =1 599 DB 22H ; And it's a Report descriptor 02F0 1700 =1 600 DB LOW(ReportLength), HIGH(ReportLength) 001B =1 601 ConfigLength EQU $ - ConfigurationDescriptor =1 602 02F2 =1 603 ReportDescriptor: ; Generated with HID Tool, copied to here 02F2 0600FF =1 604 DB 6, 0, 0FFH ; Usage_Page (Vendor Defined) 02F5 0901 =1 605 DB 9, 1 ; Usage (I/O Device) 02F7 A101 =1 606 DB 0A1H, 1 ; Collection (Application) 02F9 1901 =1 607 DB 19H, 1 ; Usage_Minimum 02FB 2902 =1 608 DB 29H, 2 ; Usage_Maximum 02FD 1500 =1 609 DB 15H, 0 ; Logical_Minimum (0) 02FF 26FF00 =1 610 DB 26H, 255, 0 ; Logical_Maximum (255) 0302 7508 =1 611 DB 75H, 8 ; Report_Size (8) 0304 9503 =1 612 DB 95H, 3 ; Report_Count (3) = Motor Control 0306 9102 =1 613 DB 91H, 2 ; Output (Data,Var,Abs) 0308 C0 =1 614 DB 0C0H ; End_Collection 0017 =1 615 ReportLength EQU $-ReportDescriptor =1 616 0309 =1 617 String0: ; Declare the UNICODE strings 0309 04030904 =1 618 DB 4, 3, 9, 4 ; Only English language strings supported 030D =1 619 String1: ; Manufacturer 030D 2C03 =1 620 DB (String2-String1),3 ; Length, Type 030F 55005300 =1 621 DB "U",0,"S",0,"B",0," ",0,"D",0,"e",0,"s",0,"i",0,"g",0,"n",0," ", 0 0313 42002000 0317 44006500 031B 73006900 031F 67006E00 0323 2000 0325 42007900 =1 622 DB "B",0,"y",0," ",0,"E",0,"x",0,"a",0,"m",0,"p",0,"l",0,"e",0 0329 20004500 032D 78006100 0331 6D007000 0335 6C006500 0339 =1 623 String2: ; Product Name 0339 1C03 =1 624 DB (EndOfDescriptors-String2),3 033B 53007400 =1 625 DB "S",0,"t",0,"e",0,"p",0,"p",0,"e",0,"r",0," ",0 033F 65007000 0343 70006500 0347 72002000 034B 4D006F00 =1 626 DB "M",0,"o",0,"t",0,"o",0,"r",0 034F 74006F00 0353 7200 0355 =1 627 EndOfDescriptors: 0355 0000 =1 628 DW 0 ; Backstop for String Descriptors =1 629 =1 630 =1 631 632 $INCLUDE(Main.A51) A51 MACRO ASSEMBLER STEPPER 22/07/99 14:17:14 PAGE 11 =1 633 ; This module initializes the microcontroller then executes MAIN forever =1 634 ; =1 635 0357 =1 636 Reset: 0357 7581EB =1 637 MOV SP, #235 ; Initialize the Stack at top of internal memory 035A 75927F =1 638 MOV PageReg, #7FH ; Needed to use MOVX @Ri =1 639 035D 78D6 =1 640 MOV R0, #LOW(USBControl) ; Simulate a disconnect 035F E2 =1 641 MOVX A, @R0 0360 54F3 =1 642 ANL A, #11110011b ; Clear DISCON, DISCOE 0362 F2 =1 643 MOVX @R0, A 0363 120390 =1 644 CALL Wait100msec ; Give the host time to react 0366 E2 =1 645 MOVX A, @R0 ; Reconnect with this new identity 0367 4406 =1 646 ORL A, #00000110b ; Set DISCOE to enable pullup resistor 0369 F2 =1 647 MOVX @R0, A ; Set RENUM so that 8051 handles USB requests 036A E4 =1 648 CLR A 036B F520 =1 649 MOV FLAGS, A ; Start in Default state 036D =1 650 InitializeIOSystem: ; This example uses only Port A output 036D 7893 =1 651 MOV R0, #LOW(PortA_Config) ; PageReg = 7F = HIGH(PortA_Config) 036F E4 =1 652 CLR A 0370 F2 =1 653 MOVX @R0, A ; No alternate functions 0371 799C =1 654 MOV R1, #LOW(PortA_OE) 0373 F4 =1 655 CPL A ; = 0FFH 0374 F3 =1 656 MOVX @R1, A ; Enable PortA for Output 0375 =1 657 InitializeInterruptSystem: ; First initialize the USB level 0375 78AC =1 658 MOV R0, #LOW(IN07IEN) 0377 F2 =1 659 MOVX @R0, A ; Disable interrupts from IN Endpoints 0-7 0378 08 =1 660 INC R0 0379 F2 =1 661 MOVX @R0, A ; Disable interrupts from OUT Endpoints 0-7 037A 08 =1 662 INC R0 037B 7403 =1 663 MOV A, #00000011b 037D F2 =1 664 MOVX @R0, A ; Enable (Resume, Suspend,) SOF and SUDAV INTs 037E 08 =1 665 INC R0 037F 7401 =1 666 MOV A, #00000001b 0381 F2 =1 667 MOVX @R0, A ; Enable Auto Vectoring for USB interrupts 0382 78AA =1 668 MOV R0, #LOW(OUT07IRQ) 0384 74FF =1 669 MOV A, #0FFH 0386 F2 =1 670 MOVX @R0, A ; Clear out any pending interrupts =1 671 ; Now enable the main level 0387 75E801 =1 672 MOV EIE, #00000001b ; Enable INT2 = USB Interrupt (only) 038A 75A8C0 =1 673 MOV EI, #11000000b ; Enable interrupt subsystem (and Ser1 for Dscope) =1 674 =1 675 ; Initialization Complete. =1 676 ; 038D =1 677 MAIN: 038D 00 =1 678 NOP ; Not much of a main loop for this example 038E 80FD =1 679 JMP MAIN ; All actions are initiated by interrupts =1 680 ; We are a slave, we wait to be told what to do =1 681 0390 =1 682 Wait100msec: 0390 754064 =1 683 MOV Temp, #100 0393 =1 684 Wait1msec: ; A delay loop 0393 90FB50 =1 685 MOV DPTR, #-1200 0396 A3 =1 686 More: INC DPTR ; 3 cycles 0397 E582 =1 687 MOV A, DPL ; + 2 0399 4583 =1 688 ORL A, DPH ; + 2 039B 70F9 =1 689 JNZ More ; + 3 = 10 cycles x 1200 = 1msec 039D D540F3 =1 690 DJNZ Temp, Wait1msec 03A0 22 =1 691 RET =1 692 03A1 =1 693 ProcessOutputReport: ; A Report has just been received =1 694 ; The report is three bytes long =1 695 ; Save the values for the INTERRUPT service routine 03A1 7846 =1 696 MOV R0, #MotorControl ; Initialize the pointers to be used 03A3 907EC0 =1 697 MOV DPTR, #EP0OutBuffer ; Point to the Report 03A6 7F03 =1 698 MOV R7, #3 A51 MACRO ASSEMBLER STEPPER 22/07/99 14:17:14 PAGE 12 03A8 E0 =1 699 CopyOR: MOVX A, @DPTR ; Retrieve Report Byte 1 03A9 F6 =1 700 MOV @R0, A 03AA A3 =1 701 INC DPTR 03AB 08 =1 702 INC R0 03AC DFFA =1 703 DJNZ R7, CopyOR 03AE 22 =1 704 RET =1 705 03AF =1 706 CreateInputReport: =1 707 ; Not used in this example =1 708 =1 709 710 $INCLUDE(Timer.A51) =1 711 ; This module services the real time interrupt =1 712 ; =1 713 ; Get a Real Time interrupt every One millisecond (using SOF interrupt) =1 714 ; =1 715 ; Pulse the stepper motor every 10msec (100Hz) if required =1 716 ; EZ-USB PortA drives an Allegro 8219 =1 717 ; Phase A is connected to bits 5,4 & 3, Phase B to bits 2,1 & 0 =1 718 ; Bits 5 and 2 are PHASE =1 719 ; Bits 4:3 and 1:0 are I1:I0 current inputs =1 720 ; 03AF =1 721 ServiceTimerRoutine: 03AF D54924 =1 722 DJNZ Msec_counter, Done ; Only need to step every 10msec 03B2 75490A =1 723 MOV Msec_counter, #10 ; Reinitialize =1 724 03B5 7847 =1 725 MOV R0, #MotorControl+1 ; Point to LS byte of count 03B7 7948 =1 726 MOV R1, #MotorControl+2 ; Point to MS byte of count 03B9 E6 =1 727 MOV A, @R0 03BA 47 =1 728 ORL A, @R1 03BB 6019 =1 729 JZ Done ; No stepping required 03BD =1 730 StepTheMotor: 03BD 16 =1 731 DEC @R0 ; Unfortunately, no flags are set 03BE E6 =1 732 MOV A, @R0 03BF F4 =1 733 CPL A ; Test for LS = FF 03C0 6001 =1 734 JZ STM1 03C2 17 =1 735 DEC @R1 ; Underflow on LS, therefore adjust MS byte 03C3 E546 =1 736 STM1: MOV A, MotorControl ; Get the direction indicator 03C5 7002 =1 737 JNZ Clockwise 03C7 74FF =1 738 MOV A, #-1 ; CounterClockwise = backup one 03C9 =1 739 Clockwise: 03C9 2549 =1 740 ADD A, CurrentPosition 03CB 540F =1 741 ANL A, #0FH ; Table is only 16 entries long 03CD F549 =1 742 MOV CurrentPosition, A 03CF 9003D7 =1 743 MOV DPTR, #StepperTable 03D2 93 =1 744 MOVC A, @A + DPTR ; Index into table 03D3 7899 =1 745 MOV R0, #Low(PortA_Pins) 03D5 F2 =1 746 MOVX @R0, A ; Select the new step position 03D6 22 =1 747 Done: RET =1 748 03D7 =1 749 StepperTable: 03D7 07 =1 750 DB 000111b ; 0 = Up 03D8 02 =1 751 DB 000010b ; 1 03D9 09 =1 752 DB 001001b ; 2 03DA 10 =1 753 DB 010000b ; 3 03DB 18 =1 754 DB 011000b ; 4 = Right 03DC 30 =1 755 DB 110000b ; 5 03DD 29 =1 756 DB 101001b ; 6 03DE 22 =1 757 DB 100010b ; 7 03DF 23 =1 758 DB 100011b ; 8 = Down 03E0 26 =1 759 DB 100110b ; 9 03E1 2D =1 760 DB 101101b ; 10 03E2 34 =1 761 DB 110100b ; 11 03E3 3C =1 762 DB 111100b ; 12 = Left 03E4 14 =1 763 DB 010100b ; 13 03E5 0D =1 764 DB 001101b ; 14 A51 MACRO ASSEMBLER STEPPER 22/07/99 14:17:14 PAGE 13 03E6 06 =1 765 DB 000110b ; 15 =1 766 =1 767 768 769 END A51 MACRO ASSEMBLER STEPPER 22/07/99 14:17:14 PAGE 14 SYMBOL TABLE LISTING ------ ----- ------- N A M E T Y P E V A L U E ATTRIBUTES ACC . . . . . . . . . . . D ADDR 00E0H A B . . . . . . . . . . . . D ADDR 00F0H A BADREQUEST. . . . . . . . C ADDR 01C6H A BUMPDPTR. . . . . . . . . C ADDR 01CCH A CLEARINT2 . . . . . . . . C ADDR 0119H A CLOCKWISE . . . . . . . . C ADDR 03C9H A COMMANDTABLE. . . . . . . C ADDR 01FAH A CONFIGLENGTH. . . . . . . N NUMB 001BH A CONFIGURATIONDESCRIPTOR . C ADDR 02D7H A CONFIGURED. . . . . . . . B ADDR 0020H.0 A COPYOR. . . . . . . . . . C ADDR 03A8H A COPYRB. . . . . . . . . . C ADDR 01A0H A COPYSD. . . . . . . . . . C ADDR 02B7H A CORRECTSUBROUTINE . . . . C ADDR 01D5H A CREATEINPUTREPORT . . . . C ADDR 03AFH A CURRENTPOSITION . . . . . D ADDR 0049H A DECONFIGURED. . . . . . . C ADDR 0278H A DEVICEDESCRIPTOR. . . . . C ADDR 02C5H A DEVICE_CLEAR_FEATURE. . . C ADDR 023AH A DEVICE_GET_STATUS . . . . C ADDR 0267H A DEVICE_SET_FEATURE. . . . C ADDR 023AH A DONE. . . . . . . . . . . C ADDR 03D6H A DPH . . . . . . . . . . . D ADDR 0083H A DPL . . . . . . . . . . . D ADDR 0082H A DPS . . . . . . . . . . . D ADDR 0086H A EI. . . . . . . . . . . . D ADDR 00A8H A EICON . . . . . . . . . . D ADDR 00D8H A EIE . . . . . . . . . . . D ADDR 00E8H A ENDOFDESCRIPTORS. . . . . C ADDR 0355H A ENDPOINT_CLEAR_FEATURE. . C ADDR 023CH A ENDPOINT_GET_STATUS . . . C ADDR 026BH A ENDPOINT_SET_FEATURE. . . C ADDR 023AH A ENDPOINT_SYNC_FRAME . . . C ADDR 023AH A EP0CONTROL. . . . . . . . N NUMB 7FB4H A EP0INBUFFER . . . . . . . N NUMB 7F00H A EP0IN_ISR . . . . . . . . C ADDR 0118H A EP0OUTBUFFER. . . . . . . N NUMB 7EC0H A EP0OUT_ISR. . . . . . . . C ADDR 0118H A EP1INBUFFER . . . . . . . N NUMB 7E80H A EP1IN_ISR . . . . . . . . C ADDR 0118H A EP1OUT_ISR. . . . . . . . C ADDR 0118H A EP2IN_ISR . . . . . . . . C ADDR 0118H A EP2OUT_ISR. . . . . . . . C ADDR 0118H A EP3IN_ISR . . . . . . . . C ADDR 0118H A EP3OUT_ISR. . . . . . . . C ADDR 0118H A EP4IN_ISR . . . . . . . . C ADDR 0118H A EP4OUT_ISR. . . . . . . . C ADDR 0118H A EP5IN_ISR . . . . . . . . C ADDR 0118H A EP5OUT_ISR. . . . . . . . C ADDR 0118H A EP6IN_ISR . . . . . . . . C ADDR 0118H A EP6OUT_ISR. . . . . . . . C ADDR 0118H A EP7IN_ISR . . . . . . . . C ADDR 0118H A EP7OUT_ISR. . . . . . . . C ADDR 0118H A EXIF. . . . . . . . . . . D ADDR 0091H A EXITISR . . . . . . . . . C ADDR 014BH A EXPIRED_TIME. . . . . . . D ADDR 0042H A FIXUPTHENREPLY. . . . . . C ADDR 02B1H A FLAGS . . . . . . . . . . D ADDR 0020H A GET_CLASS_DESCRIPTOR. . . C ADDR 029FH A GET_CONFIGURATION . . . . C ADDR 0264H A A51 MACRO ASSEMBLER STEPPER 22/07/99 14:17:14 PAGE 15 GET_DESCRIPTOR. . . . . . C ADDR 027BH A GET_IDLE. . . . . . . . . C ADDR 025DH A GET_INTERFACE . . . . . . C ADDR 023AH A GET_PROTOCOL. . . . . . . C ADDR 023AH A GET_REPORT. . . . . . . . C ADDR 0250H A HANDSHAKE . . . . . . . . C ADDR 01ADH A HIDDESCRIPTOR . . . . . . C ADDR 02E9H A I2CCONTROL. . . . . . . . N NUMB 7FA5H A I2CDATA . . . . . . . . . N NUMB 7FA6H A I2CDATABYTE . . . . . . . D ADDR 0046H A I2C_ISR . . . . . . . . . C ADDR 0118H A IDLE_TIME . . . . . . . . D ADDR 0041H A IN07IEN . . . . . . . . . N NUMB 7FACH A IN07IRQ . . . . . . . . . N NUMB 7FA9H A IN0BYTECOUNT. . . . . . . N NUMB 7FB5H A IN1BYTECOUNT. . . . . . . N NUMB 7FB7H A INITIALIZEINTERRUPTSYSTEM C ADDR 0375H A INITIALIZEIOSYSTEM. . . . C ADDR 036DH A INT0_ISR. . . . . . . . . C ADDR 0118H A INT1_ISR. . . . . . . . . C ADDR 0118H A INT4_ISR. . . . . . . . . C ADDR 0118H A INT5_ISR. . . . . . . . . C ADDR 0118H A INT6_ISR. . . . . . . . . C ADDR 0118H A INTERFACEDESCRIPTOR . . . C ADDR 02E0H A INTERFACE_CLEAR_FEATURE . C ADDR 023AH A INTERFACE_GET_STATUS. . . C ADDR 026BH A INTERFACE_SET_FEATURE . . C ADDR 023AH A INVALID . . . . . . . . . C ADDR 023AH A ISDESCRIPTOR. . . . . . . B ADDR 0020H.3 A LEDBUFFER . . . . . . . . D ADDR 0046H A LEDSTROBE . . . . . . . . D ADDR 0047H A LEDVALUE. . . . . . . . . D ADDR 0048H A LIGHTVALUES . . . . . . . D ADDR 0046H A LIMITVALUES . . . . . . . D ADDR 0046H A LOADSUDPTR. . . . . . . . C ADDR 01B8H A MAIN. . . . . . . . . . . C ADDR 038DH A MONITORSPACE. . . . . . . D ADDR 0021H A MORE. . . . . . . . . . . C ADDR 0396H A MOTORCONTROL. . . . . . . D ADDR 0046H A MSEC_COUNTER. . . . . . . D ADDR 0049H A NEXTDPTR. . . . . . . . . C ADDR 01CBH A NEXTSTRING. . . . . . . . C ADDR 0291H A NOTB5 . . . . . . . . . . C ADDR 0181H A NOT_USED. . . . . . . . . C ADDR 0118H A OLD_BUTTONS . . . . . . . D ADDR 0046H A OUT07IEN. . . . . . . . . N NUMB 7FADH A OUT07IRQ. . . . . . . . . N NUMB 7FAAH A OUT0BYTECOUNT . . . . . . N NUMB 7FC5H A OVERLAY . . . . . . . . . D ADDR 0046H A PAGEREG . . . . . . . . . D ADDR 0092H A PCON. . . . . . . . . . . D ADDR 0087H A PORTA_CONFIG. . . . . . . N NUMB 7F93H A PORTA_OE. . . . . . . . . N NUMB 7F9CH A PORTA_OUT . . . . . . . . N NUMB 7F96H A PORTA_PINS. . . . . . . . N NUMB 7F99H A PORTB_CONFIG. . . . . . . N NUMB 7F94H A PORTB_OE. . . . . . . . . N NUMB 7F9DH A PORTB_PINS. . . . . . . . N NUMB 7F9AH A PROCESSOUTPUTREPORT . . . C ADDR 03A1H A PSW . . . . . . . . . . . D ADDR 00D0H A REPLY . . . . . . . . . . C ADDR 023CH A REPLYBUFFER . . . . . . . D ADDR 0043H A REPORTDESCRIPTOR. . . . . C ADDR 02F2H A REPORTLENGTH. . . . . . . N NUMB 0017H A RESERVED. . . . . . . . . C ADDR 0118H A RESET . . . . . . . . . . C ADDR 0357H A A51 MACRO ASSEMBLER STEPPER 22/07/99 14:17:14 PAGE 16 SENDDATA. . . . . . . . . B ADDR 0020H.2 A SENDEP0INBUFFER . . . . . C ADDR 01A9H A SERVICESETUPPACKET. . . . C ADDR 0169H A SERVICETIMERROUTINE . . . C ADDR 03AFH A SETEP0CONTROL . . . . . . C ADDR 01B0H A SETUPDAT. . . . . . . . . N NUMB 7FE8H A SET_CLASS_DESCRIPTOR. . . C ADDR 023AH A SET_CONFIGURATION . . . . C ADDR 026EH A SET_DESCRIPTOR. . . . . . C ADDR 023AH A SET_IDLE. . . . . . . . . C ADDR 0257H A SET_INTERFACE . . . . . . C ADDR 023AH A SET_PROTOCOL. . . . . . . C ADDR 023AH A SET_REPORT. . . . . . . . C ADDR 023DH A SKIP. . . . . . . . . . . C ADDR 01D4H A SOF_ISR . . . . . . . . . C ADDR 0158H A SP. . . . . . . . . . . . D ADDR 0081H A STALL . . . . . . . . . . B ADDR 0020H.1 A STARTXFER . . . . . . . . C ADDR 01ACH A STEPPERMOTORCONTROLLER. . N NUMB ----- STEPPERTABLE. . . . . . . C ADDR 03D7H A STEPTHEMOTOR. . . . . . . C ADDR 03BDH A STM1. . . . . . . . . . . C ADDR 03C3H A STRING0 . . . . . . . . . C ADDR 0309H A STRING1 . . . . . . . . . C ADDR 030DH A STRING2 . . . . . . . . . C ADDR 0339H A SUDAV_ISR . . . . . . . . C ADDR 013CH A SUDPTR. . . . . . . . . . N NUMB 7FD4H A SUSPEND_ISR . . . . . . . C ADDR 0129H A SUTOK_ISR . . . . . . . . C ADDR 0118H A TEMP. . . . . . . . . . . D ADDR 0040H A TIMER0_ISR. . . . . . . . C ADDR 0118H A TIMER1_ISR. . . . . . . . C ADDR 0118H A TIMER2_ISR. . . . . . . . C ADDR 0118H A UART0_ISR . . . . . . . . C ADDR 0118H A UART1_ISR . . . . . . . . C ADDR 0118H A USBCONTROL. . . . . . . . N NUMB 7FD6H A USBIEN. . . . . . . . . . N NUMB 7FAEH A USBIRQ. . . . . . . . . . N NUMB 7FABH A USBRESET_ISR. . . . . . . C ADDR 0120H A USB_ISR . . . . . . . . . C ADDR 0100H A WAIT100MSEC . . . . . . . C ADDR 0390H A WAIT1MSEC . . . . . . . . C ADDR 0393H A WAIT4D. . . . . . . . . . C ADDR 0247H A WAKEUP_ISR. . . . . . . . C ADDR 0139H A WITHINSAMEPAGE. . . . . . N NUMB 00B7H A REGISTER BANK(S) USED: 0 ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S)