EasyManuals Logo

Texas Instruments MSP430 User Manual

Texas Instruments MSP430
413 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #58 background imageLoading...
Page #58 background image
58
Code Example
delay.h
#include <msp430.h>
#define F_CPU 8
void delay_us(unsigned int value);
void delay_ms(unsigned int value);
delay.c
#include "delay.h"
void delay_us(unsigned int value)
{
register unsigned int loops = ((F_CPU * value) >> 2) ;
while(loops)
{
_delay_cycles(1);
loops--;
};
}
void delay_ms(unsigned int value)
{
while(value)
{
delay_us(1000);
value--;
};
}
lcd.h
#include <msp430.h>
#include <delay.h>
#define LCD_PORT P2OUT
#define LCD_RS BIT0
#define LCD_EN BIT1
#define LCD_DB4 BIT2
#define LCD_DB5 BIT3
#define LCD_DB6 BIT4
#define LCD_DB7 BIT5
#define LCD_RS_HIGH LCD_PORT |= LCD_RS

Table of Contents

Other manuals for Texas Instruments MSP430

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments MSP430 and is the answer not in the manual?

Texas Instruments MSP430 Specifications

General IconGeneral
BrandTexas Instruments
ModelMSP430
CategoryMicrocontrollers
LanguageEnglish

Related product manuals