Show Posts
Pages: [1]
1  Community / Exhibition / Gallery / Re: Arduino Mega does early Bally/Stern pinball on: June 14, 2013, 12:07:43 pm
By request I have now posted the source code for the Software Developers Kit at my website (under the Software link):

https://sites.google.com/site/pschimpf99
2  Community / Exhibition / Gallery / Re: Arduino Mega does early Bally/Stern pinball on: February 01, 2013, 03:51:05 pm
Thanks benboogaard.  Students will be using this to reprogram a Bally Mata Hari that I recently restored in my CSCD 496 Embedded Systems class at Eastern Washington University this Spring (April-Jun 2013).
3  Community / Exhibition / Gallery / Arduino Mega does early Bally/Stern pinball on: August 23, 2011, 04:45:21 am
Just finished getting this working yesterday.  This shield interfaces an Arduino Mega to a fairly large class of early solid state Bally and Stern
machines that share a common MPU architecture and cabling to the switch matrices, solenoids, feature lamps, and score displays.  In these machines the score displays and feature lamps are time multiplexed by an interrupt service  routine.  A separate ISR queries and debounces the switches and turns off momentary solenoids that should not remain activate too long.  I've got that all working in a library and have added some additional support like edge event detection on the playfield switches.  Some of the pinballs in this class have sound cards, but it wasn't feasible to interface the Mega to those sound cards because they are designed to tap directly off a 6800 processor bus.  So, I included the capability to play sound effects off SD card files based on a design by Chan, along with an audio amplifier. Why did I do all this when you can buy replacement MPU boards for these pinball machines?  I intend to teach an embedded systems class where the students can write code to control a pinball machine as part of the course.  I could have them write 6800 code for the original Bally/Stern MPUs, but it is impossible to find an In-Circuit Emulator for the 6800 anymore, so I decided to create an shield for the Arduino instead.  This could also be used by pinball hobbyists (like myself) to customize the behavior of a pinball machine.  It's been a fun project and I've learned a lot about both Arduino and Bally pinball architecture in the process.  Pictures attached.  The picture with score displays on is showing a test that cycles through the 2 x 8 cabinet switch matrix, which is separate from the playfield switch matrix.  The player 1 and player 2 displays are cycling thru the switch states in row 1 and 2 of the matrix, respectively.  This was actually my first PCB layout, for which I used Express.  The Express tools aren't the most capable of the free or inexpensive tools out there, but the board production is inexpensive and the learning curve on the tools is negligeable.  Very intuitive.
4  Using Arduino / Programming Questions / Re: Arduino Mega 2560 interrupt numbers vs. schematic? on: August 04, 2011, 03:31:56 pm
My question is answered but I believe I should clarify for other readers.  I have verified that the documented interrupt numbers and pins for Mega DO work with the Arduino attachInterrupt construct.  I also understand how to use interrupts in AVR code directly.  I have used AVR development for a non-Arduino board, but prefer to have my students use the Arduino constructs where possible, and it is possible in this application (yes, I am an educator).  I also understand that further interrupts are disabled by default.  There are indeed fixed interrupt priorities established by Atmega - this is easy to find in the Atmega datasheets.  When does this matter?  It matters when multiple interrupts are pending (either by being in an active state or because event-type interrupts are latched).  The interrupt with the highest priority will be serviced when interrupts are enabled.  It can be important.  Unless you're trying to dynamically enable and disable individual interrupts there is no reason multiple interrupt sources can't be handled with Arduino constructs (with care, of course).  So if anyone else needs to worry about multiple interrupt priorities, the answer is that you need to look at the schematic for your Arduino board and determine which Atmel pin the Arduino pin is tied to - do NOT rely on Arduino pin numbers OR Arduino interrupt numbers.
5  Using Arduino / Programming Questions / Arduino Mega 2560 interrupt numbers vs. schematic? on: August 04, 2011, 01:53:35 pm
This is both a software and hardware question - apologies if it doesn't belong here, but I didn't see a more appropriate forum area.
The Mega 2560 documentation says, for example, that pin2 is interrupt 0, and pin21 interrupt is 2.  Yet the schematic shows pin2 connected to INT4 and pin21 to INT0.  My tests verify that the documented interrupt numbers and pin numbers work with attachInterrupt(), so this isn't a huge deal except that the Atmega interrupt priorities are determined by lowest INT number.  So am I correct in concluding that pin21 is the highest priority (INT0) even though it is neither the lowest nor highest interrupt number in Arduino land?
6  Using Arduino / Programming Questions / Re: sanity check on C++ library and attachInterrupt on: August 04, 2011, 01:41:03 pm
Ah, thanks Paul.  I took the extern "C" off my ISRs and it still works.  That solves the mystery
for me.  Duh, I don't know why I jumped all the way to C linkage instead of just to a global
function when I got the error installing the ISR.  I'm about to post another question about
interrupts, maybe you can answer that one too!  :-)
7  Using Arduino / Programming Questions / sanity check on C++ library and attachInterrupt on: August 04, 2011, 12:42:36 pm
Hoping someone will sanity check an approach I'm using for writing a library. First, I discovered by trial and error (and have seen some similar posts) that using C++ is least troublesome for writing library modules.  I tried doing it in C (.c files) first and got some errors.  So I rewrote the library in C++ and it works seamlessly ...

except for the following little hiccup.  My library needs to install an interrupt service routine using attachInterrupt().  I also discovered, not too surprisingly, that the function pointer passed to attachInterrupt() must use C linkage.   So I used extern "C" for the ISR function and put everything else in a class.  It thus seems I cannot avoid using .cpp files and extern "C" when putting an ISR in a library module.  Seems to me it would make more sense to simply use .c files but that didn't work for me for the regular function calls.

This is a bit confusing, because while .pde code is written in C style, it appears that it uses C++ linkage (why else would I have trouble calling C functions but not C++ member functions?). On the other hand I can put an ISR in a .pde file no problem.  Does the Arduino preprocessor
realize that arguments to attachInterrupt must be C-style and automatically attach extern "C" to their declarations before passing the code onto the gpp compiler, but only if that ISR function appears in a .pde file (iow, it leaves library files untouched)? 
Pages: [1]