Jan 302013
 

IMG_1855Hello again, it has been far too long since I’ve updated this blog. They say excuses are like assholes–they’re full of shit. So I won’t give any and just jump right in…

I am learning assembly programming on the MSP430 from Texas Instruments. After a failed attempt at learning x86 assembly, I was recommended the MSP430 and so far it seems like the right choice.

The MSP430 is a 16 bit low power microcontroller. It has a von Neumann architecture which means that there is only one address space for program code and memory. It is also a RISC system or more accurately a RISC like system. There are only 27 core instructions in its instruction set but, unlike pure RISC systems, it can do arithmetic on values directly in main memory.

The MSP430 is also cheap. I am using an MSP430 Launchpad that costs less than five dollars. The Launchpad is a complete development board that includes an onboard debugger/emulator. On the software side of things, I am using the free Kickstart version of the IAR Embedded Workbench IDE for the MSP430. There are no code size restriction for the assembler. Finally, I am using a book titled MSP430 Microcontroller Basics by John H. Davies. This book was also highly recommended.

Here’s my first assembly program. It’s from the book but slighty modified because the book uses a different development kit. It turns on LED2 on the Launchpad.

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <msp430g2553.h> 
 
             RSEG      CODE
Reset:
             mov.w     #WDTPW|WDTHOLD,&WDTCTL ; Stop watchdog timer
             mov.b     #01000000b,&P1OUT      ; Turn on P1's 6th bit
             mov.b     #01000000b,&P1DIR      ; Set P1OUT.6 to output
InfLoop:
             jmp       InfLoop                    ; Infinite loop
;-----------------------------------------------------------------------
             RSEG      RESET                      ; Reset vector segment
             DW        Reset                      ; Address to start
             END
The surfuace mount 32kHz crystal included in the MSP430 Launchpad box.

The surfuace mount 32kHz crystal included in the MSP430 Launchpad box.

 

Pads for the crystal.

Pads for the crystal.

 

Crystal soldered!  It wasn't too bad.

Crystal soldered! It wasn’t too bad.

 Leave a Reply

(required)

(required)


2 + = nine

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre user="" computer="" escaped="">