User Tools

Site Tools


tiger_programmable_logic_card

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tiger_programmable_logic_card [2019/05/13 19:50] – [Clock] jontiger_programmable_logic_card [2019/06/20 08:20] – added presets 37-47 jon
Line 139: Line 139:
 The list of presets available is shown in the table below. Additional presets can be easily added upon request. BNC outputs are push-pull unless otherwise specified.  The list of presets available is shown in the table below. Additional presets can be easily added upon request. BNC outputs are push-pull unless otherwise specified. 
  
-^ Preset  ^ Description                                                              ^ Cells         ^ BNC Outputs  ^ Firmware                                                                     ^ Usage / Notes                                                          ^+^ Preset  ^ Description                                                  ^ Cells         ^ BNC Outputs  ^ Firmware                                                                     ^ Usage / Notes                                                          ^
 | 0       | All cells set to constant 0                                              | 1-16          | -            | 3.00+                                                                        |                                                                        | | 0       | All cells set to constant 0                                              | 1-16          | -            | 3.00+                                                                        |                                                                        |
 | 1       | Simulate original SPIM TTL card                                          | -             | BNC1-4       | 3.00+                                                                        |                                                                        | | 1       | Simulate original SPIM TTL card                                          | -             | BNC1-4       | 3.00+                                                                        |                                                                        |
Line 177: Line 177:
 | 35      | BNC3 source from cell 11                                                 | -             | BNC3         | 3.23+                                                                        | output clock on BNC3                                                   | | 35      | BNC3 source from cell 11                                                 | -             | BNC3         | 3.23+                                                                        | output clock on BNC3                                                   |
 | 36      | cell 10 set to reflect cell 8                                            | 10            | -            | 3.27+                                                                        | use shutter logic without micro-mirror TTL1 signal                     | | 36      | cell 10 set to reflect cell 8                                            | 10            | -            | 3.27+                                                                        | use shutter logic without micro-mirror TTL1 signal                     |
 +| 37      | BNC1 selected, turned on by cell 10                                      | -             | BNC1-7       | 3.29+                                                                        | 7 channel laser: laser #1 selected                                     |
 +| 38      | BNC2 selected, turned on by cell 10                                      | -             | BNC1-7       | 3.29+                                                                        | 7 channel laser: laser #2 selected                                     |
 +| 39      | BNC3 selected, turned on by cell 10                                      | -             | BNC1-7       | 3.29+                                                                        | 7 channel laser: laser #3 selected                                     |
 +| 40      | BNC4 selected, turned on by cell 10                                      | -             | BNC1-7       | 3.29+                                                                        | 7 channel laser: laser #4 selected                                     |
 +| 41      | BNC5 selected, turned on by cell 10                                      | -             | BNC1-7       | 3.29+                                                                        | 7 channel laser: laser #5 selected                                     |
 +| 42      | BNC6 selected, turned on by cell 10                                      | -             | BNC1-7       | 3.29+                                                                        | 7 channel laser: laser #6 selected                                     |
 +| 43      | BNC7 selected, turned on by cell 10                                      | -             | BNC1-7       | 3.29+                                                                        | 7 channel laser: laser #7 selected                                     |
 +| 44      | BNC2 and BNC4 selected, turned on by cell 10                             | -             | BNC1-7       | 3.29+                                                                        | 7 channel laser: lasers #2 and #4 selected                             |
 +| 45      | BNC3 and BNC5 selected, turned on by cell 10                             | -             | BNC1-7       | 3.29+                                                                        | 7 channel laser: lasers #3 and #5 selected                             |
 +| 46      | BNC4 and BNC6 selected, turned on by cell 10                             | -             | BNC1-7       | 3.29+                                                                        | 7 channel laser: lasers #4 and #6 selected                             |
 +| 47      | BNC2 and BNC4 and BNC6 selected, turned on by cell 10                    | -             | BNC1-7       | 3.29+                                                                        | 7 channel laser: lasers #2 and #4 and #6 selected                      |
 ==== Accessing outputs over serial ==== ==== Accessing outputs over serial ====
  
Line 232: Line 243:
 ==== Clock ==== ==== Clock ====
  
-To create a free-running clock with user-selectable period and duty cycle you can combine two non-retriggerable one-shot cells.  The first cell's trigger is connected to logic high, but because it is non-retriggerable it will simply trigger itself whenever it has, thus outputting a pulse once per delay period.  That pulse triggers a second one-shot which generates the clock output whose duration sets the time the output signal is high (i.e. the duty cycle is the ratio of the one-shot duration with the delay period).+To create a free-running clock with user-selectable period and duty cycle you can combine two non-retriggerable one-shot cells.  The first cell's trigger is connected to logic high, but because it is non-retriggerable it will simply trigger itself whenever it has, thus outputting a pulse once per delay period.  That pulse triggers a second one-shot which generates the clock output whose duration sets the time the output signal is high (i.e. the duty cycle is the ratio of the one-shot duration with the delay period).  From the 4kHz internal clock it is possible to generate up to 2kHz clock by this means.
  
---> Script: clock signal on BNC1 output #+--> Script: clock signal on BNC3 output #
 <code java> <code java>
 // generate a clock signal based on the internal 4kHz clock, e.g. for triggering a camera // generate a clock signal based on the internal 4kHz clock, e.g. for triggering a camera
-// currently hard-codes using cells 1 and 2 and BNC output #1+// currently hard-codes using cells 1 and 2 and BNC output #3
  
 // variables to be edited by user // variables to be edited by user
-double clockFrequencyHz = 100.0;  // clock frequency in Hertz+double clockFrequencyHz = 100;  // clock frequency in Hertz
 double clockDutyCycle = 0.5;     // should be between 0 and 1 exclusive double clockDutyCycle = 0.5;     // should be between 0 and 1 exclusive
  
Line 258: Line 269:
 int addrEdge = 128; int addrEdge = 128;
 double ticsPerSecond = 4000.0; double ticsPerSecond = 4000.0;
-int addrOutputBNC1 33+int addrOutputBNC3 35
-int addrOneShotClk = 1; +int addrDelayNRT = 1; 
-int addrOneShotOut = 2;+int addrOneShot = 2;
  
 // figure out the cycle period and high period in terms of PLC "tics" (4kHz) // figure out the cycle period and high period in terms of PLC "tics" (4kHz)
-int clockPeriodTics = (int) (ticsPerSecond/clockFrequencyHz + 0.5) - 1; +int clockPeriodTics = (int) (ticsPerSecond/clockFrequencyHz + 0.5)
-int clockHighTics = (int) (clockPeriodTics * clockDutyCycle) + 1;+print("have " + (clockPeriodTics-1) + " (+1) tics in one-shot for actual frequency of " + ticsPerSecond/(clockPeriodTics))
 +int clockHighTics = (int) (clockPeriodTics * clockDutyCycle);
  
 // turn off updates to speed communication // turn off updates to speed communication
Line 270: Line 282:
 mmc.setProperty(plcName, propUpdates, valNo); mmc.setProperty(plcName, propUpdates, valNo);
  
-// do programming of one-shot cells +// do programming of one-shot and delay cells 
-mmc.setProperty(plcName, propPosition, addrOneShotClk);+mmc.setProperty(plcName, propPosition, addrDelayNRT);
 mmc.setProperty(plcName, propCellType, valOneShotNRT); mmc.setProperty(plcName, propCellType, valOneShotNRT);
-mmc.setProperty(plcName, propCellConfig, clockPeriodTics);+mmc.setProperty(plcName, propCellConfig, (clockPeriodTics-1));
 mmc.setProperty(plcName, propCellInput1, addrInvert + addrEdge);  // trigger cell as fast as we can, but NRT prevents re-triggering when active mmc.setProperty(plcName, propCellInput1, addrInvert + addrEdge);  // trigger cell as fast as we can, but NRT prevents re-triggering when active
 mmc.setProperty(plcName, propCellInput2, addrInvert + addrEdge);  // clock on every tic mmc.setProperty(plcName, propCellInput2, addrInvert + addrEdge);  // clock on every tic
  
-mmc.setProperty(plcName, propPosition, addrOneShotOut);+mmc.setProperty(plcName, propPosition, addrOneShot);
 mmc.setProperty(plcName, propCellType, valOneShotNRT); mmc.setProperty(plcName, propCellType, valOneShotNRT);
 mmc.setProperty(plcName, propCellConfig, clockHighTics); mmc.setProperty(plcName, propCellConfig, clockHighTics);
-mmc.setProperty(plcName, propCellInput1, addrOneShotClk);  // trigger cell as fast as we can, but NRT prevents re-triggering when active+mmc.setProperty(plcName, propCellInput1, addrDelayNRT);  // trigger cell as fast as we can, but NRT prevents re-triggering when active
 mmc.setProperty(plcName, propCellInput2, addrInvert + addrEdge);  // clock on every tic mmc.setProperty(plcName, propCellInput2, addrInvert + addrEdge);  // clock on every tic
  
 // connect to BNC output // connect to BNC output
-mmc.setProperty(plcName, propPosition, addrOutputBNC1); +mmc.setProperty(plcName, propPosition, addrOutputBNC3); 
-mmc.setProperty(plcName, propCellConfig, addrOneShotOut);+mmc.setProperty(plcName, propCellConfig, addrOneShot);
  
 // restore updates // restore updates
 mmc.setProperty(plcName, propUpdates, valUpdatesOriginal); mmc.setProperty(plcName, propUpdates, valUpdatesOriginal);
 +
 +
  
  
Address: 29391 W Enid Rd. Eugene, OR 97402, USA | Phone: +1 (541) 461-8181
tiger_programmable_logic_card.txt · Last modified: 2024/02/06 14:25 by jon