Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F78567540
dac.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Aug 21, 16:17
Size
999 B
Mime Type
text/x-c
Expires
Fri, Aug 23, 16:17 (2 d)
Engine
blob
Format
Raw Data
Handle
20064011
Attached To
R2671 HHRI-software
dac.h
View Options
#ifndef __DAC_H
#define __DAC_H
#include "../main.h"
#define DAC1_Pin GPIO_Pin_4
#define DAC2_Pin GPIO_Pin_5
#define DAC_Port GPIOA
#define DAC_FINAL_RANGE 9.0f
// -9 to 9V after the op-amp.
#define DAC_MAX 4095
// 12-bits.
/** @defgroup DAC Driver / DAC
* @brief Driver for the digital-to-analog converter.
*
* The STM32 features a two channels DAC, which means it is able to drive two
* pins with an analog voltage. On the HRI board, this voltage is mulltiplied
* by an amplification stage, so the final output range is +-9V. The
* corresponding output pins are on the J1 connector: ANOUT1 (2) and ANOUT2 (4).
*
* In the initialization code, call dac_Init() once. Then call
* dac_GetVoltageX() everytime the output voltage needs to be updated.
*
* @addtogroup DAC
* @{
*/
void
dac_Init
(
void
);
void
dac_SetVoltage1
(
float32_t
voltage
);
void
dac_SetVoltage2
(
float32_t
voltage
);
float32_t
dac_GetVoltage1
(
void
);
float32_t
dac_GetVoltage2
(
void
);
/**
* @}
*/
#endif
Event Timeline
Log In to Comment