The GT My Block
The
GT
My Block uses a Timer block to measure the duration of a single loop iteration. The timer value is used to determine the value of the tInt
variable block, which is the average period of time of one iteration of the balance loop, over which the Gyro rates are integrated to determine the Gyro position. tInt
is also used to calculate the derivative of the motor position to determine the motor rate. Because the rate at which the program executes may vary, the integration time will vary. Thus, the GT
My Block allows us to compensate for any affect on calculations in other parts of our program.
The variable block cLo
is a loop counter variable. Whenever the main programming loop runs, the loop counter will be set to zero in the RST
My Block. Thus, the compare block and the logic switch block will set the tInt
variable block value to 0.014 seconds and reset timer 1 with the reset timer block. After the switch block, the index of the loop counter cLo
will be increased by...