I was having a bit of trouble getting this
to work the way I wanted it to so I set
up the latch circuit on a proto board
to see if it was doing what I wanted it to do
and when I wanted it to do it.
I whipped up this ZBasic program in a few minutes to test
the CD4011 latch circuit.
public y as long
public x as long
public pin18 as byte
Sub Main()
for x = 1 to 1000000
Call PutPin(16, ZXOutputLow) 'set latch
for y = 1 to 50 'delay for a few usec
next y
Call PutPin(16, ZXOutputHigh)
Debug.Print " latch is set " 'send to PC
pin18 = getPin(18) 'read latch output send to PC
Debug.Print " pin 18 latch output = "; CStr(pin18)
for y = 1 to 1000000 ' delay for msecs
next y
'try to reset the latch
Call PutPin(17, ZXOutputLow) 'latch reset
for y = 1 to 50 'delay for a few usec
next y
Call PutPin(17, ZXOutputHigh) 'normally high
for y = 1 to 1000000 ' delay for msecs
next y
Debug.Print " latch is reset " 'send to PC
pin18 = getPin(18) 'read latch outpu send to Pt
Debug.Print " pin 18 latch output = "; CStr(pin18)
next 'go back and do it again
End Sub
I logged the output data in a file on the PC hard disk.
Downloading file
"C:\Documents and Settings\junk\Desktop\ZBasic\Latch-test-only.zxb":
...........................
Download complete.
Verifying download:
...........................
Verification complete.
ZBasic v3.1
Log file:
latch is set
pin 18 latch output = 0
latch is reset
pin 18 latch output = 1
latch is set
pin 18 latch output = 0
latch is reset
pin 18 latch output = 1
latch is set
pin 18 latch output = 0
latch is reset
I don't know how I got along in the old days
without this powerful tool. It can do things a scope
cannot do when testing logic circuits. Basically what
it amounts to is a combination of a powerful synchronized
multi-output function generator and a multi-channel scope
all in one low cost instrument.
Paul Lamar
--
The Rotary Engine NewsLetter. Powered by Linux.
ACRE NL web site.
http://www.rotaryeng.net
Youtube key word PaulLamar2
Copyright 1998-2010 All world wide rights reserved.