Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

ECET 340 Week 1 iLab 1 2024/2025

Beoordeling
-
Verkocht
-
Pagina's
15
Cijfer
A+
Geüpload op
09-09-2024
Geschreven in
2024/2025

ECET 340 Week 1 iLab 1 2024/2025/ECET 340 Week 1 iLab 1 2024/2025/ECET 340 Week 1 iLab 1 2024/2025

Instelling
Vak

Voorbeeld van de inhoud

OBJECTIVES:

1. To become familiar with Microcontroller MC9S12 parallel ports and how
simple input and output devices are interfaced through them.
2. To learn how to program I/O instructions in C language.
3. To learn how to organize a program to read data from input ports, process the
data, and display the result on a simple output device.



I. PARTS LIST:

Equipment:
Computer running Windows XP or Vista 32 bit.
Codewarrior v. 5.9.0

Parts:
1- Wytec EVBPlus Microcontroller Demonstration Board Kit, including:
MC9S12DG256 demonstration board
USB cable and adapter
Universal power supply and cable
MC9S12DG256 Development Boards CD


II. INTRODUCTION

Parallel I/O ports are the two-way signal interface between a microprocessor and external
peripheral devices. I/O means ports can be configured for either receiving multi-bit
signals into the controller (input port) or sending signals out from it (output port). The
processor uses its ports to control the access of peripherals to its own internal buses.

When the processor outputs to different peripherals output ports direct the data from the
internal buses to the intended destinations. This is accomplished through data latching,
i.e., holding onto data left at the port by the processor until the receiver is ready to fetch
it. Here ports are said to act as data buffers. They also act as electrical signal buffers by
placing amplifiers between the internal buses and external devices, important both for
noise control and boosting signal power to the multiple devices that might attach to a
given port. Finally, output ports electrically isolate, or disconnect, external devices from
the internal bus whenever data transfers are not taking place.

Input ports likewise help the processor avoid bus contention by ensuring that only one
peripheral device is allowed to connect to the internal data bus at any given time. To do
this the microprocessor tri-states all ports other than the one it wants access to. There is a



ECET-340 DeVry University 1

, penalty for these features: port hardware introduces a certain amount of unavoidable
time delay in the signal path.

All port output pins have their own current limits. When used as inputs, parallel port pins
have voltage limits. Both of these are specified in the processor’s device user’s guide and
must be strictly observed in order to avoid damage to the controller hardware.

The HCS12 used in this lab has 11 individually programmable parallel ports, identified
by the letters A,B,E,H,J,K,M,P,S,T and PAD, of widths varying between 2-bits and 8-
bits. Individual bits in a port are identified by their bit position, for example bits 6 and 7
of Port M are referred to as PM6 and PM7. The Wytec demo board provides access to
these port pins through the headers labeled H1 to H8.

Port pin directions are user programmable. An initialization program sends an 8-bit
control word to the address in the control register block of memory assigned to the data
direction register for that port. For example, the symbolic address given to the data
direction register for port B is DDRB. Within the control word, ‘1’s = output ports and
‘0’s = input ports. Pin directions are assigned individually, for example,

PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0

1 1 0 0 0 0 0 1 DDRB ( DDRB = 0xC1; )

sets directions of pins PB7,PB6 and PB0 as outputs, and PB5-PB1 as inputs. Always
check to make sure the directions you assign in this register agree with your external
hardware connections to the port! Connecting an input device to a port pin programmed
in the DDR register as an OUTPUT can cause (expensive) damage to the microcontroller
IC when it and the input device both try to send out conflicting logic levels.

If a port pin is programmed as an input it is also possible to program a pull-up or pull-
down device to act internally. This is equivalent to connecting a shunt resistor to Vcc (or
ground) externally to the pin. Registers PPSP and PERP in the control block area can be
used to select pull polarity (down or up) and enable for each pin of port P, for example.
A ‘1’ in PPSP selects pull-down for that pin; a ‘0’ selects pull-up. A ‘1’ in PERP turns
on the pull device for that pin.

In the first part of this lab we program two of the HCS12 ports: Port B as an 8-bit output
port and Port H as an 8-bit input port. Our first application is simple: LEDs will are used
as output devices and an 8-position DIP switch serves as our inputs. User program
instructions determine the logic states of the input switches, process these states, and
outputs the results for display on the LEDs.

IV. Procedure
A. Program to Read Switch States and Display
1. Enter the program shown below into a new Codewarrior project, 340_lab1_1 (choose
HCS12 Serial Monitor as the target). Use F7 – F5 to compile and flash the board.


ECET-340 DeVry University 2

Geschreven voor

Instelling
Studie
Onbekend
Vak

Documentinformatie

Geüpload op
9 september 2024
Aantal pagina's
15
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$24.49
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
VEVA2K Self
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
2860
Lid sinds
5 jaar
Aantal volgers
2413
Documenten
4449
Laatst verkocht
1 dag geleden
Affordable, Up-to-date-Quality Nursing Papers

Here, you'll find a wide range of Nursing Papers at an affordable rate. Every student deserves a friendly environment for study. Always message me for any concern and help. My email is

4.1

690 beoordelingen

5
378
4
128
3
102
2
24
1
58

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen