I'm quite new in microcontroller programming and i would like to ask you some advices or suggestions for my problem.
I wrote a program that samples and adc at fixed frequency (40kHz) using a timer interrupt and makes some calculations between two samples. This part works nice.
Following, i need a slow task that sends a value on the serial each second in order to monitor this value on a pc. I've implemented this in the main loop, counting up to 40000 and executing a serial.print (one serial.print each 40000 samples).
The problem is that at the moment that the serial.print is executed, it seems to use a lot of calculation time and the main task that samples at fixed frequency lost several samples. It's like when the serial is used, the timer interrupt used to adc sample is not more high priority.
Could you please give me some advices or any idea on how i can have a slow serial communication not impacting my high priority activity? Maybe you know to do it somehow using low level code and not using serial arduino library.
I've read that it is faisable maybe with an rtos but it seems still not possible for arduino due. Moreover, i'm not a programmer and i have any knowledge in os.
Thank you very much in advance.
Have a nice day.