-not sure if bug or feature request, i remeber that v5 had some kind of warnings about multi timer declarations?-
Flowcode doesn't warn you in any way about using same timer as one component macro...
I had to update my older code that uses CAN bus to control stuff, to send some messages about its state to RS232. Had to do very rough debug until i found that my code didnt like using timer2 and RS232 component at same time.
There should be a warning when enabling timer interrupt in code to call user macro, that *this(RS232)* component already is using it. Compiler messages or flowcode itself?
Here is some gibberish i got from serial when i was using TMR2...
and the result when i did change user interrupt to the TMR 6...
The code that im using to create this "problem" is not shareable atm.
btw: sourceboost 7.30 has improved the speed to 3 times more faster if checking their site...
Flowcode components and user interrupts, add a warning?
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Flowcode components and user interrupts, add a warning?
Hello,
I have started to add more information when we are using timers behind the scenes via the properties, no warning as such though so this would be a nice addition.
The RS232 on it's own shouldn't have any reference to any times but the PWM and servo motor etc do etc.
Can you post your program to me in a PM so I can have a look.
I have started to add more information when we are using timers behind the scenes via the properties, no warning as such though so this would be a nice addition.
The RS232 on it's own shouldn't have any reference to any times but the PWM and servo motor etc do etc.
Can you post your program to me in a PM so I can have a look.
I tested it here and the speed increase was nothing like 3x, maybe 1.2x faster on a simple program. However we are not using the latest version because I found it could not compile the USB components any more and wasn't generating error messages.btw: sourceboost 7.30 has improved the speed to 3 times more faster if checking their site...
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Flowcode components and user interrupts, add a warning?
Thanks for the file.
I can see you are enabling PWM after enabling the timer and PWM is currently set to use Timer2. However I don't see why the serial comms would be messed up. I'll continue having a look through and see if I can spot anything else.
Edit...
Aha, Your using a software UART so interrupts would effect the timings when sending out data. The more often the interrupt the more likely there will be an interrupt while your sending out data and therefore corruption. As you were using Timer2 as an interrupt and then enabling PWM the properties for timer 2 are shifted to the PWM settings to give you approx 4800Hz interrupt which significantly raises the chance of error.
I hope this explains things a bit better. I will try and see if there is a way to try and make this type of problem more obvious.
I can see you are enabling PWM after enabling the timer and PWM is currently set to use Timer2. However I don't see why the serial comms would be messed up. I'll continue having a look through and see if I can spot anything else.
Edit...
Aha, Your using a software UART so interrupts would effect the timings when sending out data. The more often the interrupt the more likely there will be an interrupt while your sending out data and therefore corruption. As you were using Timer2 as an interrupt and then enabling PWM the properties for timer 2 are shifted to the PWM settings to give you approx 4800Hz interrupt which significantly raises the chance of error.
I hope this explains things a bit better. I will try and see if there is a way to try and make this type of problem more obvious.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 444
- Joined: Tue Apr 15, 2014 4:19 pm
- Location: Kajaani, Finland
- Has thanked: 345 times
- Been thanked: 227 times
- Contact:
Re: Flowcode components and user interrupts, add a warning?
Thank you and hope you can make it much easier to detect!
Ill just keep the good work up!