We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: Dick Berry
Last Updated: 2016-02-18
Package Version: 1.0.0.0
Example: 1.0.0.0
Category: Audio & Speech
Downloaded: 756 times
Followed by: 1 user
License: MIT license
This is a real time state machine that plays MP-3 files from the SD Card using the Smart-MP3 board. Now I can service the GLCD and Touch Panel while playing Audio Files. I've included the five songs I tested with. Just copy them to your SD Card.
Do you want to subscribe in order to receive notifications regarding "Interrupt Driven State Machine MP3 Player for Smart MP3-Board" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Interrupt Driven State Machine MP3 Player for Smart MP3-Board" changes.
Do you want to report abuse regarding "Interrupt Driven State Machine MP3 Player for Smart MP3-Board".
DOWNLOAD LINK | RELATED COMPILER | CONTAINS |
---|---|---|
1405824532_interrupt_driven_mikrobasic_pic.zip [14.13MB] | mikroBasic PRO for PIC |
|
I wanted audio in my Camper Light Project but didn't want to give up Touch Panel functions while playing a MP3 file. So I modified the Example for the Smart-MP3 board to make it a State Machine rune during a Timer 0 Interrupt. The Interrupt comes at 250 ms intervals and the state machine uses about 100 ms of that time, so I got better than 50% of the CPU time back for GLCD and TP processing. I needed to up the processor to a 18F46K22 for this project because the MP3 and GLCD use a lot of memory. I also run it at 64 Mhz to keep the eight bit controller from dragging the screens out. A shout out to MikroElektronica for the example program which spelled out the requirements for the VS1053b. It will run at 32 Mhz on a 18F45K22 but the music will be choppy. You'll recognize it but don't try to dance ;-)
I'll be using this in my Camper Light Project along with a Speak-Up board.
I'll attach a picture of the scope showing timing, look for the PortA.0 twiddleing in the Interrupt routine to make sence of it.
Thanks for looking
Dick
This is the start to finish timing in the Interrupt routine.
View full imageI intregrated this into my Camper Light Project and got many Re-Entry conflicts. They were unresolvable because they were calls in the Libraries. A serch here led me to the Legacy Mcm Libraries. After installing them and changeing the calls in my SD Card access software all was well. Thanks again to MikroElektronica for leaving them on LibStock. In addition to working fine they use less resources. Thank goodness I only needed to read from the card. Dick
While Normalizing the Volume levels of the MP3 files I tried an experiment and re-sampled them at 8000bps. The music wasn't any different but the time in the Interrupt routine went from100ms to 20ms to 30ms. This meant I could change the Interrupt timing to 500ms. Now I'm spending only 4.45% of the time in the MP3 server. The Touch Panel and GLCD is much more responsive. Here is a picture from my new OWON VDS3102 "O" Scope. If you can afford one it's really worth the money.
Thanks Dick
After re-sampling the MP3 files at 8000bps. Explanation in the picture lower right corner.
View full image