Microcontroller 4 Sol.docx.docx

Microcontroller 4 Sol.docx.docx - #include...

This preview shows 1 out of 4 pages.

#include <stdio.h> #include <msp430.h> #include <string.h> void String(char str[]); void Char(char c); void Letter(char c); void ShortB(); void LongB(); int main(void){ WDTCTL = WDTPW | WDTHOLD; P1DIR |= 0x41; P1OUT &= 0xFC; unsigned int i; for(;;){ char str[]="Go Knights"; String(str); P1OUT ^= 0x40; for(i=0; i<40000; i++); P1OUT ^= 0x40;} } void String(char str[]){ int s=0; char c; while(str[s]!=NULL){ c=str[s];
Image of page 1

Subscribe to view the full document.

Char(c); s++;} return;} void Char(char c){ unsigned int k; if (c >= 'A' && c <= 'Z'){ c -= 65; Letter(c);} if (c >= 'a' && c <= 'z'){ c -= 97; Letter(c);} if(c == ' ') for(k=0; k<40000; k++); return;} void Letter(char c){ int letterindex; letterindex = c; char b; unsigned int g, a; char*morsecode[36][5]={ {".", "-", " ", " ", " "},{"-", ".", ".", ".", " "},{"-", ".", "-", ".", " "},{"-", ".", ".", " ", " "},{".", " ", " ", " ", " "},{".", ".", "-", ".", " "},{"-", "-", ".", " ", " "},{".", ".", ".", ".", " "},{".", ".", " ", " ", " "}, {".", "-", "-", "-", " "},{"-", ".", "-", " ", " "},{".", "-", ".", ".", " "},{"-", "-", " ", " ", " "},{"-", ".", " ", " ", " "},{"-",
Image of page 2
Image of page 3

Subscribe to view the full document.

Image of page 4
You've reached the end of this preview.
  • Fall '08
  • Staff
  • char c

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern