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 revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
tiger_programmable_logic_card [2019/05/09 17:02]
asiadmin [Clock]
tiger_programmable_logic_card [2019/05/14 00:09]
jon [Clock]
Line 232: Line 232:
 ==== Clock ==== ==== Clock ====
  
-To create a free-running clock with user-selectable period and duty cycle you can combine ​a NRT delay cell and a one-shot. ​ The delay cell trigger is connected to logic high, but because it is non-retriggerable it will simply trigger itself whenever ​the delay has finished, thus outputting a pulse once per delay period. ​ That pulse triggers a one-shot which generates the clock output, and the one-shot ​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 BNC1 output #
Line 254: Line 254:
 String propUpdates = "​EditCellUpdateAutomatically";​ String propUpdates = "​EditCellUpdateAutomatically";​
 String valNo = "​No";​ String valNo = "​No";​
-String valDelayNRT = "15 - delay (NRT)";​ 
 String valOneShotNRT = "14 - one shot (NRT)";​ String valOneShotNRT = "14 - one shot (NRT)";​
 int addrInvert= 64; int addrInvert= 64;
Line 260: Line 259:
 double ticsPerSecond = 4000.0; double ticsPerSecond = 4000.0;
 int addrOutputBNC1 = 33; int addrOutputBNC1 = 33;
-int addrDelayNRT ​= 1; +int addrOneShotClk ​= 1; 
-int addrOneShot ​= 2;+int addrOneShotOut ​= 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) - 2;+int clockPeriodTics = (int) (ticsPerSecond/​clockFrequencyHz + 0.5) - 1;
 int clockHighTics = (int) (clockPeriodTics * clockDutyCycle) + 1; int clockHighTics = (int) (clockPeriodTics * clockDutyCycle) + 1;
  
Line 271: Line 270:
 mmc.setProperty(plcName,​ propUpdates,​ valNo); mmc.setProperty(plcName,​ propUpdates,​ valNo);
  
-// do programming of one-shot ​and delay cells +// do programming of one-shot cells 
-mmc.setProperty(plcName,​ propPosition, ​addrDelayNRT); +mmc.setProperty(plcName,​ propPosition, ​addrOneShotClk); 
-mmc.setProperty(plcName,​ propCellType, ​valDelayNRT);+mmc.setProperty(plcName,​ propCellType, ​valOneShotNRT);
 mmc.setProperty(plcName,​ propCellConfig,​ clockPeriodTics);​ mmc.setProperty(plcName,​ propCellConfig,​ clockPeriodTics);​
 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, ​addrOneShot);+mmc.setProperty(plcName,​ propPosition, ​addrOneShotOut);
 mmc.setProperty(plcName,​ propCellType,​ valOneShotNRT);​ mmc.setProperty(plcName,​ propCellType,​ valOneShotNRT);​
 mmc.setProperty(plcName,​ propCellConfig,​ clockHighTics);​ mmc.setProperty(plcName,​ propCellConfig,​ clockHighTics);​
-mmc.setProperty(plcName,​ propCellInput1, ​addrDelayNRT);  // trigger cell as fast as we can, but NRT prevents re-triggering when active+mmc.setProperty(plcName,​ propCellInput1, ​addrOneShotClk);  // 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,​ addrOutputBNC1);​
-mmc.setProperty(plcName,​ propCellConfig, ​addrOneShot);+mmc.setProperty(plcName,​ propCellConfig, ​addrOneShotOut);
  
 // restore updates // restore updates
 mmc.setProperty(plcName,​ propUpdates,​ valUpdatesOriginal);​ mmc.setProperty(plcName,​ propUpdates,​ valUpdatesOriginal);​
 +
 +
 </​code>​ </​code>​
 <-- <--
Address: 29391 W Enid Rd. Eugene, OR 97402, USA | Phone: +1 (541) 461-8181
tiger_programmable_logic_card.txt · Last modified: 2019/06/20 18:10 by jon