[TM4C123 single-chip microcomputer practice] configure SSI and drive DAC7811 to display a sine wave,

Source: Internet
Author: User

[TM4C123 single-chip microcomputer practice] configure SSI and drive DAC7811 to display a sine wave,

I have learned TM4C123 single-chip in the electric competition over the past few days. In general, combined with the official routine and reference manual, a good oscilloscope will be much more efficient.

TI's SSI is actually SPI.

First, familiarize yourself with SPI.

SPI is used to transmit data between the host and the slave through TX and RX. The communication between the host and the slave is activated through the CS chip selection signal line, and the frequency is controlled through the CLK clock signal.


# Include <stdbool. h> # include <stdint. h> # include "inc/hw_memmap.h" # include "driverlib/gpio. h "# include" driverlib/pin_map.h "# include" driverlib/ssi. h "# include" driverlib/sysctl. h "// ssi. h must have
Extern uint32_t Fre; void ssi_0 (void) {SysCtlClockSet (feature | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_10MHZ); // select the clock source
SysCtlPeripheralEnable (SYSCTL_PERIPH_SSI0); // enable SSI0
SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOA); // enable GPIO GPIOPinConfigure (Enabled); // enable the GPIO pin function GPIOPinConfigure (Enabled );
<P> </p> SysCtlGPIOAHBEnable (GPIO_PORTA_BASE); // mount the high-speed Peripheral Bus GPIOPinTypeSSI (GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_3 | GPIO_PIN_2 ); // enable the gpio ssi function SSIConfigSetExpClk (SSI0_BASE, SysCtlClockGet (), SSI_FRF_TI, SSI_MODE_MASTER, Fre, 16); // select the SSI clock source, select the working mode, select the frequency, select the number of sending digits
SSIEnable (SSI0_BASE); // enable} void DAC_Write_0 (uint16_t ssi0_send) {SSIDataPut (SSI0_BASE, 0x3FFF & ssi0_send ); /** // send data // while (SSIBusy (SSI0_BASE ));}
Pin selection:

We can refer to reference


About work mode selection:

SPI has four working modes:

We need to select based on the specific DAC receiving method:

Reference



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.