VMusic2 MP3 Player

Schematic

PCB

Control the VMusic2 Player

This program will control a VMusic2 player from output pin B.6 in reponse to a 'start button' (input pin C.0) and a 'stop button' (input pin C.1).

Code Example:
init:	high b.6				; initialise for t9600 protocol	
	pause 500				; allow 500ms to wake-up

main:	
	if pinc.0 = 1 then do_play		; play switch pushed
	if pinc.1 = 1 then do_stop		; stop switch pushed
	goto main

do_play:
	pause 10				; short debounce time
	if pinc.0 = 1 then do_play		; wait until switch released
	serout b.6,t9600,("vpf 1.mp3",CR)	; send play 1.mp3
	goto main
	
do_stop:
	pause 10				; short debounce time
	if pinc.1 = 1 then do_stop		; wait until switch released
	serout b.6,t9600,("vst",CR)		; send stop command
	goto main
Copy Code Submit an Example

VMusic2 Commands

The following is a list of all commands available for the VMusic2.

Code Example:
Music Playing Commands

; Play File

  serout pin, t9600, ( "VPF", " ", "filename.mp3", CR )

; Pause playback

  serout pin, t9600, ( "VP", CR )

; Stop

  serout pin, t9600, ( "VST", CR )

; Skip forward one track

  serout pin, t9600, ( "VSF", CR )

; Skip back one track

  serout pin, t9600, ( "VSB", CR )

; Skip forward on whole directory

  serout pin, t9600, ( "VSD", CR )

; Fast forward 5 seconds

  serout pin, t9600, ( "VF", CR )

; Fast rewind 5 seconds

  serout pin, t9600, ( "VB", CR )

; Repeatedly plays a single file

  serout pin, t9600, ( "VRF", " ", "filename.mp3", CR )

; Play all MP3 files

  serout pin, t9600, ( "V3A", CR )

; Repeatedly play all MP3 files

  serout pin, t9600, ( "VRA", CR )

; Repeatedly play random MP3 files

  serout pin, t9600, ( "VRR", CR )

; Set volume

  b0 = ...
  serout pin, t9600, ( "VSV", " ", b0, CR )

; Set volume - 0 (loudest)

  serout pin, t9600, ( "VSV", " ", 0, CR )

; Set volume - 255 (mute)

  serout pin, t9600, ( "VSV", " ", 255, CR )

Device Information Commands

; Firmware version

  serout pin, t9600, ( "FWV", CR )

; Display information about the disk if disk is less than 4GB

  serout pin, t9600, ( "IDD", CR )

; Display information about the disk

  serout pin, t9600, ( "IDDE", CR )

; Display information about the disk

  serout pin, t9600, ( "IDD", CR )

; Display disk serial number

  serout pin, t9600, ( "DSN", CR )

; Display disk volume label

  serout pin, t9600, ( "DVL", CR )

; Returns the free space available on disk if less than 4GB is free

  serout pin, t9600, ( "FS", CR )

; Returns the free space available on disk

  serout pin, t9600, ( "FSE", CR )

Directory Control Commands

; List directory

  serout pin, t9600, ( "DIR" , CR )

; List specified file and size

  serout pin, t9600, ( "DIR", " ", "filename.ext", CR )

; List specified file and date and time of create, modify and file access

  serout pin, t9600, ( "DIRT", " ", "filename.ext", CR )

; Change current directory

  serout pin, t9600, ( "CD", " ", "filename.ext", CR )

; Move up one directory level

  serout pin, t9600, ( "CD", " ", " ..", CR )

; Make a new subdirectory in the current directory

  serout pin, t9600, ( "MKD", " ", "filename.ext", CR )

; Delete subdirectory from current directory

  serout pin, t9600, ( "DLD", " ", "filename.ext", CR )

; Delete a file

  serout pin, t9600, ( "DLF", " ", "filename.ext", CR )

; Rename a file or directory

  serout pin, t9600, ( "REN", " ", "filename.ext", " ", "filename.ext", CR )

File Handling

; Reads a whole file

  serout pin, t9600, ( "RD", " ", "filename.ext", CR )

; Open a file for writing or create a new file

  serout pin, t9600, ( "OPW", " ", "filename.ext", CR )

; Open a file for reading

  serout pin, t9600, ( "OPR", " ", "filename.ext", CR )

; Write the number of bytes specified to the currently open file

  serout pin, t9600, ( "WRF", " ", msb, lsb, CR, "data" )

; Read the number of bytes specified from the currently open file

  serout pin, t9600, ( "RDF", " ", msb, lsb, CR )

; Close the currently open file

  serout pin, t9600, ( "CLF", " ", "filename.ext", CR )

; Seek to the byte position in the currently open file

  serout pin, t9600, ( "SEK", " ", msb, lsb, CR )
Copy Code Submit an Example

Create Module

A VMusic2 module may be connected to the generic terminal block create module.

Bill of Materials

DescriptionCodeQty
VMusic2 MP3 player USB030 1 Buy Now
4-way 0.1" header CON036 2 Buy Now

Simulation

No Image Selected

Submit Your Own Code!

You must be logged in to submit code examples. Login now.