Sunday, September 22, 2024

Noodling over ideas for how to simulate a 2501 card reader in order to test the controller logic

NORMALLY I APPROACH TIMING EXACT EMULATION USING FPGA

My general approach to emulating machinery that has lots of specific timing with multiple independently operating bits is to use an FPGA as I can guarantee that timing pulses from one part will occur exactly as they should regardless of how many other things I have to emulate for the device. 

However, the effort and time to build and debug the FPGA logic is higher than the effort to whip up some Arduino or Raspberry Pi based device. Since this emulation is going to be used to check out the VCF 1130 controller logic for the 2501 card reader, I need it relatively quickly. However, there is some value in the work as I could mate this to a USB drive reader or even a physical Documation card reader to give an 1130 system a 2501 card reader. 

FIGURED OUT AN APPROACH USING DUAL ARDUINO BOARDS

For simplicity of development and testing, I chose to place the hardware emulation that is timing specific in an Arduino Mega that has nothing else to do, with a second responsible for setting up the card images and managing all the other parts of the 2501 emulation.

The first unit will use the timer interrupts available in the AVR microprocessor on the Arduino. Thus, when the motor is turned on by the controller logic (via signal -motor relay) I start a counter using 250 microsecond timer pops. This is used to generate the three feed 'CB' pulses that tell the controller where the 2501 mechanism is while it rotates. Thus I emit a 2 ms long pulse at 5 ms, at 72.5 ms and again at 93 ms within a 100 ms rotation of the mechanism. These are Feed CB1, Feed CB2 and Feed CB3 signals. 

When the -motor relay signal goes off, the pulses stop by turning off the interrupt handler. This reflects the card reader sitting idly without the motor running until it is needed for a read, feed or NPRO operation 

When a card is being read, there is additional strict timing which I also drive with that 250 us timer. A second counter starts when the controller turns on the -record emitter signal. This records magnetic pulses on a rotating wheel that will generate pulses every 500 us which is the rate at which the punched card moves one column as it moves through the machine at its 600 cpm speed.  

My counter updates twice as fast, which means I can use the odd steps to change the photocell values that represent light passing through or blocked by a hole in the column for each of the 12 rows on a card. On the even step, I fire off a second time for 55 us that is the duration of the emitter pulse. 

The controller logic latches in the rows for which the light is observed at the start of that 55 us pulse and then at the end of the pulse it compares the latched value to the light it is now observing. This is the error checking as if it changes then the emitted pulse is not right in the middle of a card column and we have a read error of some kind. Thus I change the photocells on odd 250 us steps and emit the 55 us pulse only at the start of the even step. 

My timing specific Arduino will not handle the photocell values, however, that will be done by the second Arduino Mega. The first unit simply sends a bit to inform the second Arduino when it has come to an odd step of the column counter. The second Arduino sees those pulses and changes the photocell values. The second box also handles the Start, Stop and NPRO key emulation, the hopper empty detection, the pre-read sensor that informs the controller when the card is in position to begin reading, the Attention error light, the Ready light and other details related to the emulation. 

2 comments:

  1. Hey Carl,

    maybe think about going with a ESP32 with dual core and much much much faster hardware. Still your known Arduino environment but on steroids :)

    Alex

    ReplyDelete
    Replies
    1. Thank you for the suggestion, Alex.

      At this point I am thinking about using a Digilent Cora Z7 which is a SoC with FPGA plus ARM processor running Linux. I have one on hand and I can update this to the longer term objectives such as driving a Documation card reader, but I should be able to whip out the simple version for controller logic testing very quickly.

      Delete