Understanding LED Control and Delay Timing in Assembly Language Programming
60 likes | 163 Vues
This quiz focuses on practical exercises in assembly language programming, emphasizing control of LEDs attached to a microcontroller port, signal delay calculations, and memory operand addressing. Participants will interact with various instructions to determine the state of LEDs after executing commands, calculate the appropriate delay setting for a 1.2 MHz processor, and match key concepts in computer architecture, such as ALU operations and addressing modes. This engaging quiz helps solidify understanding of basic principles in embedded systems programming.
Understanding LED Control and Delay Timing in Assembly Language Programming
E N D
Presentation Transcript
Quiz 4.1 Four LEDs are attached to Port 4, bits 0 thru 3. Indicate which LEDs are ON/OFF/Undefined after each instruction to the left is executed. P4.3 P4.2 P4.1 P4.0 • mov.b #0x0f,&P4DIR • and.b #0xf0,&P4OUT • bis.b #0x09,&P4OUT • xor.b #0x0f,&P4OUT • bic.b #0x06,&P4OUT • add.b #0x03,&P4OUT
Quiz 4.2 • Given a 1.2 MHz processor, what value for DELAY would result in a 1/4 second delay? ? DELAY .equ mov.w #DELAY,r12 ; 2 cycles delay1: mov.w #1000,r15 ; 2 cycles delay2: sub.w #1,r15 ; 1 cycle jne delay2 ; 2 cycles sub.w #1,r12 ; 1 cycle jne delay1 ; 2 cycles
Quiz 4.3 • ALU • Clocks • Control • I/O • Memory • Peripherals • Registers • Address space • Execution speed • External devices • Fast memory • Finite State Machine • Memory mapped • Word length • Match the following terms:
Quiz 4.4 • add.w tab(r10),r9 • and.w &mask,r12 • bis.b #0x08,r6 • mov.b cnt,r11 • mov.w r4,r5 • mov.w #100,r14 • sub.w @r4+,r5 • xor.b @r8,r15 • Absolute • Constant • Immediate • Indexed register • Indirect auto-increment • Indirect register • Register • Symbolic • Match the following source operand modes:
Quiz 4.5 Present the destination operand of the following instruction to the ALU: add.w r4,cnt ; M[cnt] += r4 Memory CPU PC PC PC PC ADDER Registers IR 0x5480 PC 0x5480 0x0218 R4 cnt ALU
Quiz 4.6 Show how to retrieve a PC-relative destination operand from memory and present to the ALU: