tiger_programmable_logic_card
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tiger_programmable_logic_card [2025/02/03 16:47] – [Tiger Programmable Logic Card (TGPLC)] remove link to PDF, very out of date brandon | tiger_programmable_logic_card [2026/03/16 14:03] (current) – re-arranged examples jon | ||
|---|---|---|---|
| Line 15: | Line 15: | ||
| The evaluation cycle is triggered by a clock signal. By default, the evaluation clock comes from an 4kHz source on the PLC. It is also possible for the clock to be provided by another Tiger card for synchronization purposes, e.g. for diSPIM the micro-mirror card is the source of the signals being output by the PLC (e.g. camera triggers) so the micro-mirror is the master and its 4kHz clock is used to trigger PLC evaluations. Finally, the user can provide a clock on the first BNC input. | The evaluation cycle is triggered by a clock signal. By default, the evaluation clock comes from an 4kHz source on the PLC. It is also possible for the clock to be provided by another Tiger card for synchronization purposes, e.g. for diSPIM the micro-mirror card is the source of the signals being output by the PLC (e.g. camera triggers) so the micro-mirror is the master and its 4kHz clock is used to trigger PLC evaluations. Finally, the user can provide a clock on the first BNC input. | ||
| Note that there is an delay of one evaluation cycle because the outputs are updated at the start of the evaluation cycle; this is an intentional design choice so that the output timing is deterministic. Thus, an input signal with arbitrary phase relative to the evaluation clock is output with a delay between 1 and 2 times the period of the evaluation cycle clock. | Note that there is an delay of one evaluation cycle because the outputs are updated at the start of the evaluation cycle; this is an intentional design choice so that the output timing is deterministic. Thus, an input signal with arbitrary phase relative to the evaluation clock is output with a delay between 1 and 2 times the period of the evaluation cycle clock. | ||
| + | |||
| + | |||
| + | ===== Addresses | ||
| + | |||
| + | Fundamental to understanding PLC operation is that each cell and I/O has a specific address. | ||
| + | |||
| + | * Address 0 has the meaning of "logic low" and address 64 has the meaning of "logic high". | ||
| + | * Addresses 1-16 are the programmable logic cells. | ||
| + | * Addresses 33-40 are for the front panel connectors, address 33 for the first connector and so forth. | ||
| + | * Addresses 41-48 are for the backpanel signals, address 41 for the TTL0 signal and so forth. | ||
| + | |||
| + | In order to take the boolean inverse (NOT) of a signal simple simply add 64 to the address. | ||
| + | |||
| + | Add 128 to the address in order to obtain a " | ||
| + | |||
| + | Add 64+128 = 192 to the address in order to obtain a " | ||
| + | |||
| + | Thus there are exactly 256 valid addresses. | ||
| + | |||
| + | ==== Address code reference table ==== | ||
| + | |||
| + | ^ Address ^ Meaning ^ Type ^ | ||
| + | |0 |always 0/low |constant | | ||
| + | |1-16 |logic cell 1-16 |logic cell | | ||
| + | |17-32 |reserved for future use |(expanded cell array) | | ||
| + | |33-40 |front panel connectors 1-8 |physical I/O | | ||
| + | |41-48 |Tiger backplane TTL 0-7 |physical I/O | | ||
| + | |49-63 |reserved for future use |(expanded I/O) | | ||
| + | |64-127 |0-63 with inversion | | | ||
| + | |128-191 |rising edge on 0-63 | | | ||
| + | |192-255 |falling edge on 0-63 | | | ||
| ===== Programming ===== | ===== Programming ===== | ||
| Line 62: | Line 93: | ||
| | counter timer (non-retriggerable) | | counter timer (non-retriggerable) | ||
| - | === Address codes (used with '' | ||
| - | |||
| - | ^ Address ^ Meaning ^ Type ^ | ||
| - | |0 |always 0/low |constant | | ||
| - | |1-16 |logic cell 1-16 |logic cell | | ||
| - | |17-32 |reserved for future use |(expanded cell array) | | ||
| - | |33-40 |front panel connectors 1-8 |physical I/O | | ||
| - | |41-48 |Tiger backplane TTL 0-7 |physical I/O | | ||
| - | |49-63 |reserved for future use |(expanded I/O) | | ||
| - | |64-127 |0-63 with inversion | | | ||
| - | |128-191 |rising edge on 0-63 | | | ||
| - | |192-255 |falling edge on 0-63 | | | ||
| === Logic Gates === | === Logic Gates === | ||
| Line 281: | Line 300: | ||
| * card trigger source | * card trigger source | ||
| - | ===== Example Logic ===== | + | ===== Example Logic and Scripts |
| ==== Toggle ==== | ==== Toggle ==== | ||
| Line 566: | Line 585: | ||
| ==== Output the stage sync signal ==== | ==== Output the stage sync signal ==== | ||
| - | For stage scanning there is an internal signal generated when the stage is scanning, and commonly the rising edge can be used to trigger other logic (e.g. camera that is free-running during the stage scan). | + | For stage scanning there is an internal signal generated when the stage is scanning, and commonly the rising edge can be used to trigger other logic (e.g. camera that is free-running during the stage scan). |
| --> Script: Stage sync signal on BNC#3 | --> Script: Stage sync signal on BNC#3 | ||
| Line 590: | Line 609: | ||
| </ | </ | ||
| <-- | <-- | ||
| - | ==== diSPIM 2 laser control ==== | ||
| - | Say we want to use two lasers with diSPIM where the laser color is changed on alternate volumes. The micro-mirror drive card of the Tiger outputs are a single laser trigger and a TTL side indicator. For two lasers where the laser is toggled ever volume, we to route the laser trigger to one laser for the first volume and the second laser on the next volume. This is accomplished by using a toggle flop (1-bit counter) that is toggled after every volume. This requires 3 logic cells, arranged as shown here. The BNC connectors on the front of the PLC provide the required additional physical connectors. | ||
| - | If instead we want to toggle the laser every slice, the logic is almost identical except that the toggle counter is connected | + | ==== Conditional Synchronized Output Pulse ==== |
| + | |||
| + | One customer wanted | ||
| + | --> Script: output timed pulse synchronized | ||
| + | |||
| + | <code java inoutsync.bsh> | ||
| + | // output a timed pulse coincident with rising edge of input#1 if and only if input#2 has seen a rising edge since the last pulse | ||
| + | // use to synchronize the output with input#1 | ||
| + | // currently set to output BNC#3 with input#1 of BNC#1 and input#2 of backplane TTL1 | ||
| + | // example use case: fire laser (output) when the camera | ||
| + | |||
| + | // variables to be edited by user | ||
| + | outputDurationInMs = 25; // can be no more than 16.3 seconds with normal 4kHz clock | ||
| + | int addrOutput = 35; // 35 corresponds to BNC#3, change if want different output | ||
| + | int addrInput1 = 33; // 33 corresponds to BNC#1, change if want different input | ||
| + | int addrInput2 = 42; // 42 corresponds to TTL1 on backplane = laser shutter signal | ||
| + | |||
| + | // variables that should not need to be edited by user | ||
| + | // would like to define these variables as final, but this is | ||
| + | // not amenable to script which can run multiple times | ||
| + | String plcName = " | ||
| + | String propPosition = " | ||
| + | String propCellType = " | ||
| + | String propCellConfig = " | ||
| + | String propCellInput1 = " | ||
| + | String propCellInput2 = " | ||
| + | String propCellInput3 = " | ||
| + | String propUpdates = " | ||
| + | String valNo = " | ||
| + | String valDFlop = "1 - D flop"; | ||
| + | String valAND2 = "5 - 2-input AND"; | ||
| + | String valOneShot = "14 - one shot (NRT)"; | ||
| + | String valIOInput = "0 - input"; | ||
| + | String valIOPushPull = "2 - output (push-pull)"; | ||
| + | int ticsPerMs = 4; | ||
| + | int addrInvert= 64; | ||
| + | int addrEdge = 128; | ||
| + | int addrInput2Capture = 1; | ||
| + | int addrBothInputs = 2; | ||
| + | int addrOneShotCell = 3; | ||
| + | |||
| + | |||
| + | // figure out the high period in terms of PLC " | ||
| + | int outputDurationTics = (int) (outputDurationInMs*ticsPerMs + 0.5); | ||
| + | |||
| + | // turn off updates to speed communication | ||
| + | String valUpdatesOriginal = mmc.getProperty(plcName, | ||
| + | mmc.setProperty(plcName, | ||
| + | |||
| + | // use D-flops to latch rising edges of two inputs | ||
| + | // (reset once output pulse starts) | ||
| + | mmc.setProperty(plcName, | ||
| + | mmc.setProperty(plcName, | ||
| + | mmc.setProperty(plcName, | ||
| + | mmc.setProperty(plcName, | ||
| + | mmc.setProperty(plcName, | ||
| + | |||
| + | // use AND to combine edge of input#1 with latched signal from input#2 | ||
| + | mmc.setProperty(plcName, | ||
| + | mmc.setProperty(plcName, | ||
| + | mmc.setProperty(plcName, | ||
| + | mmc.setProperty(plcName, | ||
| + | |||
| + | // use non-retriggerable one-shot to output pulse | ||
| + | mmc.setProperty(plcName, | ||
| + | mmc.setProperty(plcName, | ||
| + | mmc.setProperty(plcName, | ||
| + | mmc.setProperty(plcName, | ||
| + | mmc.setProperty(plcName, | ||
| + | |||
| + | // make sure inputs are set as inputs | ||
| + | mmc.setProperty(plcName, | ||
| + | mmc.setProperty(plcName, | ||
| + | mmc.setProperty(plcName, | ||
| + | mmc.setProperty(plcName, | ||
| + | |||
| + | // connect one shot to output and set as output | ||
| + | mmc.setProperty(plcName, | ||
| + | mmc.setProperty(plcName, | ||
| + | mmc.setProperty(plcName, | ||
| + | |||
| + | // restore updates | ||
| + | mmc.setProperty(plcName, | ||
| + | </ | ||
| + | <-- | ||
| + | ==== Blinking outputs for testing ==== | ||
| + | |||
| + | To check functionality of the outputs and receipt of the input trigger signal it is convenient to set the 8 outputs corresponding to a digital | ||
| + | |||
| + | '' | ||
| + | |||
| + | '' | ||
| + | |||
| + | |||
| + | ==== Print internal configuration ==== | ||
| + | |||
| + | The script below outputs the internal configuration of the PLC | ||
| + | |||
| + | --> Script: print internal configuration# | ||
| + | <code java printconfig.bsh> | ||
| + | // print out to the terminal the internal configuration of the PLC | ||
| + | String plcName = " | ||
| + | String propPosition = " | ||
| + | String propCellType = " | ||
| + | String propCellConfig = " | ||
| + | String propCellInput1 = " | ||
| + | String propCellInput2 = " | ||
| + | String propCellInput3 = " | ||
| + | String propCellInput4 = " | ||
| + | |||
| + | for (int cellNr=1; cellNr< | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | } | ||
| + | |||
| + | for (int ioNr=1; ioNr< | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | } | ||
| + | </ | ||
| + | <-- | ||
| - | {{ : | ||
| - | ==== Micro-Manager ASIdiSPIM plugin ==== | + | ===== Micro-Manager ASIdiSPIM plugin |
| The Micro-Manager ASIdiSPIM plugin uses the PLC for outputting the camera and laser triggers. | The Micro-Manager ASIdiSPIM plugin uses the PLC for outputting the camera and laser triggers. | ||
| Line 925: | Line 1069: | ||
| <-- | <-- | ||
| - | ==== Constant-value Output | + | ==== diSPIM 2 laser control |
| - | One customer wanted | + | Say we want to use two lasers with diSPIM where the laser color is changed on alternate volumes. The micro-mirror drive card of the Tiger outputs are a single laser trigger and a TTL side indicator. For two lasers where the laser is toggled ever volume, we to route the laser trigger to one laser for the first volume and the second laser on the next volume. This is accomplished by using a toggle flop (1-bit counter) that is toggled after every volume. This requires 3 logic cells, arranged as shown here. The BNC connectors on the front of the PLC provide the required additional physical connectors. |
| - | --> Script: output 3 always high # | + | If instead we want to toggle the laser every slice, the logic is almost identical except that the toggle counter is connected to the laser trigger. |
| - | <code java output3high.bsh> | + | |
| - | // variables that should not need to be edited by user | + | |
| - | // would like to define these variables as final, but this is | + | |
| - | // not amenable | + | |
| - | String plcName = " | + | |
| - | String propPosition = " | + | |
| - | String propCellConfig = " | + | |
| - | String propSaveSettings = " | + | |
| - | String valSaveSettings = "Z - save settings to card (partial)"; | + | |
| - | int addrOutput3 = 35; | + | |
| - | int addrHigh= 64; | + | |
| - | int addrLow = 0; | + | |
| + | {{ : | ||
| - | // output #3 assigned to be always high | ||
| - | mmc.setProperty(plcName, | ||
| - | mmc.setProperty(plcName, | ||
| - | // | ||
| - | // save settings | + | ==== diSPIM separate lasers for two sides ==== |
| - | mmc.setProperty(plcName, | + | |
| - | </ | + | |
| - | <-- | + | |
| + | A long time ago diSPIM had capability of triggering 2 separate lasers for the two sides, but we moved to a scheme where there was a single signal for triggering a laser, another one for the laser side select switch hardware, and we added a software-set shutter signal using cell 8. However there are still occasional cases that would have a separate laser separate (single-channel) laser for the 2 sides. | ||
| - | ==== Conditional Synchronized Output Pulse ==== | + | Cell 10 internally is the "laser enable" |
| - | One customer wanted to trigger a laser for a set time synchronized to the camera trigger signal, but only if a condition had been met (specifically a trigger on the controller backplane indicating the laser should be fired). | + | --> Script: |
| - | --> Script: | + | <code java Laser_TwoSided_BNC67.bsh> |
| - | <code java inoutsync.bsh> | + | // BNC6 is PathA laser on and BNC7 is PathB laser on |
| - | // output a timed pulse coincident with rising edge of input#1 if and only if input#2 has seen a rising edge since the last pulse | + | |
| - | // use to synchronize the output with input#1 | + | |
| - | // currently set to output BNC#3 with input#1 of BNC#1 and input#2 of backplane TTL1 | + | |
| - | // example use case: fire laser (output) when the camera trigger is just starting (input#1) if we are ready for it (input#2) | + | |
| - | + | ||
| - | // variables to be edited by user | + | |
| - | outputDurationInMs = 25; // can be no more than 16.3 seconds with normal 4kHz clock | + | |
| - | int addrOutput = 35; // 35 corresponds to BNC#3, change if want different output | + | |
| - | int addrInput1 = 33; // 33 corresponds to BNC#1, change if want different input | + | |
| - | int addrInput2 = 42; // 42 corresponds to TTL1 on backplane = laser shutter signal | + | |
| // variables that should not need to be edited by user | // variables that should not need to be edited by user | ||
| Line 981: | Line 1098: | ||
| String propCellInput1 = " | String propCellInput1 = " | ||
| String propCellInput2 = " | String propCellInput2 = " | ||
| - | String | + | String |
| - | String propUpdates = " | + | |
| - | String valNo = " | + | |
| - | String valDFlop = "1 - D flop"; | + | |
| String valAND2 = "5 - 2-input AND"; | String valAND2 = "5 - 2-input AND"; | ||
| - | String | + | String |
| - | String valIOInput | + | int addrOutputBNC6 |
| - | String valIOPushPull = "2 - output (push-pull)" | + | int addrOutputBNC7 |
| - | int ticsPerMs | + | int addrLaserEnableCell |
| - | int addrInvert= 64; | + | int addrLaserSide |
| - | int addrEdge | + | int addrPathACell |
| - | int addrInput2Capture | + | int addrPathBCell |
| - | int addrBothInputs | + | int addrInvert |
| - | int addrOneShotCell | + | |
| - | // figure out the high period in terms of PLC "tics" | + | // create cells re-using existing "laser enable" |
| - | int outputDurationTics = (int) (outputDurationInMs*ticsPerMs + 0.5); | + | mmc.setProperty(plcName, |
| - | + | mmc.setProperty(plcName, | |
| - | // turn off updates to speed communication | + | mmc.setProperty(plcName, |
| - | String valUpdatesOriginal = mmc.getProperty(plcName, | + | mmc.setProperty(plcName, |
| - | mmc.setProperty(plcName, | + | mmc.setProperty(plcName, |
| - | + | ||
| - | // use D-flops to latch rising edges of two inputs | + | |
| - | // (reset once output pulse starts) | + | |
| - | mmc.setProperty(plcName, | + | |
| - | mmc.setProperty(plcName, | + | |
| - | mmc.setProperty(plcName, | + | |
| - | mmc.setProperty(plcName, | + | |
| - | mmc.setProperty(plcName, | + | |
| - | + | ||
| - | // use AND to combine edge of input#1 with latched signal from input#2 | + | |
| - | mmc.setProperty(plcName, | + | |
| mmc.setProperty(plcName, | mmc.setProperty(plcName, | ||
| - | mmc.setProperty(plcName, | + | mmc.setProperty(plcName, |
| - | mmc.setProperty(plcName, | + | mmc.setProperty(plcName, |
| - | // use non-retriggerable one-shot | + | // connect cells to BNC output |
| - | mmc.setProperty(plcName, | + | mmc.setProperty(plcName, |
| - | mmc.setProperty(plcName, | + | mmc.setProperty(plcName, |
| - | mmc.setProperty(plcName, | + | mmc.setProperty(plcName, |
| - | mmc.setProperty(plcName, | + | mmc.setProperty(plcName, |
| - | mmc.setProperty(plcName, | + | |
| - | // make sure inputs are set as inputs | + | // save settings |
| - | mmc.setProperty(plcName, | + | mmc.setProperty(plcName, |
| - | mmc.setProperty(plcName, | + | |
| - | mmc.setProperty(plcName, | + | |
| - | mmc.setProperty(plcName, | + | |
| - | // connect one shot to output and set as output | ||
| - | mmc.setProperty(plcName, | ||
| - | mmc.setProperty(plcName, | ||
| - | mmc.setProperty(plcName, | ||
| - | |||
| - | // restore updates | ||
| - | mmc.setProperty(plcName, | ||
| </ | </ | ||
| <-- | <-- | ||
| - | ==== Blinking outputs for testing ==== | ||
| - | To check functionality of the outputs and receipt of the input trigger signal it is convenient to set the 8 outputs corresponding to a digital counter which is advanced every evaluation cycle. | ||
| - | '' | + | ==== Constant-value Output ==== |
| - | '' | + | One customer wanted |
| - | + | --> Script: | |
| - | ==== Print internal configuration ==== | + | <code java output3high.bsh> |
| - | + | // variables that should not need to be edited by user | |
| - | The script below outputs the internal configuration of the PLC | + | // would like to define these variables as final, but this is |
| - | + | // not amenable to script which can run multiple times | |
| - | --> Script: | + | |
| - | <code java printconfig.bsh> | + | |
| - | // print out to the terminal the internal configuration of the PLC | + | |
| String plcName = " | String plcName = " | ||
| String propPosition = " | String propPosition = " | ||
| - | String propCellType = " | ||
| String propCellConfig = " | String propCellConfig = " | ||
| - | String | + | String |
| - | String | + | String |
| - | String propCellInput3 | + | int addrOutput3 |
| - | String propCellInput4 | + | int addrHigh= 64; |
| + | int addrLow = 0; | ||
| - | for (int cellNr=1; cellNr< | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | } | ||
| - | for (int ioNr=1; ioNr< | + | // output #3 assigned to be always high |
| - | | + | mmc.setProperty(plcName, |
| - | print("I/O " + ioNr + ":" | + | mmc.setProperty(plcName, propCellConfig, |
| - | | + | //mmc.setProperty(plcName, |
| - | | + | |
| - | } | + | // save settings |
| + | mmc.setProperty(plcName, | ||
| </ | </ | ||
| <-- | <-- | ||
| Line 1100: | Line 1177: | ||
| The standard TG-1000 backplane is configured as follows for diSPIM: | The standard TG-1000 backplane is configured as follows for diSPIM: | ||
| - | ^ PLC Address ^ Signal6 ^ diSPIM use ^ | + | ^ PLC Address |
| - | |41|TTL0|Camera Path A| | + | | 41 |
| - | |42|TTL1|Laser 0 (laser trigger)| | + | | 42 |
| - | |43|TTL2|Camera Path B| | + | | 43 |
| - | |44|TTL3|Laser 1 (laser side)| | + | | 44 |
| - | |45|TTL4|Piezo Path A| | + | | 45 |
| - | |46|TTL5|Trigger | + | | 46 |
| - | |47|TTL6|Piezo Path B| | + | | 47 |
| - | |48|TTL7|Reserved| | + | | 48 |
| Laser 0 and Laser 1 outputs behave according to a firmware setting ('' | Laser 0 and Laser 1 outputs behave according to a firmware setting ('' | ||
Address: 29391 W Enid Rd. Eugene, OR 97402, USA | Phone: +1 (541) 461-8181
tiger_programmable_logic_card.1738619241.txt.gz · Last modified: by brandon
