The state of the contact on the ladder program determines if the custom function will be executed.
Within the custom function, it is possible to set the logic state of any I/O by using the SETIO, CLRIO, TOGGLEIO or the SETBIT or CLRBIT function. However, most of the time you probably want to leave the change of I/O state to ladder logic instead of within a CF. Ladder logic is must faster and more code efficient when handling single bit I/Os.