Main > Main Forum
Help converting 49way to 8way.
2600:
You don't want to use a comparator, it would be a pain and I'd have to think.
I couldn't find any IC's on Radio Shacks site, but maybe they have them in the store.
! = not(inverter) gate
+ = and gate
If they don't have those, see if they have a nand gate those will work, too.
Use those to build URebel's "logic statement". You'll need to invert the "logic" afterwards.
rockin_rick:
I drew this up for you, I think it should work, however I don't know exactly how your stick and encoder works... This is untested - perhaps someone could verify this?
Assuming....
--- Quote from: u_rebelscum on January 22, 2007, 03:39:42 pm ---5432 (your pin number)
0000 = up full
0100 = up 2/3
0110 = up 1/3
x111 = center
1011 = down 1/3
1001 = down 2/3
1000 = down full
--- End quote ---
This would be a circuit that has the center and the first 1/3 report as center. U1 is a hex inverter, and U2 is a quad AND. The logic is:
When pin 3 is high (up 1/3, center, and down 1/3), then invert it to low and feed it to both AND gates. This input on the AND acts as an enable high. When pin 3 is high (in the center), the enable is low and neither AND can turn on.
When pin 3 is low, it is inverted to high and acts as an enable for the ANDs. Then the other input of the AND can pass through.
When pin 5 is low, it feeds the low to the "down" AND (U2b). If the enable is on (the stick is not centered), then the low gets passed through. Since pin 5 was low, the output of U2b is low, and the down output is off. This does not turn on Q2 (the down driver). At the same time, the pin 5 low gets inverted to a high through U1b, and fed to U2a. Since U2a is enabled, the high gets passed through. The up AND gate is on and turns on Q1 (the up driver).
Both AND gates feed transistors (through current limiting resistors) configured as open collector buffers. When the output of the AND gate is high, it turns on the transistor and it pulls the collector (connected to the encoder) low. (This is assuming that your encoder pulls the line high to mean off.)
You can also connect other switches (that switch to ground) to the encoder without problems.
To do right and left, you can use the leftover gates in U1 and U2. U1 usually would have 6 inverters in it, and U2 usually has 4.
The resistor should be about 1K to 10K depending on drive current of the AND and sink current required by the encoder (determined by the pullup). EDIT: 12.5K min for 74xx TTL that has a drive current of 0.4mA max
Hope this helps,
Rick
rockin_rick:
I just did some checking into the specs on the drive currents available on 74xx series TTL chips and it seems that they are somewhere about 0.4mA. This would mean that your current limiting resistor driving the transistor would have to be at least 12.5K (@ 5V) otherwise the transistor will draw too much current from the gate and ruin it.
Rick
SirPoonga:
BTW, I am going to do this in stages. First I want to make sure I can switch the 49way to 8way.
Then I need to switch the joystick pins between the arch rivals interface board and the 8way circuit (that will connect to multijamma). Do I need to switch the ground? I could see ground loop being a problem possibly, even though it is just switches. I don;t know how the multijamma does it's switching so I better switch the ground pin also to be safe. 5v doesn't need to be switched since the joys always need power. I will somehow get power maybe, right from the transformer.
The switching should be easy. I have to find out how the multijamma works but lets assume I can find an input for some transistors. I think I would have to have two transistors per each pin, one a NPN and one a PNP. I want it so when there is no input to the base of the transistors that the 49way works normally for arch rivals. That would mean the PNPs would control the 49way interface and the NPNs control the 8way circuit. Or do I have my NPN and PNP backwards? I'll try to draw up the idea sometime.
rockin_rick:
--- Quote from: SirPoonga on January 23, 2007, 05:39:23 pm ---BTW, I am going to do this in stages. First I want to make sure I can switch the 49way to 8way.
Then I need to switch the joystick pins between the arch rivals interface board and the 8way circuit (that will connect to multijamma). Do I need to switch the ground? I could see ground loop being a problem possibly, even though it is just switches. I don;t know how the multijamma does it's switching so I better switch the ground pin also to be safe. 5v doesn't need to be switched since the joys always need power. I will somehow get power maybe, right from the transformer.
The switching should be easy. I have to find out how the multijamma works but lets assume I can find an input for some transistors. I think I would have to have two transistors per each pin, one a NPN and one a PNP. I want it so when there is no input to the base of the transistors that the 49way works normally for arch rivals. That would mean the PNPs would control the 49way interface and the NPNs control the 8way circuit. Or do I have my NPN and PNP backwards? I'll try to draw up the idea sometime.
--- End quote ---
First off, I'd like to clairify my background. I am not an EE, but rather an (extreme?) electronics hobbiest.
I would definitely test the interface to see if you are happy with the conversion. I assumed that the inner ring should be center, as u_rebelscum pointed out, using those makes for very small cardinals and large diagonals. If I was to do this, I would probably use a microcontroller to the conversion and that would also add the ability to add and adjust mapping. I've read before that you do some PIC programming - I do some myself. It would be super easy to us a PIC and not much more money to do the conversion. One PIC could convert 2 joysticks super easily. Use a 40 pin part, such as a PIC16C64 or PIC16F874. Connect one joystick (7bits) to port B, the other to port C. Connect an IC such as the ULN2803 to port D in place of the open collector resistors - low nibble for one joy, high nib for the other joy. The low nibble can be P1 joy up, down, left, and right, while the upper nib is P2 u,d,l,r. Setup a jump table of RETLW's that contain all 128 combinations of the 7 bits (some are invalid and should never be jumped into). The table will have only the lower nibble used. Those 4 bits will be your up, down, left, and right (and ultimately sent to the ULN). The input of the table (jump amount) is determined from the joystick bits. Have the code first read P1 joystick - read the port (the 7bits), mov to W. Call the jump table. Then OR the returned value (which is just the low nib) into a variable that holds the outputs. mov that to port D. (avoid read-modify-write issues). Then read P2 joystick into W. Call table. Swap nibbles upon return. OR into variable that holds the outputs. mov to port D. Repeat.
You could add a switch to a pin or two and easily change between different maps - say tight deadzone, greater deadzone. With your application it's probably not necessary once you've got it dialed in how you want it... But it could be a jumper and pretty cheap and easy to implement...
I checked out the schematic for arch rivals. The joy connects to the interface board, then right to the game board without modification. The joy outputs feed through 10K resistors and then are tied high through 100K resistors, and bypassed with 100pF caps before going to 74HCT244's. I would think that you could just tap off of the joystick data lines to your new circuit as long as both are always powered. It should control both simultaneously without fancy switching as long as your new circuit doesn't load the line too much.
Does the joystick when not connected to anything other than power pull high for 1 and pull low for 0? Or does it just pull low for 0, and float for high (which then is tied high to pull it up)?
I don't know how the multijamma switches.
Even if you didn't go with the µC and used the discrete logic, I'd still use the ULN2803 instead of transistors, esp. since you will need 8... (remember to check the drive current required by the ULN and the amount provided from the logic). Perhaps not as easy to acquire, though...
Rick
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version