Author |
Message |
Topic: Speed up a loop driving a stepper motor |
julienm
Replies: 9
Views: 20714
|
Forum: General CCS C Discussion Posted: Fri Oct 21, 2022 1:44 am Subject: Speed up a loop driving a stepper motor |
I understand I really need a training on PIC programmation. Because the moment you mention using timers, I'm scared.
Also right now the 4 PWM output are used to drive some LEDs.
Long story short, ... |
Topic: Speed up a loop driving a stepper motor |
julienm
Replies: 9
Views: 20714
|
Forum: General CCS C Discussion Posted: Thu Oct 20, 2022 11:56 pm Subject: Speed up a loop driving a stepper motor |
Well thanks for the comments but
- I have to work with this hardware, redesigning is not possible
- would PWM allow me to vary linearly vary the frequency at high speed? I don't want a stable pwm |
Topic: Speed up a loop driving a stepper motor |
julienm
Replies: 9
Views: 20714
|
Forum: General CCS C Discussion Posted: Thu Oct 20, 2022 3:36 pm Subject: Speed up a loop driving a stepper motor |
THe PIC runs at 20MHz.
I want to program a trapezoid stepper command (with customisable ramp up and ramp down) that can run on 2 different motors (hence the original variable for the PIN). |
Topic: Speed up a loop driving a stepper motor |
julienm
Replies: 9
Views: 20714
|
Forum: General CCS C Discussion Posted: Thu Oct 20, 2022 7:47 am Subject: Speed up a loop driving a stepper motor |
Hello, I'm trying to speed up a loop in charge of generating pulses to a stepper motor. The goal was to achieve 6ms for one loop on a 18F6722.
I started from this
int32 step;
int16 ramp;
int16 del ... |
Topic: Homemade string compare randomly fails [Solved] |
julienm
Replies: 37
Views: 83162
|
Forum: General CCS C Discussion Posted: Thu Jun 30, 2022 11:49 am Subject: Homemade string compare randomly fails [Solved] |
End of the story: I received a new batch of PICs, replaced them and the failure is gone! Looks like brokers got us a batch of bad pics |
Topic: Homemade string compare randomly fails [Solved] |
julienm
Replies: 37
Views: 83162
|
Forum: General CCS C Discussion Posted: Sun Jun 05, 2022 2:01 am Subject: Homemade string compare randomly fails [Solved] |
@PCM first thing I did was to update to compiler v5.109, but I have not tested disabling optimisations yet, that was on my todo list
@Prince: although the issue occurrence is random, it is indeed alm ... |
Topic: Homemade string compare randomly fails [Solved] |
julienm
Replies: 37
Views: 83162
|
Forum: General CCS C Discussion Posted: Thu Jun 02, 2022 8:49 am Subject: Homemade string compare randomly fails [Solved] |
@PCM: I'm testing your program right now, no problem so far (but since no RDA interrupts are generated, I don't expect the bug to occur)
I confirm our 5Vdc voltage is stable, the 4 pins are connect ... |
Topic: Homemade string compare randomly fails [Solved] |
julienm
Replies: 37
Views: 83162
|
Forum: General CCS C Discussion Posted: Wed Jun 01, 2022 3:20 pm Subject: Homemade string compare randomly fails [Solved] |
Over RS232 back to the PC.
Maybe I should have explain that before the bug occurs I have 3000 working cycles, and for each cycle maybe 30 printf that do work properly. |
Topic: Homemade string compare randomly fails [Solved] |
julienm
Replies: 37
Views: 83162
|
Forum: General CCS C Discussion Posted: Wed Jun 01, 2022 1:41 pm Subject: Homemade string compare randomly fails [Solved] |
I've ran a new test that printed only 2 characters in order to avoid adding enough delay to prevent the bug to appear:
BOOLEAN startsWith(char *txt, char *toCompare)
{
int8 size = ... |
Topic: Homemade string compare randomly fails [Solved] |
julienm
Replies: 37
Views: 83162
|
Forum: General CCS C Discussion Posted: Thu May 26, 2022 3:33 am Subject: Homemade string compare randomly fails [Solved] |
@PCM Programmer: I cannot carefully check that before next Monday
On the other hand, I confirm that with the additional printf, the bug won't appear within 15k cycles when it is usually guaranteed ... |
Topic: Homemade string compare randomly fails [Solved] |
julienm
Replies: 37
Views: 83162
|
Forum: General CCS C Discussion Posted: Wed May 25, 2022 12:32 pm Subject: Homemade string compare randomly fails [Solved] |
Ok, so I've tested a few modifications in the past days.
So far nothing prevented the bug to appear:
- changing int16 for int8 in startsWith()
- replacing getc() with fgetc(UART1)
- removing #inli ... |
Topic: Homemade string compare randomly fails [Solved] |
julienm
Replies: 37
Views: 83162
|
Forum: General CCS C Discussion Posted: Sat May 21, 2022 1:34 pm Subject: Homemade string compare randomly fails [Solved] |
Ok, I'll try to print the buffer content when the comparison returns TRUE (my problem is that on the PC side, the software will be spammed with messages, and not only I need to handle this, but it cou ... |
Topic: Homemade string compare randomly fails [Solved] |
julienm
Replies: 37
Views: 83162
|
Forum: General CCS C Discussion Posted: Fri May 20, 2022 2:55 pm Subject: Homemade string compare randomly fails [Solved] |
Thanks to all who took time to answer!
Ok so you think the startsWith() function cannot get corrupted by an interrupt?
#use rs232(stream = UART1, baud = baudrate, bits = 8, parity = N, xmit ... |
Topic: Homemade string compare randomly fails [Solved] |
julienm
Replies: 37
Views: 83162
|
Forum: General CCS C Discussion Posted: Fri May 20, 2022 3:04 am Subject: Homemade string compare randomly fails [Solved] |
My PIC is a 18F6722
Regarding a reproducer it is going to be quite difficult, because the PC side sending commands over RS232 is needed.
However I'm almost sure that it has to do with the #INT_RDA ... |
Topic: Homemade string compare randomly fails [Solved] |
julienm
Replies: 37
Views: 83162
|
Forum: General CCS C Discussion Posted: Thu May 19, 2022 1:34 pm Subject: Homemade string compare randomly fails [Solved] |
I'm chasing a bug that appears sporadically after hours of operations: some portion of code gets called when it should not.
Using the ICD debugger I was able to narrow it down to a section processi ... |
|