SP.710: Intro to Microcontrollers

 Day 3: Serial communications

1) Hook up the MAX233 chip and plug in/solder together
   the serial cable. (see datasheets)

2) Check out the descriptions of the following built-in C
   functions in your C reference manual:

#use rs232
kbhit()
putc()
getc()
printf()

3) Here are some programs to write to get a hang of PICs
   and serial communications:

   i) a program that turns on an LED when you type
      press "A" on the keyboard (with the PIC hooked
      to the computer serial port and a serial terminal
      program like HyperTerm running), and turns it
      off when you press "B"

   ii) a program that reads characters from the computer,
       does nothing unless they are lowercase letters,
       but in that case prints back the uppercase version
       of the letter

 iiiA) a program that continually sends the status of
       the button over the serial port to the computer,
       separated by commas.
       (so the terminal program on the computer should
        display something like "0,0,0,0,1,1,1,1,0,0,...")
       (this is the simplified version of a program that
        sends data on, say, the temperature in a room
        or the pressure on a mountain peak to a central
        computer).

 iiiB) in (iiiA), the fact that sending data over the
        serial port is relatively slow keeps you from taking
        data quickly. If we wanted to use this to see the
        effect of "switch bouncing" (see Day 2, program 3)
        in action, we'd be out of luck.
       Change this program so that the PIC samples the button
        (records data) very quickly for a short period of time,
        and then sends all this data to the serial port as above.
       The goal of this program is to record & send to the serial
        port detailed evidence of "switch bouncing".
       You may want to read in the manual/ask us about "arrays".