EasyManua.ls Logo

Texas Instruments MSP430

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
Loading...
100
Code Example
#include <msp430.h>
unsigned int ms = 0;
unsigned int value = 0;
unsigned char n = 0;
unsigned char seg = 0;
const unsigned char num[10] = {0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8,
0x80, 0x90};
void GPIO_graceInit(void);
void BCSplus_graceInit(void);
void Timer0_A3_graceInit(void);
void System_graceInit(void);
void WDTplus_graceInit(void);
#pragma vector=TIMER0_A1_VECTOR
__interrupt void TIMER0_A1_ISR_HOOK(void)
{
ms++;
if(ms > 999)
{
ms = 0;
value++;
if(value > 9999)
{
value = 0;
}
}
switch(seg)
{
case 1:
{
n = (value / 1000);
P2OUT = num[n];
P1OUT = 0xE0;
break;
}
case 2:
{
n = ((value / 100) % 10);
P2OUT = num[n];
P1OUT = 0xD0;
break;
}
case 3:
{
n = ((value / 10) % 10);
P2OUT = num[n];
P1OUT = 0xB0;

Table of Contents

Other manuals for Texas Instruments MSP430

Related product manuals