Three more hours down the drain last night. At least I narrowed the problem down, but it is flaky hence unpredictable and defying a strict logical course of action. First tried simple test code on the Picaxe. Verified that the interrupt and data lines when high were being correctly read. They were.
Then added an interrupt routine without serin. Triggered 100%. But if I added the serin, it hung in the serin.
However, at one point I pushed down on the 3-pin connectors on the breadboards that joined the stamp and Picaxe pins together. Magically, serin appeared to be working based on LED flashes. I then thought that the connectors were the problem. They have the straight leads, which aren’t very long and probably not great on the breadboard. I made up my own 3-wire connector to replace the one used from the Fisher VCR. And I used the connectors with longer pins (90 degree angle bent straight).
Serin never worked again. CRAP!
I tried changing the Picaxe pin used and I changed the stamp pin used. I eliminated the connector all together and just ran 3 solid core wires point-to-point. I dropped the baud rate down to 1200, and ran the Picaxe at 4mhz. Nothing helped.
At 8mhz I tried using the calibfreq command in case the resonator was off. Tried values from –2 to 4 but no good. At –2 one data byte seemed corrupted in the debug display so I stopped trying.
So, we know for sure that the interrupt routine triggers nicely 100% of the time. We see that the voltages all look good, and the some signals are going across the data line. We saw evidence that the data was received correctly after jiggling the lines (but only briefly).
I also tied the data line on the input to ground via 10K resistor.
No responses to Harry’s questions on the Picaxe group. Have rewritten the Picaxe code for my spare BS2 and will install that tonite. I bought 5 used BS2’s on ebay yesterday at a good price. I will use them in place of the Picaxe’s in the future.
The relay board with the Picaxe installed. Later replaced with BS2.
The relay connector board with TIP102 transistors. Fried one the first time I plugged in
due to mistakes.
Success finally last night! Gave up on the Picaxe and rewrote the relay controller code for my spare BS2. Took about an hour. The code looked cleaner and would probably run faster too. Changed a couple of lines of code for the master controller to reflect the different serial attachment. Instead of the Picaxe interrupt line we have the CTS/RTS line.
Took about an hour to wire the BS2 in place of the Picaxe. Fired it up and it worked perfectly first time. Started out at 2400 baud then increased to 4800 then 9600 without problems. Did not try 19200.
Hooked everything up to the Solar Ride playfield and the coils fired fine. Added a few lines of Java code to the game logic to fire the coils. First tested in the console – worked great.
Started the game, the ball kicked out of the outhole and I played pinball. Had some hiccups subsequently but I guess they can be worked out. At times the controlled lamps were off. I suspect the Picaxe lamp controller was hung on a serin (HA! Where have we seen that before?).
I still have some stuff to work out, but essentially the game played fine. Corrected a Java bug with the drop target state – was setting a boolean to true instead of false.
The only bad thing happening was that sometimes when the ball went into the left kickout, multiple switch closures would be read and stacked up in the queue. The result being that the left kickout would keep firing until the queue emptied.
I am not sure if this is a case of a physically stuck switch or perhaps a problem with the switch controller. I will check out the switch. At any rate I should be able to add logic to the Java code to say, if the ball is not in the kickout hole, then ignore the switch closure event.
There are many other type of safety checks that the software needs, e.g. ensuring the ball is in the outhole when the game starts, protection against faulty outhole kicker, stuck switches, etc.
But overall I am immensely relieved to have achieved the original goal: control the lamps, switches and coils on a game.
Still a lot of Java framework code to write (timers and events, queues and threads, more console commands and script processing, software playback of game events, display manager, etc.).
Started dumping project details to the Pinnovations web site.
Full test with relay board (BS2-based).
It works! it works! Take a picture Harry before it breaks again ...
Last updated: September 26, 2008