Page 25 of 346 Start Back Next End ZBasic System Library 13 ZBasic Microcontrollers Note, particularly, the line immediately before the call to ShiftOut(). After the semaphore is acquired Regsister.Timer1Busy will be True. Unless it is set to False, the call to ShiftOut() will fail because that subroutine will think that the timer is in use. Caution: setting the busy flag for a timer to True and never setting it back to False will prevent the proper functioning of all System Library routines that require that timer. I/O Timer Prescaler Values Some of the System Library routines that use the I/O Timer allow you to modify the frequency used to clock the timer while others use a fixed frequency determined by the requirements of the routine. The routines that do allow frequency modification are divided into two groups, one controlled by the value of Register.TimerSpeed1 and the other controlled by the value of Register.TimerSpeed2. The table below shows the System Library routines that use a timer and, where applicable, the timer speed variable that controls the timer frequency. System Library Routines Using TimerSpeed Values Routine TimerSpeed Value ADCtoCom1() Com1toDAC() CountTransitions() TimerSpeed1 FreqOut() Get1Wire() Get1WireByte() Get1WireData() I2CCmd()² TimerSpeed1 I2CGetByte()² TimerSpeed1 I2CPutByte()² TimerSpeed1 InputCapture() TimerSpeed1 InputCaptureEx() TimerSpeed1 OutputCapture() TimerSpeed1 OutputCaptureEx() TimerSpeed1 OpenPWM() OpenPWM8() RCTime() TimerSpeed2¹ PlaySound() PulseIn() TimerSpeed2¹ PulseOut() TimerSpeed2¹ Put1Wire() Put1WireByte() Put1WireData() PWM() PWM8() Reset1Wire() ShiftIn() TimerSpeed1 ShiftInEx() TimerSpeed1 ShiftOut() TimerSpeed1 ShiftOutEx() TimerSpeed1 SPICmd()² TimerSpeed1 X10Cmd() Notes: 1) The timer frequency is scaled in some cases. See below. 2) The timer is used only for software based channels. The table below shows the correspondence between the allowable values for the TimerSpeed registers and the resulting clock frequency applied to the I/O Timer in terms of the CPU frequency. The divisor specified is applied to the CPU clock frequency to yield the I/O Timer clock frequency. For compatibility