As mentioned before, the implementation of a protocol in the PICs requires to modify the host software too. Once the start/stop event and the dialog window are created we have to focus on the firmware. In other words, when we modify the firmware we are expanding the capabilities of the CommandInstrument(). This function has a few options but they are very complete to design any protocol. It might be possible that we need some options not included in this function. When this happens, it is time to modify the firmware.
In general, only the TrapPic firmware will have to be modified. Both TrapPics have information of the position of the optical trap and the force applied and they are capable of giving orders to the DA converters that finally move the piezos. So the TrapPics have the inputs, the outputs and the computational requirements to perform a protocol.
Figure C.11 shows a scheme of the TrapPic algorithm. A new protocol is introduced as a Feedback routine that the TrapPic runs when it is activated. It requires coding in C, compiling and burning the firmware into the PICs. The following example shows the pseudocode of a pulling protocol implemented in the TrapPic. It is much more elementary than the host algorithm. In this case, the voltage applied to the piezo (voltagePiezoY) is increased by a fixed amount (deltaV) one of every certain cycles (skipMove). The control of force limits and directions is performed by the host algorithm.
IF <skipMove> TRUE <voltagePiezoY> = <voltagePiezoY>; ELSE <voltagePiezoY> = <voltagePiezoY> + <deltaV>;
JM Huguet 2014-02-12