Solenoids
The M6800 implementation of solenoids uses the 120Hz ISR to control the solenoids. They did this for several reasons:
- Time out the duration that solenoids are kept on. According to the Bally Theory of Operation document most solenoids need to be kept on for 3 zero-crossings in order to properly energize the solenoid. In reality, they power some of the solenoids for far longer. For example, saucer kickers need to be energized for at least four cycles (30+ ms), and drop target resets are energized for 120ms. Energizing a drop target reset for less time doesn't guarantee that the targets won't bounce back down.
- Solenoids need to be turned off close the voltage nearing a zero crossing so that the life of the transistors can be maximized.
- Some solenoids (slingshots and pop bumpers, for example) need to be energized as soon as a switch closes so that the response of the machine is quick.
For those reasons, the Arduino implementation controls the solenoids in the 120Hz ISR as well. To reproduce the M6800 timing, I captured several scope waveforms from the M6800.
The way that solenoids are implemented on the MPU-100 and Bally AS-2518-17 uses four lines to engage one of 15 solenoid lines at a time. The sixteenth line (U11B:PB0-PB3 all high) is unused on the solenoid driver board. The solenoids can be prevented from triggering by raising U11:CB2, but I couldn't find any time when that's done. Perhaps I didn't look hard enough. Maybe during a tilt? At any rate, as long as U10:CB2 is low, any combination of signals on U11B:PB0-PB3 will trigger a solenoid, but since this is a 4->16 decoder, only one solenoid at a time can be triggered. An example of that in a moment. First, here are some other solenoid signals so you can have a sense of how they work.
All these solenoid signals shown above pretty much engage the solenoid between the zero crossings and disengage the solenoid right at the zero crossing. Turning them off at a voltage close to zero makes perfect sense - you want to minimize the voltage when you turn off the transistors. I don't know if turning them on when the voltage is high is a requirement. I don't think so, but I haven't found anything to say one way or the other. I believe that these solenoids are turned on between the zero crossings because the switch reads are the last things done in the 120Hz interrupt. That would account for the delay in turning them on. If I'm wrong and you know differently, please let me know.
As mentioned above, the hardware can only energize one solenoid at a time. What happens if you hit the switch on two slingshots at a time? With only one ball in play, it's not likely, but with the glass off I tested it anyway.
To reproduce this behavior, I created a software solenoid stack. If the switches detect a high priority event (like pop bumpers or sling shots), they push solenoid fires to the head of the stack. The game layer pushes things like drop target resets and chimes to the tail of the stack. Because these machines have single ball play, the stack never gets very deep. In order to play melodies on the chimes, I also created a list of timed events that will happen in the future. When those events expire, they push events to the back of the solenoid stack as well. The Arduino pops solenoid events from the stack during the 120Hz ISR and engages the proper lines. This is done at the head of the ISR so the solenoid will be turned off as close to the zero crossing as possible. Here are some solenoid enable/disable waveforms from the Arduino implementation.
I didn't capture back to back solenoid fires, but they switch right at the beginning of the zero crossing signal.