{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Chapter 10 - RBX430-1

# Chapter 10 - RBX430-1 - Chapter 10 RBX430-1 Coding...

This preview shows pages 1–10. Sign up to view the full content.

Chapter 10 – RBX430-1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
BYU CS/ECEn 124 Chapter 10 - Development Board 2 How To Code Assembler… n Understand the problem (obviously) n Until you are comfortable in assembly, (and even afterwards), write out your solution in something familiar n English n Flowchart n Pseudo-code n Java, C, Ruby – the pseudo-code doesn’t really matter! n Then, translate to assembler Coding Assembler
BYU CS/ECEn 124 Chapter 10 - Development Board 3 Three Basic Constructs Coding Assembler Task Subtask 1 Subtask 2 Subtask 1 Subtask 2 Test condition Subtask Test condition Sequential Conditional Iterative True True False False

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
BYU CS/ECEn 124 Chapter 10 - Development Board 4 if-then-else Translation n if-then-else if (buzzerON == 1) { pulse_buzzer(); turn_on_LED(); } else { turn_off_LED(); } cmp.w #1,&buzzerON ; jne myElse ; xor.b #0x20,&P4OUT ; bis.b #0x02,&P1OUT ; jmp myNext ; myElse: ; bic.b #0x02,&P1OUT ; ; myNext: ; Coding Assembler
BYU CS/ECEn 124 Chapter 10 - Development Board 5 while Translation n while loop… #define TRUE 1 int blink = TRUE; while (blink) { LED_ON(); delay(); LED_OFF(); delay(); } TRUE .set 1 .bss blink,2 ; mov.w #TRUE,&blink ; while_loop: ; cmp.w #0,&blink ; jeq while_done ; call #LED_ON ; call #delay ; call #LED_OFF ; call #delay ; jmp while_loop ; while_done: ; Coding Assembler

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
BYU CS/ECEn 124 Chapter 10 - Development Board 6 for-loop Translation n for-loop int i; for(i=0; i<10; i++) { do_dot(); delay(); do_dash(); delay(); } .bss i,2 ; mov.w #0,&i ; for_ck: cmp.w #10,&i ; jge for_done ; call #do_dot ; call #delay ; call #do_dash ; call #delay ; add.w #1,&i ; jmp for_ck ; for_done: ; Coding Assembler
BYU CS/ECEn 124 Chapter 10 - Development Board 7 switch/case Translation n switch/case switch (myByte) { case DOT: do_dot(); break; case DASH: do_dash(); break; default: } cmp.w #DOT,&myByte ; jne sw_01 ; call #do_dot ; jmp sw_end ; sw_01: cmp.w #DASH,&myByte ; jne default ; call #do_dash ; jmp sw_end ; ; default: ; sw_end: ; Coding Assembler

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
BYU CS/ECEn 124 Chapter 10 - Development Board 8 Topics to Cover… n MSPF2274 n Development Board n Peripherals n Jumpers & Header n Switch Debounce n Example 10.1 – SW Switch Debounce n Pulse Width Modulation (S/W) n Example 10.2 – SW PWM w/Timer_B n Pulse Width Modulation (H/W) n Example 10.3 – HW PWM w/Timer_B
BYU CS/ECEn 124 Chapter 10 - Development Board 9 Handheld Measurement n Air Flow measurement n Alcohol meter n Barometer n Data loggers n Emission/Gas analyser n Humidity measurement n Temperature measurement n Weight scales Medical Instruments n Blood pressure meter n Blood sugar meter n Breath measurement n EKG system Home environment n Air conditioning n Control unit n Thermostat n Boiler control n Shutter control n Irrigation system n White goods (Washing machine,..) Misc n Smart card reader n Taxi meter n Smart Batteries Utility Metering n Gas Meter n Water Meter n Heat Volume Counter n Heat Cost Allocation n Electricity Meter n Meter reading system (RF) Sports equipment n Altimeter n Bike computer n Diving watches Security n Glass break sensors n Door control n

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}