ELE HW#3 - hw 3 PDF

Title ELE HW#3 - hw 3
Author Priyanka Kumar
Course Computer Engineering II
Institution Northern Illinois University
Pages 5
File Size 278.1 KB
File Type PDF
Total Downloads 15
Total Views 146

Summary

hw 3...


Description

ELE HW#3 Priyanka Kumar

1. Write assembler directives to define the ASCII codes of letters a to z in program memory void setup() { // put your setup code here, to run once: (".db “abcdefghijklmnopqrstuvwxyz”,0"); } void loop() { // put your main code here, to run repeatedly: }

2. Write assembler directives to define the ASCII codes of digits 0 to 9 in program memory starting from address 0x1000. void setup() {

// put your setup code here, to run once: (".org 0x1000"); (".db “0123456789”,0"); } void loop() { // put your main code here, to run repeatedly: }

3. Invoke the setPointer macro defined in Section 3.5.8 to load the address 0x3000 into Y register. void setup() { // put your setup code here, to run once:

("setPointer YL,YH,0x3000"); } void loop() {

// put your main code here, to run repeatedly: }

6. Write a program to add the 32-bit numbers stored at data memory locations 0x200~0x203 and 0x204~0x207, respectively, and store the sum at 0x208~0x20B.

void setup() { // put your setup code here, to run once: .include .cseg .org 0x00 rjmp start .org 0xF6 start: lds r0,0x200; //fetch the lsbs lds r1,0x204; //" add r0,r1; //add them sts 0x208,r0; //save the lsb of sum lds r0,0x201 lds r1,0x205 adc r0,r1 sts 0x209,r0 lds r0,0x202

lds r1,0x206 adc r0,r1 sts 0x20A,r0 lds r0,0x203; lds r1,0x207; adc r0,r1; sts 0x20B,r0; // end of program

//fetch the msbs //" //add them //save the msb of sum

} void loop() { // put your main code here, to run repeatedly: }...


Similar Free PDFs