TOP Contributors

  1. MIKROE (2752 codes)
  2. Alcides Ramos (372 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139073 times)
  2. FAT32 Library (71595 times)
  3. Network Ethernet Library (56989 times)
  4. USB Device Library (47334 times)
  5. Network WiFi Library (43006 times)
  6. FT800 Library (42297 times)
  7. GSM click (29777 times)
  8. mikroSDK (27894 times)
  9. PID Library (26859 times)
  10. microSD click (26130 times)
Libstock prefers package manager

Package Manager

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]

< Back
Example

Interrupt Driven State Machine MP3 Player for Smart MP3-Board

Rating:

0

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.

No Abuse Reported

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".

  • Information
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

Example Blog

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

Picture of the &quot;O&quot; Scope showing timing

Picture of the "O" Scope showing timing

This is the start to finish timing in the Interrupt routine.

View full image

I 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

Scop Picture of Interrupt Timing # 2

Scop Picture of Interrupt Timing # 2

After re-sampling the MP3 files at 8000bps. Explanation in the picture lower right corner.

View full image

ALSO FROM THIS AUTHOR

Readin the AM2303 Temp/Humidity Sensor with Basic

0

I'v seen a several C examples for reading these sensors but haven't found one in Basic. So here is the Source file for a Module in my RV Monitor Project for Handleing the AM2303. See the RV Monitor Project for a detailed Blog.

[Learn More]

Sorting out the Logarithmic Scale for the Volume Control for SMART_MP3 Click

0

Here is a spreadsheet with the volume control numbers for a 0 to 11 scale translated to the 0 - 255 controls of the Smart_MP3. It's a simple LOG10 scale but that approximates the true LOG scale close enough.

[Learn More]

Displaying a 12 VDC Battery Voltage on the LCD of a Easypic V7

5

By scaling the +9.4 Volt to 14.5 Volt battery voltage with a Zener Diode and a 10K resister you can display the Battery voltage with two decimal points resolution on the Two Line LCD of a EasyPic V7 Development board using the RA1 AtoD input of a PIC16F76 Microcontroller. Version 2 Uploaded on 2013/05/25

[Learn More]