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.

sexta-feira, 23 de dezembro de 2011

Hardware libraries

Hi, after a time we come back in this post to develop our hardware libraries of our project with the MSP430F2013.

First we will test the “Hello World” in the LCD, using 4 bits, this will give us some  trouble .
Then we will create a library “basico.h” that it has basic functions for any program that we will use:

// bit functions
#define BitSet (arg, bit) ((arg) |= (1<< bit))
#define BitClr (arg, bit) ((arg) &= ~ (1<< bit))
#define BitFlp (arg, bit) ((arg) ^= (1<< bit))
#define BitTst (arg, bit) ((arg) & (1<< bit))

Now we will create our “lcd.c”, this will make all the operations for functions to facilitate our LCD use.
Starting for delay, for we start the LCD, it needs a time before receiving commands, for this we will create an expend  time, using Loop, minor of 40us and a greater of 2ms, that uses the one of 40us.

In the boot function we configure the direction of the terminals with BitSet, we use the delay, and we send the commands of 4 bits 2 lines, incremental  mode, blink, to erase the display, and to order to the initial position.

To send command we create a function that catches the command of 8 bits, makes bitshift of 4, orders to read 4 and later the others 4. Already
to send data is practically the same thing, only that at  the beginning instead of use BitSet (P1OUT, RS) we use BitClr, that is the data mode.

Finally we have the dumb function that the position of the line, for sends command.
Thus, finally, let us create “lcd.h”:

#ifndef LCD_H
#define LCD_H
void Delay40us (void);
void Delay2ms (void);
void EnviarComando (unsigned to char cmd);
void EnviarDados (unsigned to char value);
void InicializaLCD (void);
void MudaPosicao (unsigned to char lin, unsigned to char col);
#endif

All the libraries can be found in our site
clicking here.
With this, the libraries are read, we will to create the in the next post.

Until soon!

sexta-feira, 16 de dezembro de 2011

Programando o hardware

Olá caros seguidores, nesse post de Natal terminaremos a programação do nosso primeiro programa para embarcarmos no hardware usando o MSP430. Para isso usarmos as bibliotecas já criadas no último post e agora faremos nosso “main.c”.
A proposta inicial é imprimir no LCD o código “Hello world”, é algo bem simples para testarmos se o LCD está vivo, para isso criamos um vetor de caracteres, claro não se esqueça do watchdog antes, senão ele vai latir.
Agora inicializamos o LCD e abrimos o loop infinito para impressão dos elementos do vetor, ao final enviamos comando para ir para a posição inicial.

Assim temos:

int main(void)
{
   WDTCTL = WDTPW + WDTHOLD;  // Interrompe o watchdog

  unsigned char i;
  char Vet[12]="Hello World";

  InicializaLCD();   //Configuração
  for (;;)   // Inicia loop infinito

  {
          for(i=0;i<11;i++)
      {

         EnviarDados(Vet[i]);
      }

         EnviarComando(0x80);    //Posição Inicial
  }

}


O código também pode ser encontrado aqui.


Funcionando na plaquinha a mensagem ficará dessa forma:



  
Pronto, já temos nosso programa montado para rodar no MSP430, no próximo post mostraremos como montar o circuito.


Feliz Natal a todos!

sexta-feira, 9 de dezembro de 2011

Bibliotecas para o hardware


Olá, caros seguidores, após um tempo fora voltamos nesse post para desenvolver nossas bibliotecas para o hardware do nosso projeto com o MSP430F2013.

Primeiramente iremos testar o “Hello World” no LCD, usando 4 bits, isso nos dará um pouco mais de trabalho.

Criaremos, então, uma biblioteca “basico.h” que tem funções básicas para qualquer programa que iremos utilizar:

//funções de bit
#define BitSet(arg,bit) ((arg) |= (1<<bit))
#define BitClr(arg,bit) ((arg) &= ~(1<<bit))
#define BitFlp(arg,bit) ((arg) ^= (1<<bit))
#define BitTst(arg,bit) ((arg) & (1<<bit))



Agora criaremos nossa “lcd.c”, esta fará todas as operações por funções para deixar mais fácil utilizarmos o LCD posteriormente.

Começando pelo delay, para inicializaremos o LCD, ele precisa de um tempo antes de receber comandos, para isso criaremos um gasto de tempo, por loop, menor de 40us e um maior de 2ms, que usa o de 40us.

Na função de inicialização configuramos as direção dos terminais com BitSet, damos o delay, e enviamos os comandos de 4 bits 2 linhas, modo incremental, blink, apagar o display, e mandar para a posição inicial.

Para enviar comando criamos uma função que pega o comando de 8 bits faz o bitshift de 4, manda ler 4 e depois os outros 4. Já para enviar dados é praticamente o mesmo esquema, só que no início ao invés de dar BitSet (P1OUT,RS) damos BitClr, que é o modo dados.

Por fim temos a função que muda a posição da linha, por envia comando.

Assim, por último, criemos a “lcd.h”:

#ifndef LCD_H
                #define LCD_H
                void Delay40us(void);
                void Delay2ms(void);
                void EnviarComando(unsigned char cmd);
                void EnviarDados(unsigned char valor);
                void InicializaLCD(void);
                void MudaPosicao(unsigned char lin, unsigned char col);

#endif

Todas as bibliotecas podem ser encontrada no nosso site clicando aqui.


 Com isso já temos as bibliotecas prontas, o programa iremos criar no próximo post.

Até logo!

sexta-feira, 7 de outubro de 2011

Creating the Gerber files


 Hello dear followers, today to finish our clock layout with the MSP430-F2013 we will create the gerber, group of files that are sent to the company that the poster will be printed circuit.
First go into Options, Post Process Settings in this window click on the lines of all options with bottom and in the new window uncheck "Enable for post processing", leave this option checked only for (TOP, SMT, OSH, AST, DRD). Done this go on Auto, and then click Run Post Processor, Orcad now must create in the directory of file open multiple files from gerber as (name.TOP,.OSH,.SMT,.GTD,. DRD,.AST, .lis,.DTS and TRUEHOLE.tap)




To help us visualize the gerber as prints we use some program, where we'll use the Viewplot (R), which is free and can be found here.
Opening the program, load the generated file name.TOP ", and will appear something like this:





Done! Now we have went  through every part of the project and hardware specification, creation of schematic and layout. We have then a project halfway finished.





Hey, look at the day and time of the post!


sexta-feira, 30 de setembro de 2011

Gerando e visualizando o gerber

Olá caros seguidores, hoje para finalizar nosso layout do relógio com o MSP430-F2013 iremos criar o gerber, grupo de arquivos que são enviados para a empresa que confeccionará o circuito impresso.
Primeiramente vá em Options, Post Process Settings nessa janela clique nas linhas de todas as opções com bottom e na nova janela desmarque a opção “Enable for post processing”, deixe essa opção marcada apenas para (TOP, SMT, SST, AST, DRD). Feito isso vá em Auto e clique em Run Post Processor, o Orcad agora deve criar no diretório do arquivo aberto vários arquivos de gerber como (nome.TOP, .SST, .SMT, .GTD, . DRD, .AST, .lis, .DTS e TRUEHOLE.tap)



Para visualizarmos o gerber como será impresso temos que usar algum programa, no caso usaremos o Viewplot, que é gratuito e pode ser encontrado aqui.
Abrindo o programa, carregue o arquivo gerado “nome.TOP”, e aparecerá algo como:



Pronto agora passamos por toda parte de projeto e especificação de hardware, criação do esquemático e layout. Temos então um projeto a meio caminho andado.

sexta-feira, 23 de setembro de 2011

Creating the copper pour


We return again with the layout, but now is part of the final finishing.
First let's get the texts at silk screen (OSH), with the Text Tool selected, we should remove the unnecessary names and adopt a pattern of provision, for example only to the right and upon, except a few exceptions in that you cannot place in appropriate niches.
Now let's add a fill layer copper, associated with the mesh of the Earth, to provide protection in case there is something in short this is grounded, in addition it also serves to filter out possible noise. So with Obstacle Tool make a rectangle on the entire plate and click on the edge by selecting New in Obstacle Type select Copper pour, in Width and Clearance put 0.5 and Net Attachment select 0 (GND), click OK.





The program will render the fill and superimpose all land lines, connecting the pads by small filaments only. Then the appearance of the layout should be this:






In the next post, we'll show you how to generate and view the gerber of our layout to the design of the clock with the MSP430-F2013.