electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » Developers' Corner
programing on-off switch
Post new topic   Reply to topic Moderators: DrJustice
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
a.b.o.z.



Joined: Feb 07, 2007
Posts: 351
Location: Zagreb, Croatia
Audio files: 7
G2 patch files: 4

PostPosted: Sun Oct 05, 2008 12:05 pm    Post subject: programing on-off switch Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
DrJustice



Joined: Sep 13, 2004
Posts: 2112
Location: Morokulien
Audio files: 4

PostPosted: Sun Oct 05, 2008 2:03 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
a.b.o.z.



Joined: Feb 07, 2007
Posts: 351
Location: Zagreb, Croatia
Audio files: 7
G2 patch files: 4

PostPosted: Mon Oct 06, 2008 2:48 am    Post subject: Reply with quote  Mark this post and the followings unread

hei thnx.
There is no flip flop in quartz Sad
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 Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: DrJustice
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Developers' Corner
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use