STM32F7 16 Digital-to-analog converter (DAC)

Started by tha, November 29, 2022, 07:32:26 AM

Previous topic - Next topic

tha

16.5 DAC registers

ดูที่ Section 1 บนหน้า 62 สำหรับรายการของตัวย่อที่ใช้ใน register descriptions.
The peripheral registers ต้องถูกเข้าถึงโดย words (32 bits).

16.5.1 DAC control register (DAC_CR)

Address offset: 0x00
Reset value: 0x0000 0000



Bits 31:30 Reserved, must be kept at reset value.

Bit 29 DMAUDRIE2: DAC channel2 DMA underrun interrupt enable
     บิตนี้ถูกเซ็ตและเคลียร์โดย software.
     0: DAC channel2 DMA underrun interrupt ถูกปิดใช้งาน
     1: DAC channel2 DMA underrun interrupt ถูกเปิดใช้งาน

Bit 28 DMAEN2: DAC channel2 DMA enable
     บิตนี้ถูกเซ็ตและเคลียร์โดย software.
     0: DAC channel2 DMA mode ถูกปิดการใช้งาน
     1: DAC channel2 DMA mode ถูกเปิดการใช้งาน

Bit 27:24 MAMP2[3:0]: DAC channel2 mask/amplitude selector
     บิตเหล่านี้ถูกเขียนโดย software เพื่อเลือกการบัง(mask) ใน wave generation mode หรือ amplitude ใน triangle
     generation mode.
     0000: Unmask bit0 ของ LFSR/ Triangle Amplitude เท่ากับ 1
     0001: Unmask bits[1:0] of LFSR/ Triangle Amplitude equal to 3
     0010: Unmask bits[2:0] of LFSR/ Triangle Amplitude equal to 7
     0011: Unmask bits[3:0] of LFSR/ Triangle Amplitude equal to 15
     0100: Unmask bits[4:0] of LFSR/ Triangle Amplitude equal to 31
     0101: Unmask bits[5:0] of LFSR/ Triangle Amplitude equal to 63
     0110: Unmask bits[6:0] of LFSR/ Triangle Amplitude equal to 127
     0111: Unmask bits[7:0] of LFSR/ Triangle Amplitude equal to 255
     1000: Unmask bits[8:0] of LFSR/ Triangle Amplitude equal to 511
     1001: Unmask bits[9:0] of LFSR/ Triangle Amplitude equal to 1023
     1010: Unmask bits[10:0] of LFSR/ Triangle Amplitude equal to 2047
     ≥ 1011: Unmask bits[11:0] of LFSR/ Triangle Amplitude equal to 4095

Bit 23:22 WAVE2[1:0]: DAC channel2 noise/triangle wave generation enable
     บิตเหล่านี้ถูก set/reset โดย software.
     00: wave generation ถูกปิดใช้งาน
     01: Noise wave generation ถูกเปิดใช้งาน
     1x: Triangle wave generation ถูกเปิดใช้งาน
Note: ถูกใช้เฉพาะถ้า bit TEN2 = 1 (DAC channel2 trigger ถูกเปิดใช้งาน)

tha

Bits 21:19 TSEL2[2:0]: DAC channel2 trigger selection
     บิตเหล่านี้เลือก the external event ที่ใช้เพื่อทริก DAC channel2
     000: Timer 6 TRGO event
     001: Timer 8 TRGO event
     010: Timer 7 TRGO event
     011: Timer 5 TRGO event
     100: Timer 2 TRGO event
     101: Timer 4 TRGO event
     110: External line9
     111: Software trigger
  Note: ถูกใช้เฉพาะถ้า bit TEN2 = 1 (DAC channel2 trigger ถูกเปิดใช้งาน)

Bit 18 TEN2: DAC channel2 trigger enable
     บิตนี้ถูกเซ็ตและเคลียร์โดย software เพื่อ enable/disable DAC channel2 trigger
     0: DAC channel2 trigger ถูกปิดใช้งานและ data ที่เขียนลงใน DAC_DHRx register จะถูกส่งถ่าย one APB1 clock cycle ต่อ
         มาไปยัง the DAC_DOR2 register.
     1: DAC channel2 trigger ถูกเปิดการใช้งานและ data จาก DAC_DHRx register จะถูกส่งถ่าย three APB1 clock cycles
         ต่อมาไปยัง the DAC_DOR2 register.
  Note: เมื่อ software trigger ถูกเลือก, the transfer จาก the DAC_DHRx register ไปยัง the DAC_DOR2 register ใช้เพียง
            one APB1 clock cycle.


Bit 17 BOFF2: DAC channel2 output buffer disable
     บิตนี้ถูกเซ็ตและเคลียร์โดย software เพื่อ enable/disable DAC channel2 output buffer.
     0: DAC channel2 output buffer ถูกเปิดใช้งาน
     1: DAC channel2 output buffer ถูกปิดใช้งาน

Bit 16 EN2: DAC channel2 enable
     บิตนี้ถูกเซ็ตและเคลียร์โดย software เพื่อ enable/disable DAC channel2.
     0: DAC channel2 ถูกปิดใช้งาน
     1: DAC channel2 ถูกเปิดใช้งาน

Bits 15:14 Reserved, must be kept at reset value.

Bit 13 DMAUDRIE1: DAC channel1 DMA Underrun Interrupt enable
     บิตนี้ถูกเซ็ตและเคลียร์โดย software.
     0: DAC channel1 DMA underrun interrupt ถูกปิดใช้งาน
     1: DAC channel1 DMA underrun interrupt ถูกเปิดใช้งาน

Bit 12 DMAEN1: DAC channel1 DMA enable
     บิตนี้ถูกเซ็ตและเคลียร์โดย software.
     0: DAC channel1 DMA mode ถูกปิดใช้งาน
     1: DAC channel1 DMA mode ถูกเปิดใช้งาน

tha

Bits 11:8 MAMP1[3:0]: DAC channel1 mask/amplitude selector
     บิตเหล่านี้ถูกเขียนโดย software เพื่อเลือกการบัง(mask) ใน wave generation mode หรือ amplitude ใน triangle
     generation mode.
     0000: Unmask bit0 of LFSR/ Triangle Amplitude เท่ากับ 1
     0001: Unmask bits[1:0] of LFSR/ Triangle Amplitude equal to 3
     0010: Unmask bits[2:0] of LFSR/ Triangle Amplitude equal to 7
     0011: Unmask bits[3:0] of LFSR/ Triangle Amplitude equal to 15
     0100: Unmask bits[4:0] of LFSR/ Triangle Amplitude equal to 31
     0101: Unmask bits[5:0] of LFSR/ Triangle Amplitude equal to 63
     0110: Unmask bits[6:0] of LFSR/ Triangle Amplitude equal to 127
     0111: Unmask bits[7:0] of LFSR/ Triangle Amplitude equal to 255
     1000: Unmask bits[8:0] of LFSR/ Triangle Amplitude equal to 511
     1001: Unmask bits[9:0] of LFSR/ Triangle Amplitude equal to 1023
     1010: Unmask bits[10:0] of LFSR/ Triangle Amplitude equal to 2047
     ≥ 1011: Unmask bits[11:0] of LFSR/ Triangle Amplitude equal to 4095

Bits 7:6 WAVE1[1:0]: DAC channel1 noise/triangle wave generation enable
     บิตเหล่านี้ถูก set/reset โดย software.
     00: wave generation ถูกปิดใช้งาน
     01: Noise wave generation ถูกเปิดใช้งาน
     1x: Triangle wave generation ถูกเปิดใช้งาน
  Note: ถูกใช้เฉพาะถ้า bit TEN1 = 1 (DAC channel1 trigger ถูกเปิดใช้งาน)

Bits 5:3 TSEL1[2:0]: DAC channel1 trigger selection
     บิตเหล่านี้เลือก the external event ที่ใช้เพื่อทริก DAC channel1
     000: Timer 6 TRGO event
     001: Timer 8 TRGO event
     010: Timer 7 TRGO event
     011: Timer 5 TRGO event
     100: Timer 2 TRGO event
     101: Timer 4 TRGO event
     110: External line9
     111: Software trigger
  Note: ถูกใช้เฉพาะถ้า bit TEN1 = 1 (DAC channel1 trigger ถูกเปิดใช้งาน)

Bit 2 TEN1: DAC channel1 trigger enable
     บิตนี้ถูกเซ็ตและเคลียร์โดย software เพื่อ enable/disable DAC channel1 trigger
     0: DAC channel1 trigger ถูกปิดการใช้งานและ data ที่เขียนลงใน DAC_DHRx register จะถูกส่งถ่าย one APB1 clock cycle
         ต่อมาไปยัง the DAC_DOR1 register.
     1: DAC channel1 trigger ถูกเปิดการใช้งานและ data จาก DAC_DHRx register จะถูกส่งถ่าย three APB1 clock cycles
         ต่อมาไปยัง the DAC_DOR1 register.
  Note: เมื่อ software trigger ถูกเลือก, the transfer จาก the DAC_DHRx register ไปยัง the DAC_DOR1 register ใช้เพียง
            one APB1 clock cycle.


Bit 1 BOFF1: DAC channel1 output buffer disable
     บิตนี้ถูกเซ็ตและเคลียร์โดย software เพื่อ enable/disable DAC channel1 output buffer.
     0: DAC channel1 output buffer ถูกเปิดใช้งาน
     1: DAC channel1 output buffer ถูกปิดใช้งาน

Bit 0 EN1: DAC channel1 enable
     บิตนี้ถูกเซ็ตและเคลียร์โดย software เพื่อ enable/disable DAC channel1.
     0: DAC channel1 ถูกปิดใช้งาน
     1: DAC channel1 ถูกเปิดใช้งาน


tha

16.5.2 DAC software trigger register (DAC_SWTRIGR)

Address offset: 0x04
Reset value: 0x0000 0000



Bits 31:2 Reserved, must be kept at reset value.

Bit 1 SWTRIG2: DAC channel2 software trigger
     บิตนี้ถูกเซ็ตและเคลียร์โดย software เพื่อ enable/disable the software trigger.
     0: Software trigger ถูกปิดใช้งาน
     1: Software trigger ถูกเปิดใช้งาน
  Note: บิตนี้จะถูกเคลียร์โดย hardware (one APB1 clock cycle ต่อมา) ทันทีที่ the DAC_DHR2 register value ถูกโหลดลงใน
            the DAC_DOR2 register แล้ว.


Bit 0 SWTRIG1: DAC channel1 software trigger
     บิตนี้ถูกเซ็ตและเคลียร์โดย software เพื่อ enable/disable the software trigger.
     0: Software trigger ถูกปิดใช้งาน
     1: Software trigger ถูกเปิดใช้งาน
Note: บิตนี้จะถูกเคลียร์โดย hardware (one APB1 clock cycle ต่อมา) ทันทีที่ the DAC_DHR1 register value ถูกโหลดลงใน
            the DAC_DOR1 register แล้ว.

tha

16.5.3 DAC channel1 12-bit right-aligned data holding register
(DAC_DHR12R1)


Address offset: 0x08
Reset value: 0x0000 0000



Bits 31:12 Reserved, must be kept at reset value.

Bits 11:0 DACC1DHR[11:0]: DAC channel1 12-bit right-aligned data
     บิตเหล่านี้ถูกเขียนโดย software ซึ่งระบุ 12-bit data สำหรับ DAC channel1.

tha


tha


tha