Disclaimer: I have not tried this and I do not think it would be trivial.
The difficult part with your project is most MP3 players do not have an interface to communicate the current status. Generally, they have a USB slave interface for downloading new music but there are 2 problems with this interface. First, finding a PLC with a USB host option is going to be difficult if not impossible. Second, I believe most USB interfaces don't generally have commands to control the functions of the MP3 player. Instead they just present the flash storage space for downloading new music.
The way I see it, there are 4 parts to this project.
1) Connect Hardware: You will need a PLC with a RS232 I/O card, an Ipod, and an Ipod cable with the correct conductors. (The most difficult part could be finding the cable.)
2) Configure the RS232 I/O card. How you do this depends on the PLC you want to use, but it will involve some proprietary software to configure the RS232 channel for 19.2 kbaud, with no parity, and 1 stop bit.
3) Write the code to emulate the Ipod interface per the link in my last post.
4) Use the polling mode command (0x26 and 0x27) to get the current time elapsed in the song. Save the previous value read and compare it to the current. If the current is less than the previous value then either it switched songs or someone pressed rewind. Maybe there is a better way to implement this???
Like I said, it might not be easy and I am not sure if it would work, but I do not know of any other way. Maybe someone else has an idea.
Thank you for your response. I am really looking for something that can hold a couple of songs and a PLC (specifically AB PLC) can recognize that a song has changed so I can program the logic to change with each song. If there is a better way, please enlighten me. I was just using an MP3 player as an explain.
What is your application? i.e. what are you trying to achieve. One way to do this may be to use a specific tone to separaate the songs when you down load them to the MP3 player. Then "look" for the tone using some audio alarm and use that as an input to the PLC. Not sure that all the hardware is out there for the "audio alarm" but I'm sure there is a clever electronics eng who can build such a device.
Might think about this, If you plug in your MP3 player you get what output....ANALOG
to the headphones. what you need to read is the voltage or current whichever is attainable. then when it stops for say 2 seconds that is the change in song. just make sure when loading the MP3 player you edit in a time lag and when that is seen you switch
which can tell your PLC that there has been silence (between songs). Adjust its delay so it doesn't trigger on silent moments in your program material.
I would be curious what you are trying to accomplish with this, it sounds like an interesting application!
-mike-