<< Chapter < Page Chapter >> Page >
This module goes over the basics of digital I/O and the digital interface between a microcontroller and the outside world.

Basic digital i/o in the real world

In this lab you'll go over the basics of how to setup and use the GPIO on the MSP430. This will allow you to get data from the outside world, run some processing on it, and then output it again as useful information. You only have one task this week:

  1. Coding in MSP430 assembly, write a simple I/O echo program . Setup the GPIO pins and poll the input DIP switches for any changes. Take the input and display it to the output so any changes are immediately reflected. Step through this program to observe how it behaves. Assignment Details

Digital i/o basics

Gpio

    Philosophy

  • The MSP430 uses a limited number of GPIO hardware pins that are assignable to several functions depending on your specific model and your program's needs. For example, our version, the MSP430F5637, can have the pins act as digital output, digital input, or ADC input.
  • The pins are organized into ports, with each port usually one byte (8 bits/pins) wide. On larger versions of the processor (different format chips with physically many more pins...) you can encounter several ports. In this lab our MSP430F5637 has 9 different ports we will use.
  • You can set each pin's function independently (input or output) by modifying some memory mapped I/O registers. Since we want to do both, we will assign different tasks to different pins as needed.

    Usage

  • The I/O ports are memory mapped into the top of the MSP430 address space.
  • There are several registers associated with each port. For now, you only need to worry about six (P4IN, P4OUT, P4DIR, and P9IN, P9OUT, P9DIR).

      P9in

    • The P9IN register is located in memory, which you can refer to using the C symbol &P9IN
    • The register holds the values the MSP430 sees at each associated pin, regardless of the pin direction setting.
    • To read the register, it is good practice to use a mov.b instruction to avoid accidentally reading adjacent registers
    • If you are looking to test or read just the pins set to input, you will have to mask the P9IN register to zero out the other unwanted/output pins. Reading P1IN reads the entire port, regardless of pin direction.

      P4out

    • The P4OUT register is located in memory, which you can refer to using the C symbol &P4OUT
    • If their direction bits in P4DIR are set to output/ "1", the corresponding pins will output the values set in P1OUT.
    • If a pin's direction bits are set to input in P4DIR and its resistors are enabled in P4REN, P4OUT controls the pin's connection to the pull-up resistor. Setting P4REN to "1" enables the pull-up, while setting it to "0" leaves the input to float in a high impedance state.
    • To set P1OUT, use a mov.b instruction to set several pins at once. To set individual bits to "1", you can use an or.b instruction with a "1" in the positions you want to set. To clear individual bits/ set them to zero, use an and.b instruction with mostly "1"s except for a "0" for the bits you want to clear.

      P4dir

    • The P4DIR register is located in memory, which you can also refer to using the C symbol &P4DIR
    • The value of the bits in P4DIR determines whether the MSP430 hardware leaves the pin in a high impedance state where it responds to external voltage changes (which you can read at P4IN), or in a low impedance state where the MSP430 drives the output voltage to a certain value determined by P1OUT.
    • To set the bit directions all at once, use a mov.b instruction, but to change individual bits regardless of the others, use an and.b or a or.b
    • Set the corresponding bits to "0" to set pins to input mode, or to "1" to set them to output mode.

Questions & Answers

Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
Adin
why?
Adin
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
research.net
kanaga
sciencedirect big data base
Ernesto
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
Maciej
characteristics of micro business
Abigail
for teaching engĺish at school how nano technology help us
Anassong
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
NANO
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
s.
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
Tarell
what is the actual application of fullerenes nowadays?
Damian
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
Tarell
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
Virgil
is Bucky paper clear?
CYNTHIA
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
NANO
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Harper
Do you know which machine is used to that process?
s.
how to fabricate graphene ink ?
SUYASH Reply
for screen printed electrodes ?
SUYASH
What is lattice structure?
s. Reply
of graphene you mean?
Ebrahim
or in general
Ebrahim
in general
s.
Graphene has a hexagonal structure
tahir
On having this app for quite a bit time, Haven't realised there's a chat room in it.
Cied
what is biological synthesis of nanoparticles
Sanket Reply
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!





Source:  OpenStax, Elec 220 lab course (escape). OpenStax CNX. Apr 07, 2013 Download for free at http://cnx.org/content/col11513/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Elec 220 lab course (escape)' conversation and receive update notifications?

Ask