-
Notifications
You must be signed in to change notification settings - Fork 4
Assignment 3.2
Glenn Lopez edited this page Feb 12, 2014
·
5 revisions
- For the Z8 port interface below, write the C statements that will initialize the PORT lines, as appropriate for the peripheral devices (ie. Switches are input devices, LEDs are output devices). Output lines should be configured for push-pull operation.
PCADDR = 0x01; PCCTL = 0x80; PCADDR = 0x03; PCCTL = 0x00;
- Write the C statement that will turn ON all three LEDs in the circuit below, while sending logic 0 to PORT lines that are not connected to an LED.
00001100b = 0C ----> PAOUT = 0x0C;
- Write the C statements that will:
- assign the logic level of the switch to a char variable named “switch!”
- mask off all PORT lines that are not connected to the switch
- unsigned char "switch1";
- switch1 = PCIN;
- switch1 = switch1 & 0x80; //<-- 0x80 is-inbinary 10xx 00xx
If you are having trouble with this course, I highly suggest you learn how to program in C using code::blocks before doing anything with your microcontroller. This course is poorly designed and failing at it may not be entirely your fault. How well you do in your courses is a reflection of how good your instructors are -- never give them an excuse to say otherwise. “The mind is not a vessel to be filled, but a fire to be kindled.” — Plutarch