Skip to main content

Internal Registers Documentation

This document describes the address, name, and specific purpose of all special function registers in the system.


0. Compare Register (0x00)​

AddressRegister NamePurpose DescriptionNotes
0x00SYS_REG_COMPARECompare function dedicated registerUsed 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 R00 as the primary comparison operand
  • Comparison result determines whether the program jumps

1. System Status Registers (0x23-0x27)​

AddressRegister NamePurpose DescriptionNotes
0x23SYS_REG_TIMER_TIME_OUTTimer timeout statusNon-blocking timer status flag
0x24SYS_REG_ADS1115_CHANNELSADS1115 channel configurationConfigure which ADC channels to read
0x25SYS_REG_D_IO_STATEDigital I/O statusCurrent digital input/output port state
0x26SYS_REG_D_OUTDigital output portSet digital output pin level
0x27SYS_REG_D_INDigital input portRead digital input pin level

2. Display/Drawing Registers (0x28-0x29)​

AddressRegister NamePurpose DescriptionNotes
0x28SYS_REG_DRAWING_COLORDrawing foreground colorColor for drawing operations like lines, rectangles
0x29SYS_REG_BACKGROUND_COLORDrawing background colorBackground color for fill operations

3. PWM Control Registers (0x2A-0x2D)​

AddressRegister NamePurpose DescriptionNotes
0x2ASYS_REG_PWM_DC_CH0Built-in PWM channel 0 duty cycleMCU internal PWM output, 0-100%
0x2BSYS_REG_PWM_DC_CH1Built-in PWM channel 1 duty cycleMCU internal PWM output, 0-100%
0x2CSYS_REG_PWM_DC_CH2Built-in PWM channel 2 duty cycleMCU internal PWM output, 0-100%
0x2DSYS_REG_PWM_DC_CH3Built-in PWM channel 3 duty cycleMCU internal PWM output, 0-100%

4. Environmental Sensor Registers (0x2E-0x30) — BME280​

AddressRegister NamePurpose DescriptionData Format
0x2ESYS_REG_TEMPUERATURETemperature value (BME280)Temperature × 100, e.g.: 25.36℃ → 2536
0x2FSYS_REG_HUMIDITYHumidity value (BME280)Humidity × 100, e.g.: 65.50% → 6550
0x30SYS_REG_ALTITUDEAltitude (BME280)Unit: meters

5. Color Sensor Registers (0x31-0x33) — TCS3472​

AddressRegister NamePurpose DescriptionNotes
0x31SYS_REG_COLOR_RColor sensor red componentR value from TCS3472 (0-65535)
0x32SYS_REG_COLOR_GColor sensor green componentG value from TCS3472 (0-65535)
0x33SYS_REG_COLOR_BColor sensor blue componentB value from TCS3472 (0-65535)

6. Peripheral Switch Register (0x34)​

AddressRegister NamePurpose DescriptionBit Definition
0x34SYS_REG_SWITCHPeripheral enable switchSee switch bit definition table below

Peripheral Switch Bit Definition​

BitConstant NameValueCorresponding Peripheral
bit0SYS_PER_SWITCH_ADS11150x001ADS1115 ADC
bit1SYS_PER_SWITCH_BME2800x002BME280 Temperature/Humidity
bit2SYS_PER_SWITCH_DS13070x004DS1307 RTC Clock
bit3SYS_PER_SWITCH_TCS34720x008TCS3472 Color Sensor
bit4SYS_PER_SWITCH_PCA96850x010PCA9685 PWM Driver
bit6SYS_PER_SWITCH_WS2812B0x040WS2812B LED
bit7SYS_PER_SWITCH_LCD16020x080LCD1602 LCD Screen
bit8SYS_PER_SWITCH_SSD13060x100SSD1306 OLED
bit9SYS_PER_SWITCH_HUSKY_LENS0x200HuskyLens AI Vision
bit11SYS_PER_SWITCH_MELODY0x800Buzzer Melody

7. Ultrasonic Sensor Registers (0x35-0x37)​

AddressRegister NamePurpose DescriptionNotes
0x35SYS_REG_ULTRASONIC0Ultrasonic sensor 0 distanceUnit: millimeters
0x36SYS_REG_ULTRASONIC1Ultrasonic sensor 1 distanceUnit: millimeters
0x37SYS_REG_ULTRASONIC2Ultrasonic sensor 2 distanceUnit: millimeters

8. RTC Clock Registers (0x38-0x3E) — DS1307​

AddressRegister NamePurpose DescriptionData Range
0x38SYS_REG_YEARRTC YearExample: 26 represents year 2026
0x39SYS_REG_MONTHRTC Month1-12
0x3ASYS_REG_DATERTC Date1-31
0x3BSYS_REG_DAYRTC Weekday1-7
0x3CSYS_REG_HOURRTC Hour0-23
0x3DSYS_REG_MINUTERTC Minute0-59
0x3ESYS_REG_SECONDRTC Second0-59

9. Button Status Register (0x3F)​

AddressRegister NamePurpose DescriptionBit Definition
0x3FSYS_REG_BUTTON_STATEOnboard Button StateSee button bit definition table below

Button Bit Definition​

BitConstant NameValueCorresponding Button
bit0BUTTON_BIT_UP0x01Up
bit1BUTTON_BIT_BACK0x02Back
bit2BUTTON_BIT_LEFT0x04Left
bit3BUTTON_BIT_RIGHT0x08Right
bit4BUTTON_BIT_DOWN0x10Down
bit5BUTTON_BIT_ENTER0x20Enter
bit6BUTTON_BIT_FUNC0x40Function
bit7BUTTON_USE_IN_PROGRAM0x80Button usage flag in program
bit8-11_key_back_burst-Back button burst state
bit12flag_combo_keys-Combo key flag

10. ADS1115 ADC Data Registers (0x40-0x4F)​

AddressRegister NamePurpose DescriptionNotes
0x40SYS_REG_ADS1115_0ADS1115 channel 0 raw value16-bit ADC value (0-65535)
0x41SYS_REG_ADS1115_1ADS1115 channel 1 raw value16-bit ADC value
0x42SYS_REG_ADS1115_2ADS1115 channel 2 raw value16-bit ADC value
0x43SYS_REG_ADS1115_3ADS1115 channel 3 raw value16-bit ADC value
0x44SYS_REG_ADS1115_4ADS1115 channel 4 raw value16-bit ADC value
0x45SYS_REG_ADS1115_5ADS1115 channel 5 raw value16-bit ADC value
0x46SYS_REG_ADS1115_6ADS1115 channel 6 raw value16-bit ADC value
0x47SYS_REG_ADS1115_7ADS1115 channel 7 raw value16-bit ADC value
0x48SYS_REG_ADS1115_8ADS1115 channel 8 raw value16-bit ADC value
0x49SYS_REG_ADS1115_9ADS1115 channel 9 raw value16-bit ADC value
0x4ASYS_REG_ADS1115_10ADS1115 channel 10 raw value16-bit ADC value
0x4BSYS_REG_ADS1115_11ADS1115 channel 11 raw value16-bit ADC value
0x4CSYS_REG_ADS1115_12ADS1115 channel 12 raw value16-bit ADC value
0x4DSYS_REG_ADS1115_13ADS1115 channel 13 raw value16-bit ADC value
0x4ESYS_REG_ADS1115_14ADS1115 channel 14 raw value16-bit ADC value
0x4FSYS_REG_ADS1115_15ADS1115 channel 15 raw value16-bit ADC value

11. PCA9685 PWM Registers (0x50-0x7F)​

PCA9685 Device 0 (I2C Address 0x40) — 0x50-0x5F​

AddressRegister NamePurpose DescriptionNotes
0x50SYS_REG_PCA9685_DEV0_CH0Device 0 channel 0 PWM value0-4095
0x51SYS_REG_PCA9685_DEV0_CH1Device 0 channel 1 PWM value0-4095
............
0x5FSYS_REG_PCA9685_DEV0_CH15Device 0 channel 15 PWM value0-4095

PCA9685 Device 1 (I2C Address 0x41) — 0x60-0x6F​

AddressRegister NamePurpose DescriptionNotes
0x60SYS_REG_PCA9685_DEV1_CH0Device 1 channel 0 PWM value0-4095
............
0x6FSYS_REG_PCA9685_DEV1_CH15Device 1 channel 15 PWM value0-4095

PCA9685 Device 2 (I2C Address 0x42) — 0x70-0x7F​

AddressRegister NamePurpose DescriptionNotes
0x70SYS_REG_PCA9685_DEV2_CH0Device 2 channel 0 PWM value0-4095
............
0x7FSYS_REG_PCA9685_DEV2_CH15Device 2 channel 15 PWM value0-4095

12. HuskyLens AI Vision Registers (0xCC-0xEC)​

AddressRegister NamePurpose DescriptionNotes
0xCCSYS_REG_HUSKY_LENS_BASE+0Target 0 type0=Face, 2=Object Tracking, 4=Color
0xCDSYS_REG_HUSKY_LENS_BASE+1Target 0 X coordinate0-320
0xCESYS_REG_HUSKY_LENS_BASE+2Target 0 Y coordinate0-240
0xCFSYS_REG_HUSKY_LENS_BASE+3Target 1 typeSame as above
0xD0SYS_REG_HUSKY_LENS_BASE+4Target 1 X coordinateSame as above
0xD1SYS_REG_HUSKY_LENS_BASE+5Target 1 Y coordinateSame as above
.........Each target occupies 3 registers
0xECSYS_REG_HUSKY_LENS_BLOCK_CNTTotal number of recognized targets0-16

Each target occupies 3 registers:​

  • base + i*3 → Target type
  • base + i*3 + 1 → X coordinate
  • base + i*3 + 2 → Y coordinate

13. System Control Registers (0x80-0xC7)​

AddressRegister NamePurpose DescriptionNotes
0x80SYS_REG_SAVE_LOAD_FLAGProgram Save/Load ControlSee flag bit definition below
0x81SYS_REG_DISP_MODEDisplay modeControl OLED display content switching
0x82SYS_REG_CURRENT_PCCurrent Program CounterCurrent program line number being executed
0x83SYS_REG_RUN_STATUSRun statusSystem current run status code
0x84-0x8BSYS_REG_FILENAME_CURRENTCurrent program filename16-byte ASCII string
0x8C-0x93SYS_REG_FILENAME_0Program slot 0 filename16-byte ASCII string
0x94-0x9BSYS_REG_FILENAME_1Program slot 1 filename16-byte ASCII string
0x9C-0xA3SYS_REG_FILENAME_2Program slot 2 filename16-byte ASCII string
0xA4-0xABSYS_REG_FILENAME_3Program slot 3 filename16-byte ASCII string
0xAC-0xB3SYS_REG_FILENAME_4Program slot 4 filename16-byte ASCII string
0xB4-0xBBSYS_REG_FILENAME_5Program slot 5 filename16-byte ASCII string
0xBC-0xC3SYS_REG_FILENAME_6Program slot 6 filename16-byte ASCII string
0xC4-0xCBSYS_REG_FILENAME_7Program slot 7 filename16-byte ASCII string

SYS_REG_SAVE_LOAD_FLAG Bit Definition​

BitMaskPurpose
bit0-7FILE_SECTOR_ID_MASK (0xFF)Sector ID
bit8-9FILE_SAVE_MASK (0x300)Save flag (shift right by 8 bits to read)
bit9-10FILE_LOAD_MASK (0x600)Load flag (shift right by 9 bits to read)
bit10-11FILE_NAME_LIST_MASK (0xC00)Filename list flag (shift right by 10 bits to read)

Register Address Quick Reference​

Address RangeFunction CategoryDescription
0x00Compare RegisterDedicated for conditional comparison
0x01-0x22User General RegistersFree to use by programs
0x23-0x27System StatusTimer, I/O
0x28-0x29Display ControlDrawing color
0x2A-0x2DPWM ControlBuilt-in PWM duty cycle
0x2E-0x30Environmental SensorsTemperature/Humidity/Altitude
0x31-0x33Color SensorRGB values
0x34Peripheral SwitchEnable/Disable peripherals
0x35-0x37UltrasonicDistance measurement
0x38-0x3ERTC ClockDate and time
0x3FButton StatusOnboard keys
0x40-0x4FADC DataADS1115 16 channels
0x50-0x7FPWM OutputPCA9685 3 devices
0x80-0xC7System ControlSave/Load/Display
0xCC-0xECAI VisionHuskyLens recognition results