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
Copy file name to clipboardExpand all lines: docs/arduino-deviations.rst
+5-20Lines changed: 5 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,28 +68,13 @@ must be Slave mode configuration and sets the I2C configuration differently.
68
68
Tone
69
69
++++
70
70
71
-
Number of Tone pins is determined by pins_arduino.h define NUM_TONE_PINS.
72
-
This allows for use in other modules and for variations between boards as
73
-
>100MHz boards can obviously handle more tone pins.
71
+
The tone() function in XMC-for-Arduino core uses the PWM(pulse Width Modulation) peripheral to generate square wave signals at specific frequencies.
72
+
Number of tone pins is determined by PWM -capable pins on XMC Device.
74
73
75
-
The default for XMC1xxx is 4 with a change XMC4xxxx should be 16
76
-
77
-
Tone has frequency range of maximum = 500 Hz minimum = 1 Hz
78
-
79
-
This is due to the fact that the tone frequency is software derived from
80
-
the Systick handler, Systick has a time period of 1 ms. At maximum each
81
-
handler event for Systick toggles a GPIO pin, so at minimum period of 1 ms
82
-
the output is toggled, so TWO events produce one square wave cycle, therefore
83
-
the maximum output frequency is 500Hz.
84
-
85
-
The minimum is due to the fact that tone function only accepts an unsigned
86
-
integer (32 bit) for the frequency, so the minimum usable frequency is 1.
87
-
88
-
Standard Arduino boards use hardware timers (the few that are available) to
89
-
generate tones and at least one timer can interfere with other functions.
90
-
91
-
However this does mean you can have more tone pins, just much lower frequency range.
74
+
Do not call pinMode() on the pin prior to using the tone() function. The tone() function automatically configures the pin for output modes and sets it up internally.
75
+
Calling pinMode() beforehand may result in unexpected behavior or conflicts with PWM peripheral.
92
76
77
+
Maximum duration of tone can be set upto 90 seconds.
0 commit comments