EET 2261 Unit 5 I/O Pins and Ports. Read Almy , Sections 12 – 15. Homework #5 and Lab #5 due next week. Quiz next week. General-Purpose Input/Output Ports.
PowerPoint Slideshow about ' EET 2261 Unit 5 I/O Pins and Ports' - iden
An Image/Link below is provided (as is) to download presentation
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
To keep the pin count to a reasonable number, most of the pins for the general-purpose I/O ports can also serve as inputs or outputs to specific modules on the HCS12. You must choose how you want to use the pins.
Example: If you want to use the chip’s Enhanced Capture Timer module, then you can’t use Port T for general-purpose I/O.
See block diagram on page 6 of textbook or page 23 of Device User Guide. Also see pin diagram on page 52 of Device User Guide.
Each bit in a DDR configures the corresponding pin of the port as an input (if the bit = 0) or as an output (if the bit = 1).
Example: Suppose that on Port A we want to use pins 0to 3 as input pins, and we want to use pins 4 to 7 as output pins. Then we must write the value %11110000 (or $F0) to DDRA: LDAA #$F0 ;0-3 in, 4-7 out STAA $0002 ;DDRA is at $0002
On our trainer board, bit 5 of Port T is wired to a speaker (buzzer).
See p. 28 of Dragon12 manual and Schematic Diagram 1.
To make a noise on the speaker, you must configure bit PT5 for output, and then cause this output pin to alternate rapidly between HIGH and LOW. The pitch of the sound depends on how quickly you alternate it.