You have no items in your shopping cart.

Subtotal: 0.00

How to Interface SWITCH with MSP430F5529 MSP430 Development Board

PS DEVELOPMENT MSP430 kit

The MSP430 Development kit is specifically designed to help students to master the required skills in the area of embedded systems. The kit is designed in such way that all the possible features of the microcontroller will be easily used by the students. The kit supports with Code Composer Studio v4 and later through USB port.

Texas Instrument Microcontroller, MSP430 Development kit is proposed to smooth the progress of developing and debugging of various designs encompassing of speed 16-bit Microcontrollers. It integrates on board PS2, UART, ADC, PWM, Temperature Sensor, Relay, Buzzer, I2c Seven Segment, I2C Serial EEPROM, Temperature Sensor LM35, Matrix Keypad, Switch, LED, Stepper Motor Driver, Traffic Light Controller, I2C RTC, LCD & GLCD Display to create a stand-alone versatile test platform. User can easily engage in Development in this platform, or use it as reference to application Development.

Switch

A switch is an electrical component that can break an electrical circuit, interrupting the current or diverting it from one conductor to another. A switch may be directly manipulated by a human as a control signal to a system, or to control power flow in a circuit.

Interfacing Switch with MSP430F5529

Figure shows how to interface the switch to microcontroller. A simple switch has an open state and closed state. However, a microcontroller needs to see a definite high or low voltage level at a digital input.

A switch requires a pull-up or pull-down resistor to produce a definite high or low voltage when it is open or closed. A resistor placed between a digital input and the supply voltage is called a "pull-up" resistor because it normally pulls the pin's voltage up to the supply. This MSP430 Microcontroller has internal pull as welll as internal pull down, we have to enable any logic by using register PXREN Register.

FOR EX: P2REN = 0XFF; P2.0 to P2.7 Pullup Register Enable





We now want to control the LED by using switches in MSP430F5529 Development Board . It works by turning ON a LED & then turning it OFF when switch is going to LOW or HIGH.

The MSP430F5529 Development Board has eight numbers of LEDs connected with I/O Port lines. Eight switches, connected with I/O port lines (P2.0 – P2.7) are used to control eight LEDs.

 

Pin Assignment with MSP430F5529



 

Slide Switch

MSP430F5529A lines

Input Logic Selection

DIGITAL INPUTS

SW27

P2.0

SW26

P2.1

SW25

P2.2

SW24

P2.3

SW23

P2.4

SW22

P2.5

SW21

P2.6

SW20

P2.7

 



Circuit Diagram to Interface Switch with MSP430F5529





Program to switch ON and OFF LED using MSP430F5529

*********************************************************************************************

Title : Program to Blink LEDs controlling by switches

*********************************************************************************************

#include <msp430x552x.h> #include <stdio.h> unsigned char temp1; int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P2DIR = 0x00; // Set P2.0 to 2.7 Input direction P2REN = 0xFF; // Set P2.0 to 2.7 Pull up Register enable P2OUT = 0xFF; // Set P2.0 to 2.7 Out Register. P6DIR |= 0xF0; // Set P6.4-P6.7 to Output direction P7DIR |= 0xF0; // Set P7.4-P7.7 to Output direction while(1) { temp1 = P2IN; P6OUT = (temp1 & 0xF0); P7OUT = (temp1 & 0x0F)<<4; } }