Self-Balancing Robot
User Guide
41
www.terasic.com
July 12, 2018
Table 1- 8 Register Format
Reg Address
Bit Filed
Type
Name
Description
Base Addr + 0
31:24
RO
Inversed Key
Code
Inversed Key
Code
24:16
RO
Key Code
Key Code
15:0
RO
Custom Code
Custom
Code: 16'h6b86
If pressing IR controller key “2”, the register value will be 32'hfd026b86, the "6b86" is Custom
Code, the "02" is Key Code, the “fd” is Inversed Key Code, which is the reversed value of “02”.
After the Nios CPU receives IR interrupt signal, the Nios CPU will read the register value and
compare it with the defined code table, and then, judge the meaning of the instruction.
IR controller
key codes(32bits) are defined in the file
IrRx.h
, as followed code lines:
typedef
enum
{
IR_POWER
= 0xed126b86,
IR_CH_UP
= 0xe51a6b86,
IR_CH_DOWN
= 0xe11e6b86,
IR_VOL_UP
= 0xe41b6b86,
IR_VOL_DOWN
= 0xe01f6b86,
IR_MUTE
= 0xf30c6b86,
IR_ADJ_LEFT
= 0xeb146b86,
IR_ADJ_RIGHT
= 0xe7186b86,
IR_PLAY_PAUSE
= 0xe9166b86,
IR_NUM_0
= 0xff006b86,
IR_NUM_1
= 0xfe016b86,
IR_NUM_2
= 0xfd026b86,
IR_NUM_3
= 0xfc036b86,
IR_NUM_4
= 0xfb046b86,
IR_NUM_5
= 0xfa056b86,
IR_NUM_6
= 0xf9066b86,
IR_NUM_7
= 0xf8076b86,
IR_NUM_8
= 0xf7086b86,