Tool/software:
Why won't main() jump to l_delay()? Note the while(1) put in the l_delay() sub routine. That should crash the program. But the main loop still runs at 65khz no matter what is done to l_delay().
This does run as expected on an Atmel processor (with their port and bit labels) using the ICC compiler. And I have been using crude delay routines like this for years.
#define bit_tst(A,B) (A & B)
#define bit_set(A,B) A |= B
#define bit_clr(A,B) A &= ~B
#define bit_tog(A,B) A ^= B
#include <msp430f149.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include "ILI9163lcd.c"
// button ports
#define BUTN_ENTER !P6IN,BIT0
#define BUTN_UP !P6IN,BIT1
#define BUTN_DOWN !P6IN,BIT2
#define BUTN_LEFT !P6IN,BIT3
#define BUTN_RIGHT !P6IN,BIT4
#define RUN_LED_ON() bit_set(P2OUT,BIT7)
#define RUN_LED_OFF() bit_clr(P2OUT,BIT7)
static init_ports(void)
{
P1DIR = 0xFF;
P2DIR = 0xFF;
P6DIR = 0x0;
P1OUT = 0x0;
P2OUT = 0x0;
P6OUT = 0x1F; // pull ups
}
void l_delay(int d)
{
int a,b;
while(1);
for (a = 0; a < d; a++)
for (b = 0; b < d; b++);
}
int main()
{
WDTCTL = (WDTPW | WDTHOLD); // stop watchdog timer
init_ports();
// init_uart();
RUN_LED_OFF();
// ILI9163_init(0);
RUN_LED_ON();
while(1)
{
l_delay(1000);
RUN_LED_OFF();
l_delay(1000);
RUN_LED_ON();
}
}
