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 movia r2,ADDR_7SEG1 movia r3,0x00000006 # bits 0000110 will activate segments 1 and 2 stwio r3,0(r2) # Write to 7-seg display movia r2,ADDR_7SEG2 stwio r0, 0(r2)
#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; }