MSP430 C Code Examples from Class: Difference between revisions
Jump to navigation
Jump to search
Frohro moved page MSP430 Code Examples from Class to MSP430 Assembly Code Examples from Class: I wanted Assembly so Googler's will find these examples. |
No edit summary |
||
Line 1: | Line 1: | ||
# | <nowiki> | ||
#include <msp430.h> | |||
/* | |||
* Copy this program, debug it, view the disassembly, and note how the addressing modes work. | |||
* main.c | |||
*/ | |||
int dog = 2; | |||
int cat; | |||
char table[4] = {119,120,121,122}; // 'w','x','y','z' is 119(0x77),120 (0x78), 121 (0x79), 122(0x7A) in ascii | |||
char* cow; | |||
int main(void) { | |||
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer | |||
cat = dog; | |||
cat = table[dog]; | |||
cow = table; | |||
cat = *cow++; | |||
cat = *cow; | |||
return 0; | |||
} |
Revision as of 17:11, 28 October 2015
<nowiki>
- include <msp430.h>
/*
* Copy this program, debug it, view the disassembly, and note how the addressing modes work. * main.c */
int dog = 2; int cat; char table[4] = {119,120,121,122}; // 'w','x','y','z' is 119(0x77),120 (0x78), 121 (0x79), 122(0x7A) in ascii char* cow; int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
cat = dog; cat = table[dog]; cow = table; cat = *cow++; cat = *cow; return 0; }