更换语言:
   Contact us
  • Follow CooCox
  •         
  • CooCox Market
  •         
  • Tech Support
  •     
Home  › COX DAC Peripheral Interface

COX DAC Peripheral Interface

Version: 1.00 - 13. June 2010

Contents

Overview

A digital-to-analog converter (DAC or D-to-A) is a peripheral that converts a digital code to an analog signal (current, voltage, or electric charge).


Interface Definition

DAC Interface Definition : COX DAC Interface is a structure variable of COX_DAC_PI type, it contains a list of pointers to the functions that implement the standard functions specified by COX. Use different variables to access different DAC peripherals.

Serial Interface
typedef struct {
  COX_Status (*Init)  (void);
  void       (*Write) (uint16_t ad_out, uint32_t value);
  COX_Status (*Cfg)   (uint8_t index, uint32_t arg, uint32_t *pre_arg);
} COX_DAC_PI_Def;
typedef const COX_DAC_PI_Def COX_DAC_PI;
Member
COX_Status (*Init)  (void); 
/* Initialize the DAC peripheral */ 
void       (*Write) (uint16_t ad_out, uint32_t value); 
/* Write value to DAC */    
COX_Status (*Cfg)   (uint8_t index, uint32_t arg, uint32_t *pre_arg); 
/* Configure the peripheral */

Global Define

Name Description
COX_DAC_CFG_BITS Conversion Resolution

Standard Function

Name Description
Init Initialize the DAC peripheral
Write Write value to DAC
Cfg Configure the peripheral

COX_Status Init (uint32_t clock)
Description Initialize the Serial peripheral
Parameter clock: Conversion clock
Return Code COX_SUCCESS or COX_ERROR
void Write (uint16_t ad_out, uint32_t value)
Description Write value to DAC
Parameter ad_out : DAC ouput line

value : Value to be converted to output

Return Code None
COX_Status Cfg (uint8_t index, uint32_t arg, uint32_t *pre_arg)
Description Configure the peripheral
Parameter index : Configuration index, it should be :
  • COX_DAC_CFG_BITS : Set Conversion Resolution
  • COX_DAC_CFG_CURRENT : Maximum current output
arg : Configuration argument
pre_arg : Return previous configuration argument
Return Code COX_SUCCESS or COX_ERROR

Available Interface

Vendor Chip Interface Description
NXP LPC17xx Series pi_dac DAC Interface

 

© 2009 -2011 CooCox - Terms of Use         Business Model         Market             About us