William Killian wrote: >I've inherited a board developed by an outside contractor that uses a >PIC16F874. I've lots of time on other processors but this is the first >I've really dealt with a PIC up close and personally. > > > Its a good part, but the F876A is better, 'cause its easy to debug. > > >BUT some times the game is happily chugging along and the reel >controller apparently loses its mind. It decides there was a failure >and the reels get sent to home positions (the going home action is a >slower spin so we know it is a sent home problem not a bad decision >about where to send them) but for some reason the reels all go to step 0 >with is 4 steps off of the stop for top prize. Not good for a slot >machine to fail and display what looks like a big win. Not good to the >tune of some half a million in payouts a year. > > > My experience with PICs is that they are remarkably rugged, and getting messed up means something is externally causing it. >Okay amusing story done, does anyone know under what conditions a PIC >might have trouble reading the internal EEPROM? Design decisions in >making the board were some I would not have made and the programming >style is not one I would have used but I see no failure mode in the code >that would lead to this. > > My problems with the EEPROM section are just occasional dropped bits. Having a whole byte or two be changed to 00 sounds like an unintended overwrite of the EEPROM itself. My guess is that somehow the PIC is losing its way and overwriting its own data, probably through external stimulation, such as electrical noise from reel motors, lighting in the slot machine, etc. What I suggest you do first is to extend the PCB so that PCB is far away (6'+) from the slot machine itself, wrapped in a grounded faraday shield. Perform some trials and if possible, record the results, and see if the problem clears up. My bet is that it will clear up. The inverse part of that test is to extend the PCB like before... except this time, you will generate a source of electrical noise and impose it on the reel controller PCB. You can rent an RF noisemaker from the rental companies, or you can build your own for about $25 that will last 30 years (mine has). I think every engineer needs one of these. {{{ I made mine from a 24VAC bell transformer and a 24VAC SPST relay. Simply make a "buzzer" out of the relay by powering the relay through its NC and C contacts. For convenience, I extended the leads from the transformer about 15', and put the relay in a plastic box. Do not twist the wires to the box with relay inside, simply tape them together. }}} Simply lay the plastic box and about 2' of its wiring on top of the PCB. As soon as you start "buzzing" you will probably get scrambled operation. To fix the problem, you will need to repetitively apply tiny caps (100pF or less) to each PIC pin on a trial basis until you locate the pin that is suseptible to external noise. Note that you MIGHT discover another chip on the same PCB is sensitive to the external noise. Another way is to tack 22pF caps to all free input pins, notice that it is fixed, then remove the caps until it becomes bad again. The problem may simply be that more bypassing is needed. > > >The original contractor told me that a colleague told him that there was >a known problem with the PIC16F87x and EEPROM that was fixed in the >PIC16F87xA but I've not seen that anywhere else so far. Anyone else >know something like that? White wiring an RC network to the board to >let us use the A part (a change to MCLR/Vpp) is fine but changing >thousands of board on the chance it might fix something is a tad >expensive. If it saves a half mill a year it is a great investment >though. > > > I wasn't aware of that.EEPROM complaint. --Bob -- Note: To protect our network, attachments must be sent to attach@engineer.cotse.net . 1-520-850-1673 USA/Canada http://beam.to/azengineer -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist