This lab was awesome. I had a great time each step of the way.

The one thing that I did have a hang-up on was where to put the capacitors around the +12V in and power regulator. I had to get used to the idea that they didn't need to be in serial. Parallel is OK. I also don't quite understand why you need a 10K Ohm resistor to ground with switches. It seems that ground should be ground (0 volts) but I guess the resistor ensures that.

Programming chips is fun. My first program made two LED's blink at different intervals: DEFINE OSC 4 OUTPUT portd.0 OUTPUT portd.1

main: HIGH portd.0 PAUSE 1000 LOW portd.0 HIGH portd.1 PAUSE 100 LOW portd.1 GOTO main

Then I got two SPST toggle switches and added two more LED's (total=4). My first program had an 'if/then' statement with an 'else.' I was only able to take advantage of two states of the possible four I could get with two switches (both on, both off, A=on B=off, A=off B=on). So I made this code which called out each of the 4 states: (some of the formating was lost in copying)

DEFINE OSC 4 Input portb.7 Input portb.3 Output portd.0 output portd.1 output portd.3 output portd.2

Main: If portb.7 = 1 and portb.3 = 1 then 'both switches on

   high portd.0
   pause 100
   low portd.0
   high portd.1
   pause 100
   low portd.1
   high portd.2
   pause 100
   low portd.2
   high portd.3
   pause 100
   low portd.3

endif

If portb.7 = 1 and portb.3 = 0 then 'switch A on, B off

   high portd.0
   high portd.3
   pause 500
   low portd.0
   low portd.3
   high portd.1
   high portd.2
   pause 500
   low portd.1
   low portd.2

endif

If portb.7 = 0 and portb.3 = 1 then 'switch A off, B on

   high portd.0
   high portd.3
   pause 5
   low portd.0
   low portd.3
   high portd.1
   high portd.2
   pause 5
   low portd.1
   low portd.2

endif

If portb.7 = 0 and portb.3 = 0 then 'both switches off

   Low portd.0
   Low portd.1
   Low portd.2
   Low portd.3

My favorite setting was the 'airport runway light' effect the LED's had when they blinked at 5 milli-seconds. I think I'm going to get a third switch and a couple more LED's or an LED brick.

Then I hooked up the serial jack to my board. Using "SEROUT2?," I got the chip to transmit "serious serial" over and over again to the computer. I'm psyched for analog in and not using 'PAUSE.'


Page last modified September 22, 2005, at 03:25 PM