; *********************************************************************** ; * * ; * Flash the LEDs on the DSLMU Microcontroller Board * ; * First Version * ; * * ; *********************************************************************** ; ; Author: John Zaitseff ; Date: 7th March, 2003 ; Version: 1.6 ; ; This program, when run on the DSLMU Microcontroller Board, flashes the ; LEDs on and off. A high-level (pseudo-code) version of the program is: ; ; program main ; ; const ; Value1 = 0b11111111 /* Value to turn LEDs on */ ; Value2 = 0b00000000 /* Value to turn LEDs off */ ; ; address ; LED_port = 0x10000000 /* Address of the eight LEDs */ ; ; do { ; LED_port := Value1 ; LED_port := Value2 ; } forever ; ; where Value1 is the value to turn ON all of the LEDs and Value2 is the ; value to turn OFF all of the LEDs. ; ----------------------------------------------------------------------- ; Constant values used in this program .equ LED_port, 0x10000000 ; Location of LED port .equ Value1, 0b11111111 ; Value to turn LEDs on .equ Value2, 0b00000000 ; Value to turn LEDs off ; ----------------------------------------------------------------------- ; Assembly-language preamble .text ; Executable code follows _start: .global _start ; "_start" is required by the linker .global main ; "main" is our main program b main ; ----------------------------------------------------------------------- ; Start of the main program main: ; Entry to the function "main" ; Although "main" is technically a function, this particular ; function has an infinite loop and so never returns to its caller. mov r4, #LED_port ; Load the address of the LED port ; (ie, the value of the constant ; LED_port) into register R4 main_loop: ; Start of the infinite loop ; Turn the LEDs on mov r5, #Value1 ; Load the value Value1 into R5 strb r5, [r4] ; and store this value (a byte) to ; the address in R4 (the LED port) ; Turn the LEDs off mov r5, #Value2 ; Load the value Value2 into R5 strb r5, [r4] ; and store this value (a byte) b main_loop ; Branch back to main_loop, ie, run ; forever ; ----------------------------------------------------------------------- .end