Created
December 14, 2014 06:53
-
-
Save blakewrege/e74d2d38cea14192bfac to your computer and use it in GitHub Desktop.
possible 2230 assignments?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.text | |
RESET_ISR: | |
MOV #WDTPW+WDTHOLD, &WDTCTL | |
MOV #__stack, R1 | |
CLR.B &DCOCTL | |
MOV.B &CALBC1_1MHZ, &BCSCTL1 | |
MOV.B &CALDCO_1MHZ, &DCOCTL | |
MOV #1, r15 ; print 'A' | |
MOV #1, r14 ; Main loop here | |
Loop: ADD #0x0001, r15 | |
ADD #0x0001, r14 | |
JMP Loop | |
UNEXPECTED_ISR: | |
RETI | |
.section ".vectors", "ax", @progbits | |
.word UNEXPECTED_ISR ; 0xffe0 slot 0 0 | |
.word UNEXPECTED_ISR ; 0xffe2 slot 1 2 | |
.word UNEXPECTED_ISR ; 0xffe4 slot 2 4 (PORT1_VECTOR) | |
.word UNEXPECTED_ISR ; 0xffe6 slot 3 6 (PORT2_VECTOR) | |
.word UNEXPECTED_ISR ; 0xffe8 slot 4 8 | |
.word UNEXPECTED_ISR ; 0xffea slot 5 A (ADC10_VECTOR) | |
.word UNEXPECTED_ISR ; 0xffec slot 6 C (USCIAB0TX_VECTOR) | |
.word UNEXPECTED_ISR ; 0xffee slot 7 E (USCIAB0RX_VECTOR | |
.word UNEXPECTED_ISR ; 0xfff0 slot 8 10 (TIMER0_A1_VECTOR) | |
.word UNEXPECTED_ISR ; 0xfff2 slot 9 12 (TIMER0_A0_VECTOR) | |
.word UNEXPECTED_ISR ; 0xfff4 slot 10 14 (WDT_VECTOR) | |
.word UNEXPECTED_ISR ; 0xfff6 slot 11 16 (COMPARATORA_VECTOR) | |
.word UNEXPECTED_ISR ; 0xfff8 slot 12 18 (TIMER1_A1_VECTOR) | |
.word UNEXPECTED_ISR ; 0xfffa slot 13 1a (TIMER1_A0_VECTOR) | |
.word UNEXPECTED_ISR ; 0xfffc slot 14 1c (NMI_VECTOR) | |
.word RESET_ISR ; 0xfffe slot 15 1e (RESET_VECTOR) | |
.end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
main( int argc, char *argv[] ) | |
{ | |
int aa,bb,cc,dd,rem,mult; | |
mult=1;dd=0; | |
char str[] = "123456789ABCDEF"; | |
sscanf(argv[1], "%d", &aa); | |
sscanf(argv[2], "%d", &bb); | |
cc=aa; | |
printf("Converting %d to the base %d\n",aa,bb,dd); | |
while(aa>1){ | |
rem=aa%bb; | |
aa=aa/bb; | |
dd=dd+(rem*mult); | |
printf(" %d %d = %d\n",aa,rem,dd); | |
mult=mult*10; | |
} | |
dd=dd+(aa*mult); | |
printf("\n %d to the base %d = %d\n",cc,bb,dd); | |
if(bb==16){ | |
rem=(cc%bb); | |
aa=(cc/bb); | |
printf("\n hexidecimal: %d %d = %c %c\n",aa,rem,str[aa-1],str[rem-1]); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <msp430.h> | |
int main(void) { | |
WDTCTL = WDTPW | WDTHOLD; | |
BCSCTL1 = CALBC1_1MHZ; | |
DCOCTL = CALDCO_1MHZ; | |
P1DIR =BIT0; | |
P1REN =BIT3; | |
P1OUT |=BIT3; | |
P1IE |=BIT3; | |
P1IES |=BIT3; | |
P1IFG &= ~BIT3; | |
_BIS_SR(LPM4_bits | GIE); | |
} | |
#pragma vector=PORT1_VECTOR | |
__interrupt void Port_1(void) | |
{ | |
P1OUT ^= BIT0; | |
while (!(BIT3 & P1IN)) {} | |
__delay_cycles(32000); | |
P1IFG &= ~BIT3; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WDTCTL = WDTPW | WDTHOLD; | |
BCSCTL1 = CALBC1_1MHZ; | |
DCOCTL = CALDCO_1MHZ; | |
P1REN |=BIT3; | |
P1OUT |=BIT3; | |
P1DIR |=BIT0; | |
for(;;) { | |
if (!(BIT3 & P1IN)) { | |
P1OUT ^= BIT0; | |
while (!(BIT3 & P1IN)) {} | |
__delay_cycles(32000); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment