#include "msp430.h"
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P1DIR |= 0x0F; // Set P1.0 to output direction
for (;
{
volatile unsigned int i; // volatile to prevent optimization
for(int j=0;j<19;j++){
switch (j){
case 0: P1OUT = 0x00; break;
case 1: P1OUT = 0x01; break;
case 2: P1OUT = 0x02; break;
case 3: P1OUT = 0x03; break;
case 4: P1OUT = 0x04; break;
case 5: P1OUT = 0x05; break;
case 6: P1OUT = 0x06; break;
case 7: P1OUT = 0x07; break;
case 8: P1OUT = 0x08; break;
case 9: P1OUT = 0x09; break;
case 10: P1OUT = 0x08; break;
case 11: P1OUT = 0x07; break;
case 12: P1OUT = 0x06; break;
case 13: P1OUT = 0x05; break;
case 14: P1OUT = 0x04; break;
case 15: P1OUT = 0x03; break;
case 16: P1OUT = 0x02; break;
case 17: P1OUT = 0x01; break;
}
}
P1OUT = 0x0F;
i = 50000; // SW Delay
do i--;
while (i != 0);
}
}
Lo que pretendo hacer es que el microcontrolador me cuente del 0 al 9 y del 9 al cero pero no se cual es mi falla digo es mi primer programa en c y la verdad no se mucho, de antemano muchas gracias