You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[PIC18-Q10 Product Family Page](https://www.microchip.com/design-centers/8-bit/pic-mcus/device-selection/pic18f-q10-product-family)
16
+
*[PIC18F47Q10 Data Sheet](https://www.microchip.com/DS40002043)
17
+
*[PIC18F47Q10 Code Examples on GitHub](https://github.com/microchip-pic-avr-examples?q=pic18f47q10)
18
18
19
19
# Reference Voltage and Waveform Generation Using DAC
20
20
The signals generated in this example are “Sine wave, Triangular wave, Square wave, Sawtooth wave, and constant (reference) voltage signals”. The digital Look Up Table (LUT) is created and fed into DAC input to generate the corresponding signal.
21
21
22
22
### The LUT is generated by considering following parameters-
23
23
1. Constant (Reference) Voltage:
24
-
*Voltage 1.6V
25
-
*Voltage 3.0V
24
+
* Voltage 1.6V
25
+
* Voltage 3.0V
26
26
27
27
2. Waveforms:
28
-
*Amplitude of the signal – 3.3V
29
-
*Frequency of the signal – 100Hz (DAC register update frequency can be modified by changing timer period to change the frequency of the generated signal.)
28
+
* Amplitude of the signal – 3.3V
29
+
* Frequency of the signal – 100Hz (DAC register update frequency can be modified by changing timer period to change the frequency of the generated signal.)
30
30
31
31
Figure 1 shows an overview of the Signal Generator Example.
32
32
@@ -40,7 +40,7 @@ The onboard push button (SW0) is used to switch between the Constant voltage and
40
40
41
41
This example generates the reference voltage at power up, and the signal output will be changed after each switch press as per following sequence
42
42
43
-
1.Reference voltage 1.6V (on Power up)
43
+
1.Reference voltage 1.6V (on Power up)
44
44
2. Reference voltage 3V
45
45
3. Sine Wave
46
46
4. Triangular Wave
@@ -49,21 +49,21 @@ This example generates the reference voltage at power up, and the signal output
49
49
50
50
**Frequency calculation for the generated signal**
51
51
52
-
- When the signal to be generated is Sine wave, Triangular wave, Square wave or Sawtooth wave, frequency of the generated signal is decided by the DAC register update frequency and total number of points in one cycle of the signal.
53
-
- Timer 2 interrupt is used for updating the DAC register.
54
-
- Frequency of the generated signal = 1/ (total number of points in one cycle X Timer 2 period) = 1/(128 X 78.13 us) = 100 Hz.
55
-
- For changing the frequency of the generated signal timer 2 period can be changed.
52
+
* When the signal to be generated is Sine wave, Triangular wave, Square wave or Sawtooth wave, frequency of the generated signal is decided by the DAC register update frequency and total number of points in one cycle of the signal.
53
+
* Timer 2 interrupt is used for updating the DAC register.
54
+
* Frequency of the generated signal = 1/ (total number of points in one cycle X Timer 2 period) = 1/(128 X 78.13 us) = 100 Hz.
55
+
* For changing the frequency of the generated signal timer 2 period can be changed.
56
56
57
57
***Note: The system clock frequency also has impact on the maximum frequency that can be generated using this method.
58
-
For generating higher frequecy signal the higher system clock frequency should be used.
58
+
For generating higher frequency signal the higher system clock frequency should be used.
59
59
With 64 MHz of system clock frequency the maximum frequency generated is 1.1 KHz.***
60
60
61
61
Operation of this example is discussed in following section.
With full program and debug capabilities, the PIC18F47Q10 Curiosity Nano evaluation kit offers complete support for the new design. With the award-winning MPLAB X integrated development platform and MPLAB Code Configurator (MCC), the kit provides access to the Intelligent analog and Core Independent Peripherals on the PIC18F47Q10. Figure 2 shows the PIC18F47Q10 Curiosity Nano board.
66
+
With full program and debug capabilities, the PIC18F47Q10 Curiosity Nano evaluation kit offers complete support for the new design. With MPLAB X integrated development platform and MPLAB Code Configurator (MCC), the kit provides access to the Intelligent analog and Core Independent Peripherals on the PIC18F47Q10. Figure 2 shows the PIC18F47Q10 Curiosity Nano board.
@@ -96,13 +96,14 @@ Open "Clock Control" setup present under "System" dropdown menu in "Project Reso
96
96
97
97
* Set "Clock Source" as "HFINTOSC"
98
98
* Set "HF Internal Clock" as "16_MHz"
99
-
* Set "Clock Divider" as "1"
99
+
* Set "Clock Divider" as "1"
100
+
100
101
101
102

102
103
103
104
**Figure 4: Clock Control**
104
105
105
-
***Add peripherals to the project**
106
+
## -> Add peripherals to the project
106
107
107
108
Add DAC, TMR2 and TMR4 peripherals to the project from Device Resources → Drivers.
108
109
@@ -187,57 +188,57 @@ As pin RE2 cannot be used as input pin for timer 4, pin RC2 is configured as tim
187
188
188
189
# Demo Operation
189
190
190
-
*Setup the hardware, as per Hardware Setup (Refer Figure 3.1 and 3.2).
191
-
*Connect the pins RE2 and RC2 using the jumper.
192
-
*Connect RA2 (DAC1OUT1 Pin) to the positive terminal of the Scope (DSO/Oscilloscope) and connect GND (CNANO board ground pin) to GND terminal of scope.
193
-
*Power on the CNANO board by connecting the micro USB cable from micro USB socket (Micro USB Connector) on the CNANO board to the PC USB socket.
194
-
*Click on "Make and Program Device"
191
+
* Setup the hardware, as per Hardware Setup (Refer Figure 3.1 and 3.2).
192
+
* Connect the pins RE2 and RC2 using the jumper.
193
+
* Connect RA2 (DAC1OUT1 Pin) to the positive terminal of the Scope (DSO/Oscilloscope) and connect GND (CNANO board ground pin) to GND terminal of scope.
194
+
* Power on the CNANO board by connecting the micro USB cable from micro USB socket (Micro USB Connector) on the CNANO board to the PC USB socket.
**Figure 17: Generated Sawtooth Wave on Oscilloscope screen**
237
238
238
-
*Press on board button (SW0) to change the generated signal and observe the default constant signal on the oscilloscope screen.
239
-
*Cycle is repeated, once six signals are generated and displayed.
240
-
*The signal change happens for every button (SW0) press.
239
+
* Press on board button (SW0) to change the generated signal and observe the default constant signal on the oscilloscope screen.
240
+
* Cycle is repeated, once six signals are generated and displayed.
241
+
* The signal change happens for every button (SW0) press.
241
242
242
243
# Conclusion
243
244
This example illustrates reference voltage generation and signal generator implementation using Digital to Analog Converter (DAC) peripheral of 8-Bit PIC MCU.
0 commit comments