LAB4 Instructions

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 3

1(3)
NUCLEO-L152RE Digital to Analog Converter (DAC)
1. Common:
Learn how to use NUCLEO-L152RE Digital to Analog Converter (DAC)
Learn how to use encoder
Learn how to create industry standard voltage message 0V-10V
Learn how to combine external encoder data to internal DAC peripheral in NUCLEO-
L152RE
2. Needed equipment’s and components:
1 pcs, NUCLEO-L152RE (development board)
1 pcs, USB-cable (A - miniB connectors)
1 pcs, Laboratory PC, where Atollic TrueSTUDIO, STM32CubeMX and RealTerm
1 pcs, 2-bit quadrature code incremental encoder
7 pcs, 10 kΩ resistor
2 pcs, 10 nF ceramic capacitor
1 pcs, LM741 operational amplifier
1 pcs, BC547 transistor
2(3)
3. Measurements
3.1. Create STM32CubeMX project for NUCLEO-L152RE board where PA6 (D12, encoder
A) is interrupt input and PA7 (D11, encoder B) is GPIO input pin and PA4 (A2) is
analog DAC1 output. Remember to configure NVIC EXTI line[9:5] interrupts.
3.2. Create software so that you can put full output value to DAC and measure voltage with
Fluke 87 or Fluke 179. (hint: Check page 108 from STM32L152RET6 datasheet.). Use
DAC without output buffer (sConfig.DAC_OutputBuffer =
DAC_OUTPUTBUFFER_DISABLE;)
Use functions: HAL_DAC_Init(), HAL_DAC_Start(), HAL_DAC_SetValue().
3.3. Measure DAC reference voltage from AVDD pin and compare value to 3.2 full output.
3.4. Continue 3.2 software and add encoder reading function and show values in terminal.
The circuit connection can be found figure below:
3(3)
3.5. Create final software where encoder controls output voltage 0V-10V. What is output
voltage resolution? How many rotations needed in order to adjust voltage output 0V-
10V? Use circuit below and fill spreadsheet table for different output values. Remember
to connect ±15 V to operational amplifier power supply inputs.

Navigation menu