Affordable Access

1.3 - Introduction to Programming the ez430

Publication Date
  • Ez430
  • Msp430


Connexions module: m13623 1 1.3 - Introduction to Programming the ez430 ∗ Naren Anand Based on Introduction to Programming the MSP430 † by adrian valenzuela This work is produced by The Connexions Project and licensed under the Creative Commons Attribution License ‡ Abstract This is a basic tutorial on how to program the basic digital peripherals on the ez430. 1 Configuring Digital I/O: Introduction Digital I/O, such as the LED, is configured by modifying several registers pertaining to the port that they are attached to. Check the datasheet to find the respective port number of the peripheral you which to control. For more detailed information about Digital I/O on the MSP430 check Chapter 6: Digital I/O of the ez430's user guide. The basic logic behind seemingly trivial process of turning the LED on and off is the same behind the operation of every peripherial on the tool. First, we must assign the direction of the corresponding I/O pins. This is done by setting the direction register, PxDIR, with the appropriate bit. By default, all I/O pins are assigned to be inputs. • Bit = 0: The port pin is switched to input direction. • Bit = 1: The port pin is switched to output direction. On the ez430 the LED is located on port 1. The port number will correspond the to x value in registers such as PxIN, PxOUT, or PxDIR. Therefore, if we wanted to define the direction of a pin on port 1 we would write to P1DIR. 2 A Useful Tangent: Common Bitwise C Operations In order to modify values of registers you must first understand the following commonly used C logic oper- ations: ∗ Version 1.2: May 18, 2006 12:58 pm -0500 † ‡ Connexions module: m13623 2 ∼A A | B A & B A ^ B A |= B A &= ∼B A ^=B In C, the NOT: ∼, OR: |, AND: & and XOR: ^ operators are all bitwise. This means that the operations are done bit by bit to the bin

There are no comments yet on this publication. Be the first to share your thoughts.


Seen <100 times