Industry Online Support
Technical Forum
4/5/2011 11:24 PM | |
Joined: 1/28/2009 Last visit: 6/5/2023 Posts: 6804 Rating:
|
Dear member Try using OB32, as configured in the hardware configuration to be executed every 1 second.The easiest way to sample and calculate the difference if to use cyclic interrupts. OB100: [code]//INITIALIZE WHEN POWER UP L MD 340 //transfer current to old T MD 0[/code] OB32: [code]//EVERY 1 SECOND L MD 340 //current value L MD 0 //old value -R ABS //can be deleted T MD 4 //rate per sec L MD 340 //transfer current to old T MD 0[/code] You can change your own codes to solve your problem: 1-Use CPU internal clock with 0.5 Hz clock pulse , (eg.M0.7). 2-Execute the code in the pulse bit is on and jump the codes when it is off. 3-You should hold the old process value in a global variable. 4-transfer current to old process value at the end of code 5-transfer current to old in OB100 to avoid fake jumps Attachmentfl.zip (24 Downloads) |
Follow us on