| Hardware | ||
| Links Mentioned Parallax Links Tip |
![]() Since I've already tested this design you might just want to try it out and then experiment with simulation later. Of course, you'll need to provide power and ground to the PBX-84 using any of its power and ground pins. You should also install the VIO jumper so that the I/O blocks are running at 5V. The Basic Stamp is simple to use. You can either provide 5V to it's 5V input pin or 9 volts or so to its power pin (pin 24). You also need to have a common ground between the two devices. If you are using a carrier board, you can just wire the grounds together and then connect the following: Stamp pin = Bigout chip 15 = ICLK (9) If you use our ASP-II you can put the Stamp right on the same breadboard you are using for the PBX-84. Since pin 9 isn't on the breadboard, you'll have to run a wire over to the socket for pin 9. A solid wire easily pushes into the socket, just like it does into a breadboard. In addition, you'll want to connect some LEDs, a scope, or a logic analyzer to some of the port pins. I was too lazy to wire up all the pins and way to lazy to move everything to the lab where we have a logic analyzer, so I placed 4 5V LEDs on PORTA 0-3, one on PORTC 0, and one on PORTB 0. If you don't have 5V LEDs, you'll need to use a standard LED and an appropriate dropping resistor for 5V (say 220 ohms or so). Wire the LEDs so they will light when the output of the chip is high. Here's some sample Stamp software: '{$STAMP BS2}
' Example "bigout" chip program
' Williams
byt var byte ' output byte
chan var byte ' output channel
datap con 14 ' data line
clk con 15 ' clock line
gsr con 12 ' reset (sort of optional, but recommended)
t var byte ' temporary
LOW datap ' data
LOW clk ' clock
LOW gsr ' gsr
pulsout gsr,1 ' hard reset chip
top:
for t=0 to 15 ' loop first four bits of porta
chan=0
byt=t
gosub sendit
chan=3 ' and blink portd pin 0
byt=t&1
gosub sendit
pause 100
next
for t=15 to 0 ' now go backwards
chan=0
byt=t
gosub sendit
chan=1
byt=t&1
gosub sendit ' while blinking portb pin 0
pause 100
next
goto top
' This routine actually sends data to the Bigout chip
' chan = channel number (0-3)
' byt = output byte (0-255)
sendit:
shiftout datap,clk,MSBFIRST,[$400 + (chan<<8) + byt\12]
return
The heart of the program is in the last three lines. This forms the command and shifts it out to the chip. Technically, the Stamp doesn't have to reset the chip on power up, but it helps to avoid a common problem. Suppose the Stamp is part way through a command and you reset it or reprogram it? When it starts over, the chip will still be part way through a command and this can lead to unexpected behavior. By forcing a pulse on IRESET at the start of the program, the chip is placed in a known state. Up next: Simulation. © 2002 by AWC. All Rights Reserved. |