| Author |
Message |
a.b.o.z.

Joined: Feb 07, 2007 Posts: 351 Location: Zagreb, Croatia
Audio files: 7
G2 patch files: 4
|
Posted: Sun Oct 05, 2008 12:05 pm Post subject:
programing on-off switch |
 |
|
Hi all.
I need sort of block diagram with logic elements to program single push on-off switch. I use quartz composer for my video sets.
In quartz I've got all sorts of logical and math, s&h modules.
So what I need is when I hit key it goes high and stays high and when I hit it again it goes low and stays low.
Can anyone point me in right direction to do this?
Thnx |
|
|
Back to top
|
|
 |
DrJustice

Joined: Sep 13, 2004 Posts: 2112 Location: Morokulien
Audio files: 4
|
Posted: Sun Oct 05, 2008 2:03 pm Post subject:
|
 |
|
Below is an example of a debounced toggle switch. The first flip-flop is used to debounce the mechanical switch (SW1). The second flip-flop is used the toggle switch. The 7474 in the example has /PRE (preset) and /RST (reset) inputs that you can pulse low to select a predetermined state - typically the /RESET line in the system is connected to either of these so that the system is in a known state after power up.
| Code: | Vcc
o
| +------------------+
+-+-+ | +----------+ |
| | | | /PRE | |
R1 # # R2 +---| D /Q |---+
SW1 | | +----------+ | |
o----|---+---| S Q |-------|>CK Q |----> toggle output
+---o---- | | | | /CLR |
| o----+-------| R /Q | +----------+
| +----------+ U2 - D latch
GND U1 - SR latch (e.g. 7474)
(e.g. 74279)
SW1 : momentary on/on switch (resting position at the S input)
R1,R2: pull ups, e.g. 10k
|
I don't know quartz composer, but if it is a software system with logic simulation/implementation where the switch will not be mechanical, then you don't need the U1 debouncer. In this case, simply connect your switch directly to the CK input of U2.
DJ
-- Last edited by DrJustice on Mon Oct 06, 2008 5:24 am; edited 1 time in total |
|
|
Back to top
|
|
 |
a.b.o.z.

Joined: Feb 07, 2007 Posts: 351 Location: Zagreb, Croatia
Audio files: 7
G2 patch files: 4
|
Posted: Mon Oct 06, 2008 2:48 am Post subject:
|
 |
|
hei thnx.
There is no flip flop in quartz
but good news is I found some article about that on apple archive.
It's done with counter (counts how many times key is hit) that number goes into math module with modulo (modulo 2) function wich result in 1 with odd and 0 with even numbers. Pretty simple at the end  |
|
|
Back to top
|
|
 |
|