last week’s project demos servo control with photoresistor and enable/disable buttons demo in...

11
Last week’s project demos • Servo control with photoresistor and enable/disable buttons • Demo in class tonight – don’t start on the next project until I’ve seen this one!

Upload: moses-boyd

Post on 11-Jan-2016

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Last week’s project demos Servo control with photoresistor and enable/disable buttons Demo in class tonight – don’t start on the next project until I’ve

Last week’s project demos

• Servo control with photoresistor and enable/disable buttons

• Demo in class tonight – don’t start on the next project until I’ve seen this one!

Page 2: Last week’s project demos Servo control with photoresistor and enable/disable buttons Demo in class tonight – don’t start on the next project until I’ve

More circuit design

Seven segment display

Page 3: Last week’s project demos Servo control with photoresistor and enable/disable buttons Demo in class tonight – don’t start on the next project until I’ve

The Seven-segment Display

• Nothing more that 8 LEDs in a single package– Each LED can be turned on/off

independent of all others

Page 4: Last week’s project demos Servo control with photoresistor and enable/disable buttons Demo in class tonight – don’t start on the next project until I’ve

The Seven-segment Display

• Like individual LEDs, each has a cathode and an anode leg

• The anode of each LED is routed to its own pin on the package

• All cathodes are connected together and routed to two pins on the package (choose one of the other)

Page 5: Last week’s project demos Servo control with photoresistor and enable/disable buttons Demo in class tonight – don’t start on the next project until I’ve

Schematic

• The schematic shows the part as seven separate LEDs (as expected)

Page 6: Last week’s project demos Servo control with photoresistor and enable/disable buttons Demo in class tonight – don’t start on the next project until I’ve

Usage

• Use them as seven separate LEDs

• That is, for whatever you would normally use an LED for

Page 7: Last week’s project demos Servo control with photoresistor and enable/disable buttons Demo in class tonight – don’t start on the next project until I’ve

Typical circuit schematic and layout

• See chapter 7 for example code– It’s just a bunch of OUTH and PAUSE statements

Page 8: Last week’s project demos Servo control with photoresistor and enable/disable buttons Demo in class tonight – don’t start on the next project until I’ve

Memory usage

• So far we have been writing to individual pins on the Basic Stamp module

• For the seven segment display it would be convenient to write to multiple pins at one time

• The I/O pins are memory mapped to various PBASIC Word type instructions – INS, OUTS– These are broken down further to Byte type instructions

• INL, INH, OUTL, OUTH (Low byte, High byte)• These are broken down further to Nibble type instructions

– INA, INB, INC, IND, OUTA, OUTB, OUTC, OUTD– These are broken down further to Bit type instructions

» IN0 – IN15, OUT0 – OUT15

• Utilizing these instructions will set the direction of the pin accordingly

Page 9: Last week’s project demos Servo control with photoresistor and enable/disable buttons Demo in class tonight – don’t start on the next project until I’ve

Memory usage

• Another instruction called DIRS (and all size variations) is available to set the directions of the I/O pins

• We saw this earlier when we needed to “disconnect” an output pin– Set the bits to 0 for input direction– Set the bits to 1 for output direction– Default power up is input

• This is useful when setting up to do I/O without actually doing the I/O operation

Page 10: Last week’s project demos Servo control with photoresistor and enable/disable buttons Demo in class tonight – don’t start on the next project until I’ve

Homework

• By changing the value of the capacitor the time decay can be altered

– Book labs had you do this

• For this assignment

– Build RC circuits using both 0.1uF and 0.01uF capacitors to create 2 timers (select one resistor value)

– Include a button to select one of the two timer s• Include debug statements to indicate timer decay

– Use the bidirectional LED to indicate which timer is selected

• Green – fast (short time decay)

• Red – slow (long time decay)

– Include a 7-segment display in your design in some creative way

Page 11: Last week’s project demos Servo control with photoresistor and enable/disable buttons Demo in class tonight – don’t start on the next project until I’ve

Deliverables

• Due next week– A functional description of the system– A state-machine diagram depicting the

operation of the system– Source code– A schematic diagram of the circuit– A working demonstration on the Basic

Stamp development board (in class)