The PIC18F46J11 has 3,776 bytes of RAM organized into banks, plus 1KB of internal EEPROM for persistent storage. This page documents the key memory locations used by the RS-UV3 firmware.
Address Name Description 0x059acmd_char0Serial buffer pointer (low byte) 0x059bcmd_char1Serial buffer pointer (high byte) 0x059dport_selectorWhich port received command: 1=USB, 2=DE-9 0x059fcmd_paramParsed numeric parameter 0x05a0response_portOutput port for response 0x05dfoutput_portCurrent serial output destination
Address Name Description 0x05e0str_tbl_loString table index (low byte) 0x05e1str_tbl_hiString table index (high byte) 0x05e2str_lengthString length for transmission
Address Name Description 0x045d–0x0460freq_mainMain frequency (4 bytes, kHz × 100) 0x0459–0x045cfreq_subSub/offset frequency (4 bytes) 0x0461–0x0464freq_txTX frequency when split 0x0467power_levelTX power: 0=low, 1=high
Address Name Description 0x0423io_configAI/AO analog I/O configuration 0x0425config_flagsAudio filter, power, misc flags 0x0454squelch_modeSquelch sensitivity: L/M/H 0x046atone_modeCTCSS mode: 0=off, 1=encode, 2=enc+dec
The firmware implements 32-bit multiply and divide using shift-and-add. These addresses are the working registers:
Address Name Description 0x0000–0x0003Common_RAM32-bit accumulator (bank 0) 0x05a1–0x05a4math_op_aFirst operand 0x05a5–0x05a8math_op_bSecond operand 0x05a9–0x05acmath_resultResult storage
Address Name Description 0x05e3i2c_addrTarget I2C address 0x05e4i2c_dataData byte for transfer 0x05e5i2c_statusTransfer status/error code
The PIC18F46J11 has 1KB of internal EEPROM. The RS-UV3 uses it for persistent configuration:
Each channel uses 10 bytes:
Offset Size Content +0 4 RX frequency (kHz × 100) +4 4 TX frequency (kHz × 100) +8 1 CTCSS tone index +9 1 Flags (power, squelch mode)
Channels 1–9 are stored at 0x00, 0x0A, 0x14, etc.
Channel 0 is the power-on default configuration.
Address Content 0x5ASquelch level (0–9) 0x5BSquelch sensitivity 0x5CVolume level (0–39) 0x5DAudio filter flags 0x5E–0x5FBeacon timer (seconds) 0x60–0x63Reserved 0x64Bandwidth setting 0x65VOX sensitivity 0x66Hang time (×10 ms) 0x67COR inhibit time
32 bytes for the beacon message text (null-terminated ASCII).
20 bytes for the station callsign (null-terminated ASCII).
Key PIC18F46J11 SFRs used by the firmware:
Register Address Purpose TXSTA10xFACUART1 transmit status RCSTA10xFABUART1 receive status TXREG10xFADUART1 transmit data RCREG10xFAEUART1 receive data SPBRG10xFAFUART1 baud rate generator TXSTA20xF6CUART2 transmit status RCSTA20xF6BUART2 receive status
Register Address Purpose SSPCON10xFC6MSSP control 1 SSPCON20xFC5MSSP control 2 SSPSTAT0xFC7MSSP status SSPBUF0xFC9MSSP data buffer SSPADD0xFC8I2C address/baud
Register Address Purpose ADCON00xFC2ADC control 0 ADCON10xFC1ADC control 1 ADRESH0xFC4ADC result high ADRESL0xFC3ADC result low
Register Address Purpose INTCON0xFF2Interrupt control PIR10xF9EPeripheral interrupt flags 1 PIE10xF9DPeripheral interrupt enable 1
The firmware stores response strings in program memory. To send a string:
movlw 0x74 ; String index low
movlw 0x00 ; String index high
call serial_send_string ; Sends until null terminator
movlw 0x5A ; EEPROM address
bcf EECON1, EEPGD ; Select data EEPROM
bcf EECON1, CFGS ; Not configuration
bsf EECON1, RD ; Start read
movf EEDATA, W ; Read result
movlw 0x05 ; Data to write
bsf EECON1, WREN ; Enable writes
; Required unlock sequence
bsf EECON1, WR ; Start write
bcf EECON1, WREN ; Disable writes
The unlock sequence (0x55, 0xAA) is a hardware requirement to prevent accidental writes.