domingo, 25 de dezembro de 2011

Programming the hardware

Hello dear followers, in this Christmas post we will finish our first program on the board using the hardware MSP430. For this we will use the libraries already created in the last post and now will do our "main.c".

The initial proposal is to print the code on the LCD "Hello world", is quite simple to test if the LCD is alive, so we created a vector of characters, of course do not forget the watchdog before, otherwise he will bark.

Now initialize the LCD, star the infinite loop to print the vector elements and the end command to jump go to the starting position.
So we have :
int main(void)
{
   WDTCTL = WDTPW + WDTHOLD;  // Stop watchdog
  unsigned char i;
  char Vet[12]="Hello World";
  InicializaLCD();   //Configution
  for (;;)   // Start infinite loop
  {
          for(i=0;i<11;i++)
      {
         EnviarDados(Vet[i]);
      }
         EnviarComando(0x80);    //Initial position
  }
}

The code can also be found here.

Running the LCD will show the message this way:


Okay, we already have our program running on the MSP430, the next post will show how to set up the circuit.

Nenhum comentário:

Postar um comentário