In one of the other threads here we discussed using OutputCapture(). I was looking at the descriptions of the two related functions. One of the differences between OutputCapture() and OutputCaptureEx() is being able to specify the output pin.
But then in the description of OutputCaptureEx() it gives a table showing valid pins for the different ZX versions. Later in the description it discusses the use of a general I/O pin as the output pin.
I presume that the specified pins in the table applies to the default pin used by OutputCapture(), and any valid pin can be used for OutputCaptureEx() . If so, it might be clearer to move that table to the OutputCapture() description.
Is it possible to use Zero as the pin for OutputCaptureEx(), and that way no pin is actually affected, but the timing is preserved?
-Tony
OutputCapture vs OutputCaptureEx
Re: OutputCapture vs OutputCaptureEx
As noted, OutputCapture() generates output on a specific pin and OutputCaptureEx() can generate the pulse train on any I/O pin. However, with OutputCaptureEx(), waveform generation on certain I/O pins (those noted in the table captioned "Hardware Output Capture Pin") will be more precise because built-in hardware capabilities are used.spamiam wrote:I presume that the specified pins in the table applies to the default pin used by OutputCapture(), and any valid pin can be used for OutputCaptureEx().
No. However, desired effect could probably be achieved using Pause().spamiam wrote:Is it possible to use Zero as the pin for OutputCaptureEx(), and that way no pin is actually affected, but the timing is preserved?
- Don Kinzer
Re: OutputCapture vs OutputCaptureEx
I looked at the description of Pause(). I had never read that one before It saysdkinzer wrote:However, desired effect could probably be achieved using Pause().
In the case of an 8 channel PWM routine running as its own task. During the dead time between the 50 Hz PWM pulses, one might WANT to allow task switching, so the Pause() command might not be optimal even though it gives a more precise timing than Sleep() or Delay(). I would think that the accuracy of Sleep() and Delay() [what, about +/- 1mS?] are accurate enough for servos and will cooperate better with other tasks.This routine should be used instead of Sleep() or Delay() when higher resolution timing is required or
you don’t want a task switch to occur
-Tony