Circuit design help?

FA-MAS

Kula's Candy
Joined
Oct 3, 2009
Posts
299
I'm wondering if someone could help me design a simple circuit. Basically the lock switch mod you'd do on a TE, but I wanna do it without installing an actual switch. Kind of like the start+select=guide mod. But I wanna do it with one button instead.

So what I'd like to do is have this circuit complete or break the ground connection for a after holding a button for a certain length of time.

So here's the setup of my joystick, grounds are daisy chained, with start, guide, and back as the final links in the chain. In that order specifically.

Say I plug in my joystick

The start button would act as normal, a single press and release would ground the start signal and the controller pcb would register that start was pressed. Course guide and back would work as normal

But, I would like to be able to hold down that same start button, and it would break the ground so that whenever I press the start, guide, or back buttons they would not ground. Thus not working.

I'm sure it's probably simple with an IC, I'm not an electrical engineer. I can assemble it, but I need help designing it and I can't read schematics so I need pictures in regular human speak.
 

Xian Xi

JammaNationX,
15 Year Member
Joined
Dec 1, 2005
Posts
27,750
You could probably use a PIC16F630. I'm not very familiar with it but I know people use it for mods like that. It does have to be programmed I think though.
 

FusionITR

Krauser's Shoe Shiner
Joined
Aug 18, 2005
Posts
243
Yea, use a PIC. Very simple design but you need to know assembly (just very basic assembly).

So basically, you you want the start button to have two functions?

Just a single tap of start = function x
Press and hold start = function y?

If so, use the start button as an input to the pic. Every clock cycle poll the input. If the start button is pressed, use a register to clock clock cycles, if the button is released before a certain amount of clock cycles, ground the the output of the pic that you have connected to the start ground. If the counter goes above your threshold, reset the counter and don't ground the start ground (and do whatever other function you want it to).

Let me know if that makes sense.
 

Hewitson

Metal Slug Mechanic
Joined
Mar 6, 2008
Posts
2,198
Yea, use a PIC. Very simple design but you need to know assembly (just very basic assembly).
No you don't. For someone new to MCU's, AVR is far superior choice anyway.

Talking about cycle-counting for this type of simple programming is ridiculous. Simply base it on a delay of a certain amount of time.

I don't quite understand what you want to do, but it sounds to me like it could be achieved by simply using a couple of gates.
 

FusionITR

Krauser's Shoe Shiner
Joined
Aug 18, 2005
Posts
243
No you don't. For someone new to MCU's, AVR is far superior choice anyway.

Talking about cycle-counting for this type of simple programming is ridiculous. Simply base it on a delay of a certain amount of time.

I don't quite understand what you want to do, but it sounds to me like it could be achieved by simply using a couple of gates.

Honestly I never heard of AVR (I rarely use ucontrollers), but assembly is as a low level language as you can get. When I first started ucontrollers I started with asm and never looked back. Personal preference though.

As far as cycle counting, why is it ridicoulus? It's just a few lines of code (in assembly). Theres not even a way to tell time in assembly unless you cycle count.
 

Hewitson

Metal Slug Mechanic
Joined
Mar 6, 2008
Posts
2,198
Honestly I never heard of AVR (I rarely use ucontrollers), but assembly is as a low level language as you can get. When I first started ucontrollers I started with asm and never looked back. Personal preference though.
Don't get me wrong, I'd never advise using anything else (especially as the AVR instruction set is so similar to the 6502). But you certainly can use C or BASIC.

As far as cycle counting, why is it ridicoulus? It's just a few lines of code (in assembly). Theres not even a way to tell time in assembly unless you cycle count.
Sure there is. Use a timer on the chip.

Or if you're using the wonderful AVR: http://circuitplanet.blogspot.com/2009/10/avr-delay-calculator.html
 
Last edited:

FusionITR

Krauser's Shoe Shiner
Joined
Aug 18, 2005
Posts
243
Sure there is. Use a timer on the chip.

I don't think any of the ucontrollers I've used had any kind of on chip timer. Timed delays were always just register loops, which again only took like 4 lines of code.
 

Hewitson

Metal Slug Mechanic
Joined
Mar 6, 2008
Posts
2,198
The thing with a delay loop is you are simply wasting the cycles during it.

Using a timer, you can set up an interrupt to occur when it reaches a value of your choice, and have the processor do other things in the meantime.

You should check out a datasheet for a current AVR chip, something like the ATMega328. The amount of features they have is amazing.
 
Last edited:

FusionITR

Krauser's Shoe Shiner
Joined
Aug 18, 2005
Posts
243
The thing with a delay loop is you are simply wasting the cycles during it.

Using a timer, you can set up an interrupt to occur when it reaches a value of your choice, and have the processor do other things in the meantime.

You should check out a datasheet for a current AVR chip, something like the ATMega328. The amount of features they have is amazing.

Havent looked at those, but is it worth it? How much do those ucontrollers cost? A PIC16F can be had for like 20 cent.
 

Kyuusaku

B. Jenet's Firstmate
Joined
Mar 26, 2003
Posts
419
Granted I don't really understand the point (what's a "TE"?) but I say go with the switch.

While what you want is simple, it's a lot of work to write firmware, draw up a non-schematic diagram, program and send you a chip. Essentially for something that replaces a switch.

A logic circuit would be better for you since it doesn't need programming, but then it will require multiple components, RC-based timing which means without doubt some tweaking to get functional.

The GND gate idea (switching an output between Hi-Z and 0) may be an issue depending on the values and voltage of the button pull-ups, the MCU/gate could get fried by sinking too much current. The smarter way to do this would be to configure the MCU/gate for 2 open-collector inputs and 2 open-collector outputs then relay/propagate the button states, or use a transistor.

Edit:
it probably won't work as is, but maybe someone can help you get it working. Some other gate will work better for buffering the start button, I just tried to keep it at one chip.
 
Last edited:

Hewitson

Metal Slug Mechanic
Joined
Mar 6, 2008
Posts
2,198
I was thinking more along the lines of using an XOR gate so that if the start button is pressed the other two buttons won't work and vice versa.

FusionITR: A decent AVR will set you back about $5.. If it's worth using an MCU it's worth using a good one. Microcontroller's shouldn't be used as replacement for simple TTL logic as they often are.
 
Last edited:

Kyuusaku

B. Jenet's Firstmate
Joined
Mar 26, 2003
Posts
419
If you XOR start with the other buttons it will just invert them. Two OR gates and inverter would work but there's still no latching action, unless start was a switch and not a button (then this would all be moot). I forgot that he wants start disabled too... My thing will work with that, but it'd have to be slightly expanded for reenabling it so an 8 pin MCU looks more attractive (3 buttons in, 3 buttons out). I don't get the point in the first place.
 
Last edited:
Top