Your browser does not allow scripts
Please click here to view a static table of contents without scripts
CBUS Bit Bang Mode
Return to Introduction  Previous page  Next page
The FT232R supports a new type of Bit Bang mode on the CBUS pins. The CBUS Bit Bang mode must be configured in the FT232R EEPROM and then enabled with a FT_SetBitMode command to function. It is not available on the FT245R.

When CBUS Bit Bang mode is enabled the CBUS pins are configured as follows:

FT232RL Pin Number
FT232RQ Pin Number

Signal


Type


Description

23
22
C0
Input/Output
CBUS Bit Bang Bit 0
22
21
C1
Input/Output
CBUS Bit Bang Bit 1
13
10
C2
Input/Output
CBUS Bit Bang Bit 2
14
11
C3
Input/Output
CBUS Bit Bang Bit 3



The FT_SetBitMode and FT_GetBitMode D2XX commands are required to communicate with CBUS Bit Bang. Since these functions allow only a single byte to be sent or received, this version of Bit Bang is much slower than the Asynchronous and Synchronous Bit Bang types when used to transfer large buffers of data with FT_Write and FT_Read, but it does provide an additional 4 IO pins for the FT232R. The data transfer rate is limited by USB frames.


The D2XX commands required to use CBUS Bit Bang mode are listed below:

D2XX Function
Description
FT_SetBitMode
CBUS Bit Bang mode is enabled using the FT_SetBitMode command. A value of 0x20 will enable it and a value of 0x00 will reset the device mode. Note that the CBUS pins must also be configured for CBUS Bit Bang in the FT232R EEPROM.
FT_SetBitMode also provides the means to write data to the CBUS pins. The upper nibble of the
Mask
parameter controls which pins are inputs or outputs, while the lower nibble controls which of the outputs are high or low.

FT_GetBitMode
FT_GetBitMode returns the instantaneous value of the pins. A single byte will be returned where the lower nibble contains the current values of the pins, both those which are inputs and those which are outputs.



For example:

Set all pins to output with bit 0 high:   FT_SetBitMode(Handle, 0xF1, 0x20)

Set bits 0 and 1 to input, bits 2 and 3 to output and make bits 2 and 3 high:   FT_SetBitMode(Handle, 0xCC, 0x20)

Read pins:   FT_GetBitMode(Handle, Data) where the lower nibble is given by (Data AND 0x0F)


Full descriptions of these functions are available in the
D2XX Programmer's Guide
.

Code examples can be downloaded from
http://www.ftdichip.com/Projects/CodeExamples.htm.