Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#include <msp430.h>
#include <stdint.h>
void spewSPI(const uint8_t n) {
static const uint8_t *spiStrTBL[] = {
uint8_t indx; // 0-255 so we get mov.b
if ( n > sizeof(spiStrTBL) / sizeof(spiStrTBL[0]) ) {
return; // ignore out of bounds request
for ( indx = 0; spiStrTBL[n][indx] != 0; ++indx ) {
UCA0TXBUF = spiStrTBL[n][indx];
void callIt() {
spewSPI(0); // send parm1
spewSPI(1); // send parm2
.file "tblexample.c"
.arch msp430g2553
.cpu 430
.mpy none
.p2align 1,0
.global spewSPI
.type spewSPI,@function
* Function `spewSPI'
cmp.b #5, r15
jhs .L1
mov.b r15, r15
rla r15
mov spiStrTBL.1369(r15), r13
mov.b #0, r14
jmp .L3
mov.b r15, &__UCA0TXBUF
add.b #1, r14
mov.b r14, r15
add r13, r15
mov.b @r15, r15
cmp.b #0, r15
jne .L4
.size spewSPI,.Lfe1-spewSPI
;; End of function
.p2align 1,0
.global callIt
.type callIt,@function
* Function `callIt'
mov.b #0, r15
call #spewSPI
mov.b #1, r15
call #spewSPI
.size callIt,.Lfe2-callIt
;; End of function
.string "parm1"
.string "parm2"
.string "..."
.string "parm99"
.p2align 1,0
.type spiStrTBL.1369,@object
.size spiStrTBL.1369,8
.word .LC0
.word .LC1
.word .LC2
.word .LC3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.