Your browser does not allow scripts
Please click here to view a static table of contents without scripts
I2C_SetClock
Return to Introduction  Previous page  Next page
Sets the clock divisor value and returns the clock frequency in Hz.

FTC_STATUS
I2C_SetClock
(FTC_HANDLE ftHandle, DWORD dwClockDivisor, LPDWORD lpdwClockFrequencyHz)




Parameters
ftHandle
Handle of the device.
dwClockDivisor
Specifies a clock divisor which will be used to set the frequency for clocking data in and out of the FT2232C device.
lpdwClockFrequencyHz
Pointer to a variable of type DWORD which receives the actual frequency in Hz that data will be clocked in and out of the FT2232C device at.




Return Value
FTC_SUCCESS if successful, otherwise the return value is one of the following FTC error codes:

   FTC_INVALID_HANDLE
   FTC_INVALID_CLOCK_DIVISOR
   FTC_
FAILED_TO_COMPLETE_COMMAND
   FTC_IO_ERROR



Remarks
The valid range for dwClockDivisor is 0 to 65535. The highest clock frequency is represented by 0 which is equivalent to 6MHz and the lowest clock frequency is represented by 65535 which is equivalent to 91Hz. This can be calculated using the following formula:

   
dwClockFrequency = 12MHz / ((1 + dwClockDivisor) * 2)

I2C_SetClock will return the actual frequency in Hz for the current divisor value. The clock frequancy in Hz can also be calculated using I2C_GetClock.



Example

FTC_STATUS Status = FTC_SUCCESS;
FTC_HANDLE ftHandle;
DWORD dwClockDivisor = 0;
DWORD dwClockFrequencyHz = 0;

Status = I2C_SetClock(ftHandle, dwClockDivisor, &dwClockFrequencyHz);