Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F85622738
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
Mon, Sep 30, 09:42
Size
999 B
Mime Type
text/x-c
Expires
Wed, Oct 2, 09:42 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
20815867
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