32 Bit Timer45 - Working Code

Discussion on projects that are created by users and posted on mikroElektronika website.
Post Reply
Author
Message
wvlegge@gmail.com
Posts: 4
Joined: 22 Jul 2023 09:37

32 Bit Timer45 - Working Code

#1 Post by wvlegge@gmail.com » 14 Apr 2024 05:07

Working Code. Aim is to generate a tone burst without a blocking function.
The function Sound_Play() in the Mikro library works fine but the program waits/blocks until the tone is over.
I needed to do 'other stuff' and not wait around for the tone to complete.
Read up about interrupts - and you cannot pass a value to an interrupt routine.
But, it is possible to alter a value in the interrupt routine when it executes.
Attached code:
1. Uses PWM1 to make a 3.8kHz tone (good frequency for the on-board buzzer).
2. Turns the tone on/off using an interrupt on timer45 (32 bit times for long tone bursts).
3. The preload for timer4 and timer5 is changed during the interrupt.
4. To test the code, PR4 and PR5 are generated by ADC1 Ch0;
My setup is: EasyPIC Fusionv7 board with PIC32MX795F512L at 80MHz.

Regards Bill Legge in Australia
Attachments
Oscillocsope Snap 01.zip
(505.21 KiB) Downloaded 5 times
Main.zip
(2.52 KiB) Downloaded 3 times
Resources_Tahoma_26X29.zip
(4.19 KiB) Downloaded 5 times

Post Reply

Return to “User Projects”