Chapter 10 - eZ430X

Chapter 10 - eZ430X - Chapter 10 eZ430X Coding Assembler...

Info icon This preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 10 – eZ430X +
Image of page 1

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

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

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

View Full Document Right Arrow Icon
BYU CS/ECEn 124 Chapter 10 - eZ430X 4 if-then-else Translation 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
Image of page 4
BYU CS/ECEn 124 Chapter 10 - eZ430X 5 while Translation 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
Image of page 5

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

View Full Document Right Arrow Icon
BYU CS/ECEn 124 Chapter 10 - eZ430X 6 for-loop Translation 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
Image of page 6
BYU CS/ECEn 124 Chapter 10 - eZ430X 7 switch/case Translation 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
Image of page 7

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

View Full Document Right Arrow Icon
BYU CS/ECEn 124 Chapter 10 - eZ430X 8 Handheld Measurement Air Flow measurement Alcohol meter Barometer Data loggers Emission/Gas analyser Humidity measurement Temperature measurement Weight scales Medical Instruments Blood pressure meter Blood sugar meter Breath measurement EKG system Home environment Air conditioning Control unit Thermostat Boiler control Shutter control Irrigation system White goods (Washing machine,..) Misc Smart card reader Taxi meter Smart Batteries Utility Metering Gas Meter Water Meter
Image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern