+grips03 Posted May 9, 2013 Share Posted May 9, 2013 (edited) You might be better off using getState() instead of introducing a delay of your own. That way its down to the player to hold the key down long enough and not rely on a device with a "magic number" they can't change. GB - exactly what I'm working on now. I've not used this function before, so looking for samples. Any help would be greatly apperciated. Edited May 9, 2013 by grips03 Quote Link to comment Share on other sites More sharing options...
Uzumaki Posted May 9, 2013 Share Posted May 9, 2013 (edited) Yeah that ^^ Else if someone mashes a bunch of buttons you're looking at easy 1+ second total per cycle. Just write it that way so if the key is pressed, write low. Else write high, You could see how I did my Jaguar adapter code: http://atariage.com/...5/#entry2743441 I used truth table found online, and wrote low if key button x, y, or z was pressed. I actually used mine differently. I wrote low on all 8 output pins in the setup, then I toggle the pin as input or output. When it's output mode, it'll pull the line low. When it's input mode, it'd be high Z mode so the line would float as normal and allows original Intellivision controller to be used at the same time. Rather simple design. Without the use of input and output mode toggling, you'd have to disconnect the existing Intellivision controller. Otherwise if you pressed a button on the Intellivision controller, it'd try to pull low while Arduino is trying to pull the same line high, creating a short circuit that most likely will fry a pin or 2 or worse, blow out the chip. If you planned to remove the original controller and rely exclusively on your new controller, you'd be fine. Edited May 9, 2013 by Uzumaki Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted May 9, 2013 Share Posted May 9, 2013 GB - exactly what I'm working on now. I've not used this function before, so looking for samples. Any help would be greatly apperciated. Unfortunately I don't know anything about AVR CPUs or what Arduino libraries are available. I had to look up the library based on the info in your code snippet. I can only help with algorithms and "C" for that micro. Quote Link to comment Share on other sites More sharing options...
+grips03 Posted May 9, 2013 Share Posted May 9, 2013 (edited) Yeah that ^^ Else if someone mashes a bunch of buttons you're looking at easy 1+ second total per cycle. Just write it that way so if the key is pressed, write low. Else write high, You could see how I did my Jaguar adapter code: http://atariage.com/...5/#entry2743441 I used truth table found online, and wrote low if key button x, y, or z was pressed. I actually used mine differently. I wrote low on all 8 output pins in the setup, then I toggle the pin as input or output. When it's output mode, it'll pull the line low. When it's input mode, it'd be high Z mode so the line would float as normal and allows original Intellivision controller to be used at the same time. Rather simple design. Without the use of input and output mode toggling, you'd have to disconnect the existing Intellivision controller. Otherwise if you pressed a button on the Intellivision controller, it'd try to pull low while Arduino is trying to pull the same line high, creating a short circuit that most likely will fry a pin or 2 or worse, blow out the chip. If you planned to remove the original controller and rely exclusively on your new controller, you'd be fine. Also I think game devs can base action on keypad duration, so fixed duraion is not good. I'm kind of bad at programming, but I got the TTL parts to work great for control and buttons. I then used diodes so either the controller/button PCB (or) the Arduino controlled keypad can set pin low. The reverse wired diode makes it so nothing shorts. I'll post diagram of this later. Going to add the else in there now. Edited May 9, 2013 by grips03 Quote Link to comment Share on other sites More sharing options...
+grips03 Posted May 10, 2013 Share Posted May 10, 2013 I think I'm going to use all logic gates, 74HCT4002 will work well for keypad Quote Link to comment Share on other sites More sharing options...
JohnPCAE Posted May 10, 2013 Share Posted May 10, 2013 I got my keypad PCB's today and they look like they'll work well. Here are the Gerber files if anyone wants to give them a try. IntyKB.zip Quote Link to comment Share on other sites More sharing options...
JohnPCAE Posted May 10, 2013 Share Posted May 10, 2013 Here's a pic of the board and the keypads it goes with. The keypads are available here and there on the net for about $6.00. The board doesn't have the corners trimmed, but I deliberately left room so it could be done manually. Quote Link to comment Share on other sites More sharing options...
+grips03 Posted May 10, 2013 Share Posted May 10, 2013 (edited) Here's a pic of the board and the keypads it goes with. The keypads are available here and there on the net for about $6.00. The board doesn't have the corners trimmed, but I deliberately left room so it could be done manually. Do the vias with solder (new outout pins) interfere with the rubber pushbutton? How does the new PCB stick to the back once the original PCB is removed? side note: this is so cool, we have 3 different solutions for new Intv controllers. All passive, like original - JohnPCAE. Arduino adapter for Jaguar (Uzumaki) and the one I'm making (now all TTL ICs). Hopefully no one will be forced to use the old controller if they don't want too Edited May 10, 2013 by grips03 Quote Link to comment Share on other sites More sharing options...
yell0w_lantern Posted May 10, 2013 Share Posted May 10, 2013 Funny, I've been looking at making an arcade-style controller in a project box. Keypad, non-matrixed: http://www.allelectronics.com/make-a-store/item/KP-12/12-BUTTON-KEYPAD/1.html Quote Link to comment Share on other sites More sharing options...
JohnPCAE Posted May 10, 2013 Share Posted May 10, 2013 (edited) Do the vias with solder (new outout pins) interfere with the rubber pushbutton? How does the new PCB stick to the back once the original PCB is removed? side note: this is so cool, we have 3 different solutions for new Intv controllers. All passive, like original - JohnPCAE. Arduino adapter for Jaguar (Uzumaki) and the one I'm making (now all TTL ICs). Hopefully no one will be forced to use the old controller if they don't want too I haven't tried them yet, and we've got a bunch of things going on at the house such that I don't have any room for soldering anything for the time being. I'm a little concerned about some of the wire hookups, but I think the vias will be okay. My gut tells me that, worst-case, a little hole punched in the rubber at certain flat parts will alleviate any clearance issues.. Feel free to upload the files to a place like OSH Park or somewhere else if you feel adventurous I didn't want to force any particular way of mounting the board, but I figure that in a case with standoffs it shouldn't be an issue. If I get around to building a custom controller design, I'll use the case to hold the board and keypad in place much like existing controllers do. Edited May 10, 2013 by JohnPCAE Quote Link to comment Share on other sites More sharing options...
+grips03 Posted May 10, 2013 Share Posted May 10, 2013 I haven't tried them yet, and we've got a bunch of things going on at the house such that I don't have any room for soldering anything for the time being. I'm a little concerned about some of the wire hookups, but I think the vias will be okay. My gut tells me that, worst-case, a little hole punched in the rubber at certain flat parts will alleviate any clearance issues.. Feel free to upload the files to a place like OSH Park or somewhere else if you feel adventurous I got in wife trouble today too I'll post the schematics (logic gates) when I'm done. I had some speed issues with Arduino, it could just be my poor coding, but TTL parts are pretty darn quick. Not as quick as the passive solution you have here though. Eagle files are in progress. I just hope they fit the alotted space. Then if that works out I'll try on Altera CPLD to reduce costs and space. Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted May 10, 2013 Share Posted May 10, 2013 I had some speed issues with Arduino, it could just be my poor coding An 8/16MHz microcontroller should be more than adequate for this task. I looked at the keypad library source code and a key is only reported as held if its pressed for 500ms. That delay is far too long for an arcade controller interface. You can use the setHoldTime function to reduce it to something more reasonable. The de-bounce time is currently set to 10ms as well. That might be a bit excessive but it depends on the chatter characteristic of your switches. Quote Link to comment Share on other sites More sharing options...
+grips03 Posted May 10, 2013 Share Posted May 10, 2013 That would expain what I saw. I would press button rapidly on the keypad and sometimes it would not catch the button press. Quote Link to comment Share on other sites More sharing options...
Uzumaki Posted May 10, 2013 Share Posted May 10, 2013 Try to avoid using delay as it can cause problem like what you're describing. Quote Link to comment Share on other sites More sharing options...
+grips03 Posted May 10, 2013 Share Posted May 10, 2013 (edited) I was no longer using delay. I was using the multikey example in Arduino. This is the one that works on states, i.e. PRESSED, HOLD, RELEASED, and IDLE. I guess I could had put it on the scope. But I figured I like TTL parts more anyway, so going that route. Edited May 10, 2013 by grips03 Quote Link to comment Share on other sites More sharing options...
+grips03 Posted May 13, 2013 Share Posted May 13, 2013 Altera Max 7000S .bdf file is built. Just waiting on USB Blaster and CPLD to arrive. I'm going to map keypad 1 to select button and keypad Enter to start button. Keypad will be present on controller and provide full access to all keys. Quote Link to comment Share on other sites More sharing options...
+grips03 Posted May 15, 2013 Share Posted May 15, 2013 Funny, I've been looking at making an arcade-style controller in a project box. Keypad, non-matrixed: http://www.allelectr...N-KEYPAD/1.html This is the same one I used for Coleco controller. It will also be the same one I'll use for the Intv 2 controller. It fits nicely in the NeoGeo (NeoGeoX) controller after milling. Quote Link to comment Share on other sites More sharing options...
+grips03 Posted May 15, 2013 Share Posted May 15, 2013 I'm about to order $300 in buttons and better joystick internals (bearing, receiving spring, microswitches, balltop) to convert 10 NGX controllers to Intv 2. Please let me know button color, something like below, but with S1, S2, S3 in smoke and button D = S1 and in solid black. Or should we make all buttons black http://www.flickr.com/photos/20625046@N08/8690654763 Quote Link to comment Share on other sites More sharing options...
mdoerty Posted May 15, 2013 Share Posted May 15, 2013 Perhaps they didn't support all the functions. I've made my own Colecovision PCB that works like Super Action Controller with 4 buttons and keypad. Its 100% passive like original, its very different than what I need to do for the Intv. They only replace the standard controllers on the CV. They don't function like the SuperAction Controllers. Quote Link to comment Share on other sites More sharing options...
+grips03 Posted May 17, 2013 Share Posted May 17, 2013 I have Intv 2 controller working with Max V CPLD. 8 directions, buttons 1-3 and 12 button keypad. Logic works exactly like the original controller. I just need to work on the power supply side of things now. Getting closer. Quote Link to comment Share on other sites More sharing options...
+grips03 Posted May 19, 2013 Share Posted May 19, 2013 I was able to move CPLD code from Max V dev board to Max 7000s standalone and program with the USB Blaster. I put on proto board. Two IC looking things are pull up resistors for the inputs. Most likely going to use SIP based ones to save space. Max7000s on proto board http://www.flickr.com/photos/20625046@N08/8751612105/in/photostream controller internals http://www.flickr.com/photos/20625046@N08/8752734952/in/photostream Its powered from the Intv 2 console http://www.flickr.com/photos/20625046@N08/8751612765/in/photostream to do: add JTAG header for ISP add resistor for led out take a time sample, CPLD says it 10 nano seconds. Hopefully I can catch this with my scope measure current draw draw in Eagle order PCBs Quote Link to comment Share on other sites More sharing options...
+grips03 Posted May 19, 2013 Share Posted May 19, 2013 current draw is 35ma with Max 7000S (TQFP 44, led (with 2.5k resistor), and 4.7k pull up resistors on all inputs. Adding JTAP ISP header with resistors should not add much. I'll measure again during ISP once I have the PCB in hand Quote Link to comment Share on other sites More sharing options...
+grips03 Posted May 19, 2013 Share Posted May 19, 2013 (edited) I'm not sure my scope is fast enough. With input on channel 1 and output on channel 2. I press button on scope and controller at the same time. I position ch1 and ch2 down at 10us and the lines look like the same line. There is no lag when playing and I'm thinking the nice folks at Altera would not be making up 10ns latency. If someone else knows how to setup the Rigol DS1102E scope to get a better measurement let me know. Edited May 19, 2013 by grips03 Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted May 19, 2013 Share Posted May 19, 2013 I'm not familiar with that scope but set the trigger on channel 1 to be falling edge and its trigger point to be around 2.5v. Connect channel 1 to a button that is pulled up and channel 2 on an ouput you expect to change. Then when you push that button it contacts ground causing a falling edge (followed by some contact chatter) which the scope will trigger on and then display both channels. 1 Quote Link to comment Share on other sites More sharing options...
+grips03 Posted May 19, 2013 Share Posted May 19, 2013 I'm not familiar with that scope but set the trigger on channel 1 to be falling edge and its trigger point to be around 2.5v. Connect channel 1 to a button that is pulled up and channel 2 on an ouput you expect to change. Then when you push that button it contacts ground causing a falling edge (followed by some contact chatter) which the scope will trigger on and then display both channels. GB- Thanks for the advice. Scope shows 15ns. Here is screen shot. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.