Hello to all!
In a FC7 code for a MCU, sometimes there is a need to have an accurate digital pulse(in the area of microseconds) in an output pin with defined duty cycle.How can I realize that without use delay command, to avoid command execution time delays? Also how can I use a part of code as subrutine that I can call many times in a code loop? In my case , I would like to scan 30 input pins of MCU one after one (with defined interval time) for HIGH or LOW , and have at the same time that input states to 1 output pin as serial pulses with as soon as possible lower delay time. Thanks.
PULSE IN A SUBRUTINE WITH FC7
Moderator: Benj
-
- Posts: 115
- Joined: Wed Aug 03, 2016 10:45 pm
- Has thanked: 24 times
- Been thanked: 11 times
- Contact:
- 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: PULSE IN A SUBRUTINE WITH FC7
Hello,
Have you tried using a timer interrupt? Sounds to me like it may be the best way to do it.
The software based PWM example at the link below may be useful.
https://www.matrixtsl.com/wikiv7/index. ... Interrupts
Have you tried using a timer interrupt? Sounds to me like it may be the best way to do it.
The software based PWM example at the link below may be useful.
https://www.matrixtsl.com/wikiv7/index. ... Interrupts
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: 115
- Joined: Wed Aug 03, 2016 10:45 pm
- Has thanked: 24 times
- Been thanked: 11 times
- Contact:
Re: PULSE IN A SUBRUTINE WITH FC7
I made a test with IOC-Multiple pins and INT-Single pin interrupts, it helps me enough.Thanks Ben!