Create an assembly language program on the 9S12 CPU to read switches and drive LED's 1-Configure all...

80.2K

Verified Solution

Question

Electrical Engineering

Create an assembly language program on the 9S12 CPU to readswitches and drive LED's

1-Configure all bits of Port U for output using address DDRU.There are 8 LEDs

connected to those pins. When you output a 1 to a bit, that bitwill be enabled for

output, so when you later write a 1 to a bit in port U (PTU)that LED will turn ON.

2. Switches are attached to Port T. They work by grounding thebit when switched

on, (negative logic): ON = 0, OFF = 1. The PCB supplies pull-upresistors.

3. Read the switches, and configure your program so that ifswitch 1 is on, you

send out a data pattern which will make the even LEDs turn ON,others OFF.

4. If switch 2 is on, make the lower 4 LEDs ON and the higher 4LEDs OFF

5. If switch 3 is ON, start out lighting the LED for bit 0, thenmove the light left until

the LED for bit 7 is ON. After that, turn OFF all LEDs, thenturn on the LED for a bit

7 again and move the light back towards the LED for bit 0. Afterit gets there, turns all the LEDs OFFagain, then repeat the cycle until the switch changes).

Note: for all of the above you will have to keep going backafterward andreading the switch to see if it has changed.

6. Add a delay to your program so the human eye can see theoperation!

Answer & Explanation Solved by verified expert
3.9 Ratings (377 Votes)
Answer The code has been written below ldaa FF load value 11111111 into register A staa DDRU make port U pins as output ldaa 00 load value 00000000 into register A staa DDRT make port T pins as input Loop1 label name Loop1 ldaa PTT read port T pins and keep in A cmpa FE check if switch 1 is pressed beq Case1 if yes    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students