You may have used a PAK-V with a Stamp to generate 8 channels of PWM simultaneously. But what if you want to generate those 8 channels using a PC? Of course, you could connect a Stamp to the PC and go that route. But then you are just using the Stamp as a middle man, which is a waste of a good Stamp.

Many of the PAKs use a synchronous protocol so that the Stamp (or other host computer) doesn't have to listen for results. However, the PAK-V doesn't talk to the host, so it uses RS-232 communications (at TTL levels, of course).

A simple resistor connected to a DB9 connector can allow a PC to directly control a PAK-V. You just have to write a program to generate the correct commands. Here is a schematic of the hookup:

The output circuit generates a voltage from 0 to 5V. Since the PWM is continuous, the large capacitor doesn't really affect the circuit operation, and provides plenty of filtering. You could also use the PWM output to drive a lamp, an LED, or a motor -- anything you'd normally use PWM for. This is so useful, we now make the GP-6 for just this purpose. The GP-6 is a PAK-Vb on a circuit board with a power supply and a connection for a PC.

You could control the PAK with any PC programming language that supports the serial port. I wrote a simple Visual Basic program that does the job (see below for how to use QuickBasic under DOS):

The sliders are standard controls, but I wanted to flip them upside down. So the range is actually 0 to -255! The code corrects for this, but when you drag the slider it shows a dash in front of the number (e.g., 50 shows as -50). That's a .... feature... yeah!

The numbers below the slider shows the approximate voltage for that channel. There is no way to change the serial port parameters since the PAK is fixed at 8 bits, no parity.

I won't go into the details of the Visual Basic program, but it is straight forward. You can download the project files. If you don't have Visual Basic, you can download a (very large) full install package at pak5pc.zip.

You can also hook up PAKs that use our PAK protocol to a PC, but it is a bit more effort. You can read an article on connecting a PAK-IV to a PC's printer port.

Using QuickBasic

Dick Zimmer wrote to share his code that he uses with the PAK-V and QuickBasic:

        OPEN "com1: 9600,n,8,1,cd0,cs0,ds0" FOR OUTPUT AS #1
        PRINT #1, CHR$(&H85)           'reset
        top:
        FOR B1 = 0 TO 255
          PRINT #1, CHR$(&H27); CHR$(B1)
          SLEEP 1                        'wait 1 second
        NEXT
        GOTO top
 

Thanks Dick!


Site contents © 1997-2018 by AWC, Houston TX    (281) 334-4341