The seven-segment displays are configured as two 32-bit registers. Each byte of each register directly controls the segments of the corresponding displays, turning them on and off. Thus, it is necessary to provide some decoding to display hexadecimal values on the displays. A 1 is used to turn on a segment; 0 turns it off.
.equ ADDR_7SEG1, 0xFF200020 .equ ADDR_7SEG2, 0xFF200030 ldr r0, =ADDR_7SEG1 ldr r1, =#0b0000110 // bits 0b0000110 will activate segments 1 and 2 str r1, [r0] // Write to 7-seg display ldr r0, =ADDR_7SEG2 ldr r1, =#0 str r1, [r0]
#define ADDR_7SEG1 ((volatile long *) 0xFF200020) #define ADDR_7SEG2 ((volatile long *) 0xFF200030) int main() { # bits 0000110 will activate segments 1 and 2 *ADDR_7SEG1 = 0x00000006; *ADDR_7SEG2 = 0; }