Digital Systems Design lab Report
h2o// dac.c // This software configures DAC output // Runs on TM4C123 // Program written by: put your names here // Date Created: // Last Modified: // Lab number: 4 // Hardware connections #include "tm4c123gh6pm.h" // put code definitions for the software (actual C code) // this file explains how the module works // **************DAC_Init********************* // Initialize 5-bit DAC, called once // Input: none // Output: none void DAC_Init(void){ unsigned int delay; SYSCTL_RCGC2_R |= 0x01; delay=0x4; GPIO_PORTA_AMSEL_R &=0x83; GPIO_PORTA_DIR_R |=0x7C; GPIO_PORTA_PCTL_R &=0x83; GPIO_PORTA_AFSEL_R &=0x83; GPIO_PORTA_DEN_R |=0x7C; } // **************DAC_Out********************* // output to DAC // Input: 5-bit data, 0 to 31 // Output: none void DAC_Out(unsigned long Data){ GPIO_PORTA_DATA_R = GPIO_PORTA_DATA_R <<2; GPIO_PORTA_DATA_R = Data; }