DF Player Mini mp3 how drove it by pic16f88 by UART APPEND

General discussion on mikroBasic PRO for PIC.
Post Reply
Author
Message
leo73
Posts: 252
Joined: 09 Jan 2014 15:45

DF Player Mini mp3 how drove it by pic16f88 by UART APPEND

#1 Post by leo73 » 07 Feb 2016 20:11

Hello to MikroElectronic People
I rewrote together XmaxPako the WTV020-sd ad4 player module library in basic code in Lib Stock..........
Now I bought a DF Player Mini mp3 module but i have more problems to rewrite the pic basic driver code for this new Mp3 audio module.
There's a Arduino C Code in a web yet but not in Microbasic or MikroC code.
My Idea is Connect this module to the 16f88 pic using RB5 and RB2 as Pin UART Communication and Rewrite the Cod Basic and C Pic.

In Attacment there's DF Player Mini mp3 module documentation and some example about Arduino Code library, if someone read this post could me reply and help me? :wink:
Thank you so much.


my code is this but not work:

' ****************************************************************************
' UART pins is RB5 and RB2
'--> RB5/SS/TX/CK
'--> RB2/SDO/RX/DT
'-------------------------- SOME COMMAND EXAMPLES ----------------------------
'example 7E FF 06 03 00 00 01 FF D5 EF --> Play First song 001.mp3
'Send_Buffer[3]=0x03 Send_Buffer[6]=0x01
'example 7E FF 06 06 00 00 0F FF D5 EF --> set Volume to 15
'
' For example, select the first song played, serial transmission section: 7E FF 06 03 00 00 01 FF E6 EF(last FF and E6 isn't correct, some people suppose !!!! i don't know)
become >>> 7E FF 06 03 00 00 01 FE F7 EF
' 7E --- START command
' FF --- Version Information
' 06 --- Data length (not including parity)
' 03 --- Representative No.
' 00 --- If need to acknowledge [0x01: need answering, 0x00: do not need to return the response]
' 00 --- Tracks high byte [DH]
' 01 --- Tracks low byte [DL], represented here is the first song played
' FF --- Checksum high byte
' E6 --- Checksum low byte
' EF --- End Command
'
' For selections, if choose the 100th song, first convert 100 to hexadecimal, the default is double-byte, it is
' 0x0064.
' DH = 0x00; DL = 0x64 ----Command----> 7E FF 06 03 00 00 64 FF D5 EF
' If you choose to play the 1000th, first convert 1000 to hexadecimal, the default is double-byte, it is 0x03E8
' DH = 0x03; DL = 0xE8 ----Command----> 7E FF 06 03 00 03 E8 FF D5 EF
'
' For example, specify the volume to 15, serial port to send commands: ----- Command ------> 7E FF 06 06 00 00 0F FF D5 EF
' DH = 0x00; DL = 0x0F, 15 is converted to hexadecimal 0x000F, can refer to the instructions of playing, track section.
'
' Specify playback device –TF Card -----Command----> 7E FF 06 09 00 00 02 xx xx EF
' Specify folder 01 of 001.mp3 -----Command----> 7E FF 06 0F 00 01 01 xx xx EF
' Specify folder 11 of 100.mp3 -----Command----> 7E FF 06 0F 00 0B 64 xx xx EF
'
'*****************************************************************************

program DFPlayerMiniMp3Serial

' Declarations section
dim Send_Buffer as byte[10]
'=============================================================================
sub procedure Select_Ts_Source
dim i as byte
' ARRAY COMMAND to Set source from TF memory
Send_Buffer[0] = 0x7E
Send_Buffer[1] = 0xFF
Send_Buffer[2] = 0x06
Send_Buffer[3] = 0x09
Send_Buffer[4] = 0x00
Send_Buffer[5] = 0x00
Send_Buffer[6] = 0x02
Send_Buffer[7] = 0xFF
Send_Buffer[8] = 0xE6
Send_Buffer[9] = 0xEF

for i=0 to 9
UART1_Write(Send_Buffer)
next i

delay_ms(500) ' wait some second before send the command
end sub

sub procedure Play_first_song()
dim i as byte
' ARRAY COMMAND to set the first Song.mp3
Send_Buffer[0] = 0x7E
Send_Buffer[1] = 0xFF
Send_Buffer[2] = 0x06
Send_Buffer[3] = 0x03
Send_Buffer[4] = 0x00
Send_Buffer[5] = 0x00
Send_Buffer[6] = 0x01
Send_Buffer[7] = 0xFF
Send_Buffer[8] = 0xD5
Send_Buffer[9] = 0xEF

delay_ms(5000) ' wait some second before send the command

for i=0 to 9
UART1_Write(Send_Buffer)
next i
end sub

main:
' Main program
delay_ms(500)
UART1_Init(9200) ' Initialize USART
Select_Ts_Source
Play_first_song
end.

===================================================================================
====================== ALTERNATIVE PROGRAM =============================================
===================================================================================
***************** The program don't work *******************

program DFPlayerMiniMp3Serial

' Declarations section
dim Send_Buffer as byte[10]

sub procedure Select_Ts_Source
dim i as byte
' ARRAY COMMAND Select TS card
Send_Buffer[0] = 0x7E
Send_Buffer[1] = 0xFF
Send_Buffer[2] = 0x06
Send_Buffer[3] = 0x09
Send_Buffer[4] = 0x00
Send_Buffer[5] = 0x00
Send_Buffer[6] = 0x02
Send_Buffer[7] = 0xFF
Send_Buffer[8] = 0xE6
Send_Buffer[9] = 0xEF

for i=0 to 9
Soft_UART_Write(Send_Buffer)
next i

delay_ms(500) ' wait some second before send the command
end sub

sub procedure Play_first_song()
dim i as byte
' ARRAY COMMAND to play first Song
Send_Buffer[0] = 0x7E
Send_Buffer[1] = 0xFF
Send_Buffer[2] = 0x06
Send_Buffer[3] = 0x03
Send_Buffer[4] = 0x00
Send_Buffer[5] = 0x00
Send_Buffer[6] = 0x01
Send_Buffer[7] = 0xFF
Send_Buffer[8] = 0xE6
Send_Buffer[9] = 0xEF

for i=0 to 9
Soft_UART_Write(Send_Buffer)
next i
delay_ms(500) ' wait some second before send the command
end sub

main:
' Main program
delay_ms(500) ' wait some second before send the command
Soft_UART_Init(PORTB, 2, 5, 9600, 1) ' using this istruction i can decide what pin will be Tx and RX, the speed and signal level trasmition
Select_Ts_Source
Play_first_song
end.
Attachments
Schema Elettrico sistema df Player e 16f88.jpg
Schema Elettrico sistema df Player e 16f88.jpg (123.53 KiB) Viewed 13962 times
DFPlayer_Mini_Mp3 Documents.zip
(2.71 MiB) Downloaded 783 times
Last edited by leo73 on 08 Nov 2016 12:13, edited 2 times in total.

craftsman42
Posts: 15
Joined: 21 Aug 2015 14:43

Re: DF Player Mini mp3 how drove it by pic16f88 by UART Help

#2 Post by craftsman42 » 04 Nov 2016 13:21

did it work ?

leo73
Posts: 252
Joined: 09 Jan 2014 15:45

Re: DF Player Mini mp3 how drove it by pic16f88 by UART Help

#3 Post by leo73 » 04 Nov 2016 14:11

Yes it work, search the code in libstok site too.

craftsman42
Posts: 15
Joined: 21 Aug 2015 14:43

Re: DF Player Mini mp3 how drove it by pic16f88 by UART Help

#4 Post by craftsman42 » 04 Nov 2016 14:45

ı cant find libstock about df mını player can you send me link?

craftsman42
Posts: 15
Joined: 21 Aug 2015 14:43

Re: DF Player Mini mp3 how drove it by pic16f88 by UART Help

#5 Post by craftsman42 » 04 Nov 2016 15:37

by the way ı was find but it is not df mını player

leo73
Posts: 252
Joined: 09 Jan 2014 15:45

Re: DF Player Mini mp3 how drove it by pic16f88 by UART Help

#6 Post by leo73 » 05 Nov 2016 19:57

Haaa no no :oops: , i'm sorry the code not work, i'm seaching to write a right code for this device !!!!
did you have some idea about this ??
It's passed many time about this problem, if you want i could search some arduino code and traslate it with you !!!

leo73
Posts: 252
Joined: 09 Jan 2014 15:45

Re: DF Player Mini mp3 how drove it by pic16f88 by UART Help

#7 Post by leo73 » 06 Nov 2016 09:46

Or if you not need HI-FI application you can take this library:

https://libstock.mikroe.com/projects/vi ... 7-feb-2016

This is a drive for wtv020-sd device , you can play .ad4 audio file, it used for robots.

craftsman42
Posts: 15
Joined: 21 Aug 2015 14:43

Re: DF Player Mini mp3 how drove it by pic16f88 by UART Help

#8 Post by craftsman42 » 07 Nov 2016 06:47

thanks a lot but ı cant to again have ı use max232? ıf honestly ı want to write library for df mini player on micro c . but ı cant change arduıno library to micro c
can you guide for me ?

leo73
Posts: 252
Joined: 09 Jan 2014 15:45

Re: DF Player Mini mp3 how drove it by pic16f88 by UART Help

#9 Post by leo73 » 08 Nov 2016 10:48

Hi craftsman42
I''m tryed to traslate code another time (from arduino c) but the code don't work, we need some-one else us in this forum.
I put in attachment My code and Arduino so some-one can compare and understand were is the problem.
For a moment you can print the code below and compare, after see me your thinking !!!!!
Attachments
DF Player Mini mp3 Commands.pdf
DF Player Mini mp3 Commands
(920.8 KiB) Downloaded 851 times
DFPlayer-Mini-mp3 CPP.pdf
Arduino df-player library C language
(457.84 KiB) Downloaded 573 times
DFPlayer_Mini_Mp3Ver1.zip
Mikro C code DF-Player audio mp3 device.
(30.03 KiB) Downloaded 552 times

xvinny
Posts: 7
Joined: 20 Sep 2016 16:02

Re: DF Player Mini mp3 how drove it by pic16f88 by UART APPE

#10 Post by xvinny » 26 May 2017 16:03

The pdf manual contains a lot of errors and things missing. :evil:
I'm writting a solution for PIC18F46K22, and when I finish, I`m gonna post here. :D

xvinny
Posts: 7
Joined: 20 Sep 2016 16:02

Re: DF Player Mini mp3 how drove it by pic16f88 by UART APPE

#11 Post by xvinny » 26 May 2017 18:17

I'm using DFPlayer with a PIC18F46K22.
The first thing that I discovered was that its manual has a lot of errors.
Second is that the application circuit in the manual has some problems like potential difference (on GND).
I'll post some tips and tricks using this audio module later.

leo73
Posts: 252
Joined: 09 Jan 2014 15:45

Re: DF Player Mini mp3 how drove it by pic16f88 by UART APPE

#12 Post by leo73 » 29 May 2017 15:57

Ok Xvinny we'll wait :)

leo73
Posts: 252
Joined: 09 Jan 2014 15:45

Re: DF Player Mini mp3 how drove it by pic16f88 by UART APPE

#13 Post by leo73 » 07 Jun 2017 22:02

Hello Xvinny,
What about the manuals i understood the problem, because today the manuals is wrote quickly and there's a lot of mistakes and no examples. This is one of reason because is hard to understand how program or use the electronic chips.
:(

xvinny
Posts: 7
Joined: 20 Sep 2016 16:02

Re: DF Player Mini mp3 how drove it by pic16f88 by UART APPE

#14 Post by xvinny » 20 Jun 2017 19:37

leo73 wrote:Hello Xvinny,
What about the manuals i understood the problem, because today the manuals is wrote quickly and there's a lot of mistakes and no examples. This is one of reason because is hard to understand how program or use the electronic chips.
:(
viewtopic.php?f=88&t=70332

Davros
Posts: 16
Joined: 31 Dec 2010 23:08

Re: DF Player Mini mp3 how drove it by pic16f88 by UART APPE

#15 Post by Davros » 19 Sep 2019 03:54

Thanks to everyone for the useful info. I'm also running a PIC16F88 controlling a DFPlyer mini.

Post Reply

Return to “mikroBasic PRO for PIC General”