Hi All,
I've got a board with four stepper motors that I'm driving with the software PWM code as given in the GCB command list. The equation for the pulse rate calculares out as 13.6uS per cycle (20 MHz clock and no delay), but I see about 1.3mS cycle time pulses on the output. Is the cycle time equation incorrect, or am I missing some important setting?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Anobium, Here's where I set up and then test the PWM output. I need 4 channels, but I use only one for the test. The chip is running at 20MHz with a resonator (checked) and I've tried various numbers of cycles, but always get the 1.3mS cycle time.
The calcs do not work based on the formula shown in the Help. in the modeller - I have shown the PWMOUT() command and the number of instructions using this chip. I have changed the formula as the delay is a function of the number of channels used ( but the value is 0 when no delay is set).
The pulse width ( 7.6ms) is the same using the legacy FOR-NEXT as this could have been the issue ( it is not as this new for-next is optimised).
So, play wit the modeller. See if you can make work and make sense! Once we have a model then I think it will answer the question about the formula being correct or not.
Try to figure this out in the modeller.
Last edit: Anobium 2024-02-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi All,
I've got a board with four stepper motors that I'm driving with the software PWM code as given in the GCB command list. The equation for the pulse rate calculares out as 13.6uS per cycle (20 MHz clock and no delay), but I see about 1.3mS cycle time pulses on the output. Is the cycle time equation incorrect, or am I missing some important setting?
Not sure.
Can you post a small section of the program to show the issue?
Hi Anobium, Here's where I set up and then test the PWM output. I need 4 channels, but I use only one for the test. The chip is running at 20MHz with a resonator (checked) and I've tried various numbers of cycles, but always get the 1.3mS cycle time.
I get a width of 7.6ms. So, I cannot explain.
My full program.
I have built a modeller. See https://1drv.ms/x/s!Ase-PX_n_4cvhNwqbKN5gGktDH_iNQ?e=fVWlwe The yellow cells are the named cells used in the calculation.
The calcs do not work based on the formula shown in the Help. in the modeller - I have shown the PWMOUT() command and the number of instructions using this chip. I have changed the formula as the delay is a function of the number of channels used ( but the value is 0 when no delay is set).
The pulse width ( 7.6ms) is the same using the legacy FOR-NEXT as this could have been the issue ( it is not as this new for-next is optimised).
So, play wit the modeller. See if you can make work and make sense! Once we have a model then I think it will answer the question about the formula being correct or not.
Try to figure this out in the modeller.
Last edit: Anobium 2024-02-14