Internal Registers Documentation
This document describes the address, name, and specific purpose of all special function registers in the system.
0. Compare Register (0x00)
| Address | Register Name | Purpose Description | Notes |
|---|---|---|---|
| 0x00 | SYS_REG_COMPARE | Compare function dedicated register | Used as operand for conditional compare instructions |
Description
- Register
R00(address 0x00) is dedicated for comparison functions - Used together with conditional jump instructions (such as
XYZ,DYZ,SDZ,XDZ,BDZ) - Compare instructions use
R00as the primary comparison operand - Comparison result determines whether the program jumps
1. System Status Registers (0x23-0x27)
| Address | Register Name | Purpose Description | Notes |
|---|---|---|---|
| 0x23 | SYS_REG_TIMER_TIME_OUT | Timer timeout status | Non-blocking timer status flag |
| 0x24 | SYS_REG_ADS1115_CHANNELS | ADS1115 channel configuration | Configure which ADC channels to read |
| 0x25 | SYS_REG_D_IO_STATE | Digital I/O status | Current digital input/output port state |
| 0x26 | SYS_REG_D_OUT | Digital output port | Set digital output pin level |
| 0x27 | SYS_REG_D_IN | Digital input port | Read digital input pin level |
2. Display/Drawing Registers (0x28-0x29)
| Address | Register Name | Purpose Description | Notes |
|---|---|---|---|
| 0x28 | SYS_REG_DRAWING_COLOR | Drawing foreground color | Color for drawing operations like lines, rectangles |
| 0x29 | SYS_REG_BACKGROUND_COLOR | Drawing background color | Background color for fill operations |
3. PWM Control Registers (0x2A-0x2D)
| Address | Register Name | Purpose Description | Notes |
|---|---|---|---|
| 0x2A | SYS_REG_PWM_DC_CH0 | Built-in PWM channel 0 duty cycle | MCU internal PWM output, 0-100% |
| 0x2B | SYS_REG_PWM_DC_CH1 | Built-in PWM channel 1 duty cycle | MCU internal PWM output, 0-100% |
| 0x2C | SYS_REG_PWM_DC_CH2 | Built-in PWM channel 2 duty cycle | MCU internal PWM output, 0-100% |
| 0x2D | SYS_REG_PWM_DC_CH3 | Built-in PWM channel 3 duty cycle | MCU internal PWM output, 0-100% |
4. Environmental Sensor Registers (0x2E-0x30) — BME280
| Address | Register Name | Purpose Description | Data Format |
|---|---|---|---|
| 0x2E | SYS_REG_TEMPUERATURE | Temperature value (BME280) | Temperature × 100, e.g.: 25.36℃ → 2536 |
| 0x2F | SYS_REG_HUMIDITY | Humidity value (BME280) | Humidity × 100, e.g.: 65.50% → 6550 |
| 0x30 | SYS_REG_ALTITUDE | Altitude (BME280) | Unit: meters |
5. Color Sensor Registers (0x31-0x33) — TCS3472
| Address | Register Name | Purpose Description | Notes |
|---|---|---|---|
| 0x31 | SYS_REG_COLOR_R | Color sensor red component | R value from TCS3472 (0-65535) |
| 0x32 | SYS_REG_COLOR_G | Color sensor green component | G value from TCS3472 (0-65535) |
| 0x33 | SYS_REG_COLOR_B | Color sensor blue component | B value from TCS3472 (0-65535) |
6. Peripheral Switch Register (0x34)
| Address | Register Name | Purpose Description | Bit Definition |
|---|---|---|---|
| 0x34 | SYS_REG_SWITCH | Peripheral enable switch | See switch bit definition table below |
Peripheral Switch Bit Definition
| Bit | Constant Name | Value | Corresponding Peripheral |
|---|---|---|---|
| bit0 | SYS_PER_SWITCH_ADS1115 | 0x001 | ADS1115 ADC |
| bit1 | SYS_PER_SWITCH_BME280 | 0x002 | BME280 Temperature/Humidity |
| bit2 | SYS_PER_SWITCH_DS1307 | 0x004 | DS1307 RTC Clock |
| bit3 | SYS_PER_SWITCH_TCS3472 | 0x008 | TCS3472 Color Sensor |
| bit4 | SYS_PER_SWITCH_PCA9685 | 0x010 | PCA9685 PWM Driver |
| bit6 | SYS_PER_SWITCH_WS2812B | 0x040 | WS2812B LED |
| bit7 | SYS_PER_SWITCH_LCD1602 | 0x080 | LCD1602 LCD Screen |
| bit8 | SYS_PER_SWITCH_SSD1306 | 0x100 | SSD1306 OLED |
| bit9 | SYS_PER_SWITCH_HUSKY_LENS | 0x200 | HuskyLens AI Vision |
| bit11 | SYS_PER_SWITCH_MELODY | 0x800 | Buzzer Melody |
7. Ultrasonic Sensor Registers (0x35-0x37)
| Address | Register Name | Purpose Description | Notes |
|---|---|---|---|
| 0x35 | SYS_REG_ULTRASONIC0 | Ultrasonic sensor 0 distance | Unit: millimeters |
| 0x36 | SYS_REG_ULTRASONIC1 | Ultrasonic sensor 1 distance | Unit: millimeters |
| 0x37 | SYS_REG_ULTRASONIC2 | Ultrasonic sensor 2 distance | Unit: millimeters |
8. RTC Clock Registers (0x38-0x3E) — DS1307
| Address | Register Name | Purpose Description | Data Range |
|---|---|---|---|
| 0x38 | SYS_REG_YEAR | RTC Year | Example: 26 represents year 2026 |
| 0x39 | SYS_REG_MONTH | RTC Month | 1-12 |
| 0x3A | SYS_REG_DATE | RTC Date | 1-31 |
| 0x3B | SYS_REG_DAY | RTC Weekday | 1-7 |
| 0x3C | SYS_REG_HOUR | RTC Hour | 0-23 |
| 0x3D | SYS_REG_MINUTE | RTC Minute | 0-59 |
| 0x3E | SYS_REG_SECOND | RTC Second | 0-59 |
9. Button Status Register (0x3F)
| Address | Register Name | Purpose Description | Bit Definition |
|---|---|---|---|
| 0x3F | SYS_REG_BUTTON_STATE | Onboard Button State | See button bit definition table below |
Button Bit Definition
| Bit | Constant Name | Value | Corresponding Button |
|---|---|---|---|
| bit0 | BUTTON_BIT_UP | 0x01 | Up |
| bit1 | BUTTON_BIT_BACK | 0x02 | Back |
| bit2 | BUTTON_BIT_LEFT | 0x04 | Left |
| bit3 | BUTTON_BIT_RIGHT | 0x08 | Right |
| bit4 | BUTTON_BIT_DOWN | 0x10 | Down |
| bit5 | BUTTON_BIT_ENTER | 0x20 | Enter |
| bit6 | BUTTON_BIT_FUNC | 0x40 | Function |
| bit7 | BUTTON_USE_IN_PROGRAM | 0x80 | Button usage flag in program |
| bit8-11 | _key_back_burst | - | Back button burst state |
| bit12 | flag_combo_keys | - | Combo key flag |
10. ADS1115 ADC Data Registers (0x40-0x4F)
| Address | Register Name | Purpose Description | Notes |
|---|---|---|---|
| 0x40 | SYS_REG_ADS1115_0 | ADS1115 channel 0 raw value | 16-bit ADC value (0-65535) |
| 0x41 | SYS_REG_ADS1115_1 | ADS1115 channel 1 raw value | 16-bit ADC value |
| 0x42 | SYS_REG_ADS1115_2 | ADS1115 channel 2 raw value | 16-bit ADC value |
| 0x43 | SYS_REG_ADS1115_3 | ADS1115 channel 3 raw value | 16-bit ADC value |
| 0x44 | SYS_REG_ADS1115_4 | ADS1115 channel 4 raw value | 16-bit ADC value |
| 0x45 | SYS_REG_ADS1115_5 | ADS1115 channel 5 raw value | 16-bit ADC value |
| 0x46 | SYS_REG_ADS1115_6 | ADS1115 channel 6 raw value | 16-bit ADC value |
| 0x47 | SYS_REG_ADS1115_7 | ADS1115 channel 7 raw value | 16-bit ADC value |
| 0x48 | SYS_REG_ADS1115_8 | ADS1115 channel 8 raw value | 16-bit ADC value |
| 0x49 | SYS_REG_ADS1115_9 | ADS1115 channel 9 raw value | 16-bit ADC value |
| 0x4A | SYS_REG_ADS1115_10 | ADS1115 channel 10 raw value | 16-bit ADC value |
| 0x4B | SYS_REG_ADS1115_11 | ADS1115 channel 11 raw value | 16-bit ADC value |
| 0x4C | SYS_REG_ADS1115_12 | ADS1115 channel 12 raw value | 16-bit ADC value |
| 0x4D | SYS_REG_ADS1115_13 | ADS1115 channel 13 raw value | 16-bit ADC value |
| 0x4E | SYS_REG_ADS1115_14 | ADS1115 channel 14 raw value | 16-bit ADC value |
| 0x4F | SYS_REG_ADS1115_15 | ADS1115 channel 15 raw value | 16-bit ADC value |
11. PCA9685 PWM Registers (0x50-0x7F)
PCA9685 Device 0 (I2C Address 0x40) — 0x50-0x5F
| Address | Register Name | Purpose Description | Notes |
|---|---|---|---|
| 0x50 | SYS_REG_PCA9685_DEV0_CH0 | Device 0 channel 0 PWM value | 0-4095 |
| 0x51 | SYS_REG_PCA9685_DEV0_CH1 | Device 0 channel 1 PWM value | 0-4095 |
| ... | ... | ... | ... |
| 0x5F | SYS_REG_PCA9685_DEV0_CH15 | Device 0 channel 15 PWM value | 0-4095 |
PCA9685 Device 1 (I2C Address 0x41) — 0x60-0x6F
| Address | Register Name | Purpose Description | Notes |
|---|---|---|---|
| 0x60 | SYS_REG_PCA9685_DEV1_CH0 | Device 1 channel 0 PWM value | 0-4095 |
| ... | ... | ... | ... |
| 0x6F | SYS_REG_PCA9685_DEV1_CH15 | Device 1 channel 15 PWM value | 0-4095 |
PCA9685 Device 2 (I2C Address 0x42) — 0x70-0x7F
| Address | Register Name | Purpose Description | Notes |
|---|---|---|---|
| 0x70 | SYS_REG_PCA9685_DEV2_CH0 | Device 2 channel 0 PWM value | 0-4095 |
| ... | ... | ... | ... |
| 0x7F | SYS_REG_PCA9685_DEV2_CH15 | Device 2 channel 15 PWM value | 0-4095 |
12. HuskyLens AI Vision Registers (0xCC-0xEC)
| Address | Register Name | Purpose Description | Notes |
|---|---|---|---|
| 0xCC | SYS_REG_HUSKY_LENS_BASE+0 | Target 0 type | 0=Face, 2=Object Tracking, 4=Color |
| 0xCD | SYS_REG_HUSKY_LENS_BASE+1 | Target 0 X coordinate | 0-320 |
| 0xCE | SYS_REG_HUSKY_LENS_BASE+2 | Target 0 Y coordinate | 0-240 |
| 0xCF | SYS_REG_HUSKY_LENS_BASE+3 | Target 1 type | Same as above |
| 0xD0 | SYS_REG_HUSKY_LENS_BASE+4 | Target 1 X coordinate | Same as above |
| 0xD1 | SYS_REG_HUSKY_LENS_BASE+5 | Target 1 Y coordinate | Same as above |
| ... | ... | ... | Each target occupies 3 registers |
| 0xEC | SYS_REG_HUSKY_LENS_BLOCK_CNT | Total number of recognized targets | 0-16 |
Each target occupies 3 registers:
base + i*3→ Target typebase + i*3 + 1→ X coordinatebase + i*3 + 2→ Y coordinate
13. System Control Registers (0x80-0xC7)
| Address | Register Name | Purpose Description | Notes |
|---|---|---|---|
| 0x80 | SYS_REG_SAVE_LOAD_FLAG | Program Save/Load Control | See flag bit definition below |
| 0x81 | SYS_REG_DISP_MODE | Display mode | Control OLED display content switching |
| 0x82 | SYS_REG_CURRENT_PC | Current Program Counter | Current program line number being executed |
| 0x83 | SYS_REG_RUN_STATUS | Run status | System current run status code |
| 0x84-0x8B | SYS_REG_FILENAME_CURRENT | Current program filename | 16-byte ASCII string |
| 0x8C-0x93 | SYS_REG_FILENAME_0 | Program slot 0 filename | 16-byte ASCII string |
| 0x94-0x9B | SYS_REG_FILENAME_1 | Program slot 1 filename | 16-byte ASCII string |
| 0x9C-0xA3 | SYS_REG_FILENAME_2 | Program slot 2 filename | 16-byte ASCII string |
| 0xA4-0xAB | SYS_REG_FILENAME_3 | Program slot 3 filename | 16-byte ASCII string |
| 0xAC-0xB3 | SYS_REG_FILENAME_4 | Program slot 4 filename | 16-byte ASCII string |
| 0xB4-0xBB | SYS_REG_FILENAME_5 | Program slot 5 filename | 16-byte ASCII string |
| 0xBC-0xC3 | SYS_REG_FILENAME_6 | Program slot 6 filename | 16-byte ASCII string |
| 0xC4-0xCB | SYS_REG_FILENAME_7 | Program slot 7 filename | 16-byte ASCII string |
SYS_REG_SAVE_LOAD_FLAG Bit Definition
| Bit | Mask | Purpose |
|---|---|---|
| bit0-7 | FILE_SECTOR_ID_MASK (0xFF) | Sector ID |
| bit8-9 | FILE_SAVE_MASK (0x300) | Save flag (shift right by 8 bits to read) |
| bit9-10 | FILE_LOAD_MASK (0x600) | Load flag (shift right by 9 bits to read) |
| bit10-11 | FILE_NAME_LIST_MASK (0xC00) | Filename list flag (shift right by 10 bits to read) |
Register Address Quick Reference
| Address Range | Function Category | Description |
|---|---|---|
| 0x00 | Compare Register | Dedicated for conditional comparison |
| 0x01-0x22 | User General Registers | Free to use by programs |
| 0x23-0x27 | System Status | Timer, I/O |
| 0x28-0x29 | Display Control | Drawing color |
| 0x2A-0x2D | PWM Control | Built-in PWM duty cycle |
| 0x2E-0x30 | Environmental Sensors | Temperature/Humidity/Altitude |
| 0x31-0x33 | Color Sensor | RGB values |
| 0x34 | Peripheral Switch | Enable/Disable peripherals |
| 0x35-0x37 | Ultrasonic | Distance measurement |
| 0x38-0x3E | RTC Clock | Date and time |
| 0x3F | Button Status | Onboard keys |
| 0x40-0x4F | ADC Data | ADS1115 16 channels |
| 0x50-0x7F | PWM Output | PCA9685 3 devices |
| 0x80-0xC7 | System Control | Save/Load/Display |
| 0xCC-0xEC | AI Vision | HuskyLens recognition results |