📄 hidtherm.lst
字号:
;**********************************
; set port I/O configuration
; setup SPI and capture timer pins
0054 19 02 [04] mov A, (NC)
0056 2A 0B [05] iowr port0_mode1
0058 19 BC [04] mov A, (EE_SCK | EE_SI | TEMP_SS| EE_SS | RFOUT)
005A 2A 0A [05] iowr port0_mode0
005C 19 AA [04] mov A, (EE_SCK | EE_SI | EE_SS | NC)
005E 2A 00 [05] iowr port0
; setup LED and buttons pins
0060 19 FF [04] mov A, (SWITCH3 | ACTIVE | SWITCH4 | ENUM | SWITCH5 | AUX01 | NC | AUX02)
0062 2A 0D [05] iowr port1_mode1
0064 19 55 [04] mov A, (ACTIVE | ENUM | AUX01 | AUX02)
0066 2A 0C [05] iowr port1_mode0
0068 19 BF [04] mov A, (SWITCH3 | SWITCH4 | ENUM | SWITCH5 | AUX01 | NC | AUX02)
006A 2A 01 [05] iowr port1
;**********************************
; read LED value from SPI EEPROM
006C 19 01 [04] mov A, 01h
006E 31 3F [05] mov [eeprom_addr], A
0070 94 B2 [10] call Spi_eeprom_read
0072 1A 41 [05] mov A, [eeprom_data]
0074 10 0F [04] and A, 0Fh ; mask off upper bits in case this is
0076 31 3C [05] mov [led_brightness], A ; the first time reading the EEPROM
;**********************************
; send Write Enable (WREN) command to EEPROM
0078 19 06 [04] mov A, EEPROM_WREN
007A 31 41 [05] mov [eeprom_data], A
007C 94 ED [10] call Spi_eeprom_cmd
;**********************************
; set temperature sensor for continuous read mode
007E 19 E8 [04] mov A, (E0h | R2 )
0080 31 43 [05] mov [temp_data], A
0082 19 00 [04] mov A, TEMP_CTRL
0084 31 42 [05] mov [temp_addr], A
0086 95 2E [10] call Spi_temp_write
;**********************************
; enable USB address for endpoint 0
0088 19 80 [04] mov A, ADDRESS_ENABLE
008A 2A 10 [05] iowr usb_address
;**********************************
; enable global interrupts
008C 19 07 [04] mov A, (1MS_INT | USB_RESET_INT | 128US_INT)
008E 2A 20 [05] iowr global_int
0090 19 01 [04] mov A, EP0_INT
0092 2A 21 [05] iowr endpoint_int
0094 72 [04] ei
;**********************************
; enable USB pullup resistor
0095 19 40 [04] mov A, VREG_ENABLE
0097 2A 1F [05] iowr usb_status
0099 task_loop:
;**********************************
; main loop watchdog clear
0099 2A 26 [05] iowr watchdog
;**********************************
; button debounce task
009B 1A 31 [05] mov A, [button_machine] ; read buttons every millisecond
009D E9 01 [07] jacc button_machine_jumptable
009F button_task:
009F 1A 2C [05] mov A, [current_button_state] ; read button states
00A1 10 08 [04] and A, SWITCH5
00A3 17 36 [07] cmp A, [last_button_state]
00A5 A0 AF [05] jz button_state_same:
00A7 button_state_different: ; if the button state has changed, then
00A7 31 36 [05] mov [last_button_state], A ; reset the debounce timer and set
00A9 19 00 [04] mov A, 00h ; last button value to the one just read
00AB 31 28 [05] mov [debounce_count], A
00AD 80 CF [05] jmp button_task_done
00AF button_state_same:
00AF 19 0E [04] mov A, BUTTON_DEBOUNCE - 1 ; if at debounce count-1 then send
00B1 17 28 [07] cmp A, [debounce_count] ; new value to host
00B3 A0 BF [05] jz set_button_event
00B5 increment_debounce_counter: ; otherwise increment debounce count
00B5 1A 28 [05] mov A, [debounce_count] ; if it's not already at the
00B7 16 0F [05] cmp A, BUTTON_DEBOUNCE ; BUTTON_DEBOUNCE value
00B9 A0 CF [05] jz button_task_done
00BB 23 28 [07] inc [debounce_count]
00BD 80 CF [05] jmp button_task_done
00BF set_button_event:
00BF 23 28 [07] inc [debounce_count]
00C1 19 00 [04] mov A, 00h
00C3 31 33 [05] mov [temp], A
00C5 switch5_button:
00C5 1A 2C [05] mov A, [current_button_state]
00C7 10 08 [04] and A, SWITCH5
00C9 B0 CF [05] jnz button_task_done
00CB 19 01 [04] mov A, 01h
00CD 37 F2 [07] xor [BUTTON_DATA], A
00CF button_task_done:
00CF 19 00 [04] mov A, NO_BUTTON_DATA_PENDING
00D1 31 31 [05] mov [button_machine], A
00D3 no_button_task:
;**********************************
; Store LED Value task
00D3 1A 3E [05] mov A, [eeprom_flag]
00D5 16 02 [05] cmp A, EEPROM_DATA_AVAILABLE
00D7 B0 E7 [05] jnz led_store_task_done
00D9 store_led_value:
; setup eeprom address and data
00D9 19 01 [04] mov A, 01h
00DB 31 3F [05] mov [eeprom_addr], A
00DD 1A 3C [05] mov A, [led_brightness]
00DF 31 41 [05] mov [eeprom_data], A
; write byte to SPI EEPROM
00E1 94 71 [10] call Spi_eeprom_write
; flag no more data available
00E3 19 00 [04] mov A, NO_EEPROM_DATA_AVAILABLE
00E5 31 3E [05] mov [eeprom_flag], A
00E7 led_store_task_done:
;**********************************
; endpoint 1 task
; this task sends data out endpoint 1 if the endpoint
; is configured and not set to stall
00E7 1A 34 [05] mov A, [event_machine]
00E9 E9 05 [07] jacc event_machine_jumptable
00EB no_data_report_pending:
; if not configured then skip data transfer
00EB 1A 23 [05] mov A, [configuration]
00ED 16 01 [05] cmp A, 01h
00EF B1 26 [05] jnz data_report_pending
; if stalled then skip data transfer
00F1 1A 25 [05] mov A, [ep1_stall]
00F3 16 FF [05] cmp A, FFh
00F5 A1 26 [05] jz data_report_pending
;**********************************
; temperature read task
00F7 19 02 [04] mov A, TEMP_INT ; read integer part of temperature
00F9 31 42 [05] mov [temp_addr], A
00FB 95 59 [10] call Spi_temp_read
00FD 1A 43 [05] mov A, [temp_data]
00FF 1F [04] XPAGE
0100 31 F0 [05] mov [ep1_dmabuff0], A
0102 19 01 [04] mov A, TEMP_FRAC ; read fractional part of temperature
0104 31 42 [05] mov [temp_addr], A
0106 95 59 [10] call Spi_temp_read
0108 1A 43 [05] mov A, [temp_data]
010A 31 F1 [05] mov [ep1_dmabuff1], A
010C 29 00 [05] iord port0
010E 31 F3 [05] mov [ep1_dmabuff3], A
0110 29 01 [05] iord port1
0112 31 F4 [05] mov [ep1_dmabuff4], A
0114 19 08 [04] mov A, 08h ; set endpoint 1 to send 3 bytes
0116 0E 19 [06] or A, [ep1_data_toggle]
0118 2A 13 [05] iowr ep1_count
011A 29 14 [05] iord ep1_mode
011C 10 F0 [04] and A, F0h
011E 0D 0D [04] or A, ACK_IN ; set to ack on endpoint 1
0120 2A 14 [05] iowr ep1_mode
0122 event_task_done:
0122 19 02 [04] mov A, REPORT_PENDING ; clear pending events
0124 31 34 [05] mov [event_machine], A
0126 data_report_pending:
0126 80 99 [05] jmp task_loop
;*******************************************************
;
; Interrupt: bus_reset
; Purpose: The program jumps to this routine when
; the microcontroller has a bus reset.
;
;*******************************************************
0128 Bus_reset:
0128 19 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -