- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
i am trying to build an encoder signal generator, with A-, B-, and Z- signal.
The square wave frequency of the the A-, B- signals should be adjustable while running the signal generator (max. 1MHz).
My problem is to create square waves, that are shifted 90° degrees to each other.
I tried it with two PWM UDB blocks:
PWM block 1: I configured a dual Output PWM, where the first output is a 50% duty cycle PWM (A-Signal) and the second output a 75% duty cycle PWM.
PWM block 2: Configured as 50% duty cycle PWM (B-Signal). The start trigger input of PWM Block 2 is connected to the second output of PWM block 1 (75% duty cycle).
When i measure the phase shift between A- and B- Signal it will be near 90° (frequencies lower than 100kHz), but when i increase the frequency (1MHz) the phase shift between A- and B- signal drifts away to 100°.
By the way:
i read in the values of a qudrature encoder, these values are used to set the periods of the PWM blocks, so i can adjust the PWM frequencies.
For example:
quadrature encoder value: 32
PWM block 1 period: 32
PWM block 1 compare value 1: 16
PWM block 1 compare value 2: 24
PWM block 2 period: 32
PWM block 2 compare value 1: 16
Does anyone know why the phase shift between A- and B-signal increases with higher frequencies?
Is there a better way to implement a encoder signal generator, maybe without PWM?
Sincerly,
manuel
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
manuel, try DDS24 signal generator to make arbitrary frequency and phase:
Alternative simple method to produce quadrature signals is here: https://youtu.be/OL52f-k3iIE- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
manuel, try DDS24 signal generator to make arbitrary frequency and phase:
Alternative simple method to produce quadrature signals is here: https://youtu.be/OL52f-k3iIE- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I used a single PWM block with double output, and adjusted the compare to "Equal" for both. The invert was done by two additional flip-flow blocks. See screenshot.
Regards,
Matija