![FTDI FT51A Application Note Download Page 144](http://html1.mh-extra.com/html/ftdi/ft51a/ft51a_application-note_2341158144.webp)
Application Note
AN_289 FT51A Programming Guide
Version 1.0
Document Reference No.: FT_000962 Clearance No.: FTDI# 483
143
Copyright © 2015 Future Technology Devices International Limited
Requires: ft51_general_config_get_system_clock.c
This function will calculate the baud rate divisor values for the
, taking into account the speed of the system clock.
It requires that the Configuration library is included for the get_system_clock() function.
The calculation utilises 32 bit arithmetic and will therefore include SDCC system libraries for 32 bit
calculations. These can add a significant amount of code to a program. If space is an issue then
the baud rate divisor can be pre-calculated and programmed directly into the divisor registers
without making the calculation.
3.1.4.3
UART_set_data_bits
File: ft51_uart_set_data_bits.c
Set the number of data bits for the UART to 7 or 8.
3.1.4.4
UART_set_flow_control
File: ft51_uart_set_flow_control.c
Configure the UART to enable or disable flow control. If it is enabled then it can be set to CTS/RTS
or DTR/DSR modes.
3.1.4.5
UART_set_parity
File: ft51_uart_set_parity.c
Enable or disable parity bit generation and checking on the UART.
3.1.4.6
UART_set_stop_bits
File: ft51_uart_set_stop_bits.c
Set the number of stop bits in a UART character to 1 or 2.
3.1.4.7
UART_read
File: ft51_uart_read.c
Read a number of bytes from the UART interface. This will use interrupts to manage the
transaction and will block until the required amount of data has been received.
3.1.4.8
UART_write
File: ft51_uart_write.c
Write a number of bytes from a buffer to the UART interface. This uses interrupts to manage the
transaction. It will block until the data has been transmitted.
3.1.5
SPI Master Library
This library has functions to send and receive messages using the SPI master interface. It
includes variants which are interrupt-driven (per byte) or DMA-driven (per block). Interrupt and
DMA driven options cannot be used at the same time within a project.
To use the SPI Master in interrupt mode, call the function SPIM_initialise_ints() to enable the
hardware interface before configuring it to match the communication method of a SPI Slave with
SPIM_configure_slave(). Then calling SPIM_transceive_ints() is used to exchange data with the
slave device.
To use the SPI Master in DMA mode, call the function SPIM_initialise_DMA() to enable the
hardware interface before configuring it to match the communication method of a SPI Slave with
SPIM_configure_slave(). Then calling SPIM_transceive_DMA() is used to exchange data with the
slave device.
Source Folder: spi_master