I checked the CD changer related information, and with this sketch it seems to work (at least you can change to the CD changer, and it will count from 01:00 to 01:59):
Edit: The seconds are in BCD so you have to convert it for correct output on the display.
#include "VanMessageSender.h"
const int VAN_PIN = 7;
AbstractVanMessageSender *VANInterface;
unsigned long currentTime = millis();
unsigned long previousCdcTime = millis();
volatile uint8_t seconds = 0;
volatile uint8_t headerByte = 0x80;
void IncrementHeader()
{
if (headerByte == 0x87)
{
headerByte = 0x80;
}
else
{
headerByte++;
}
}
void IncrementSeconds()
{
seconds++;
if (seconds == 60)
{
seconds = 0;
}
}
uint8_t DecToBcd(uint8_t input)
{
return( (input/10*16) + (input%10) );
}
void AnswerToCDC()
{
uint8_t status = 0xC3; //playing
uint8_t cartridge = 0x16;
uint8_t minutes = 0x01;
uint8_t trackNo = 0x17;
uint8_t cdNo = 0x02;
uint8_t trackCount = 0x21;
uint8_t packet[12] = { headerByte, 0x00, status, cartridge, minutes, DecToBcd(seconds), trackNo, cdNo, trackCount, 0x3f, 0x01, headerByte };
VANInterface->set_channel_for_immediate_reply_message(0, 0x4E, 0xC, packet, 12);
}
void setup(){
VANInterface = new VanMessageSender(VAN_PIN);
VANInterface->begin();
}
void loop() {
currentTime = millis();
if (currentTime - previousCdcTime >= 1000)
{
previousCdcTime = currentTime;
IncrementSeconds();
IncrementHeader();
AnswerToCDC();
}
}