The source code for the PIC® micro-controller is written in assembler. The only things you need, to “build” your own code, is the free IDE (Integrated Development Environment) MPLAB® from Microchip™ and the assembler code presented on this page.
The existing code is working fine. I have been using this CD player for over a year as my main digital source without any trouble. So the CD-Pro2M or CD-Pro2LF unit will play music as it should. On this page there is a Wish List, as long as this list exists there might come some updates. Although the program memory of the PIC16F871 (only 2k) is used for over 90% so there is not much room for more features. Upgrading to a controller with more memory, like a PIC16F877A of PIC16F887, might be inevitable.
How to “build” your own code
Start by downloading and installing the free latest version of MPLAB from the Microchip website.
Unpack the zipped source code from the link below in your project directory.
Start MPLAB and create a new project by using the Project Wizard (Project>Project Wizard…)
- Step 1: Select the device type (PIC16F871)
- Step 2: Select the toolsuite (Microchip MPASM Toolsuite)
- Step 3: Name your project (I named it CDP-1 controller) and pick the Project Directory
- Step 4: Add all files from the Project Directory to the project
A summary of the the Project parameters is shown
Click “Finish” to create the project
The source code contains the following files
- CDP-1_main.asm
- DSA_protocol.asm
- LCD_strings.asm
- P16_EEPROM.asm
- P16_LCD.asm
- CDP-1_IO.inc
- P16F871.INC
- CDP-1_16f871.lkr
These files are zipped into the file CDP-1-master.zip containing the latest code version.
To “build” the (HEX)code press Ctrl+F10. Now you have build your own CDP-1 controller.hex to program in your controller.
MPLAB is a very powerful tool, you can simulate almost the entire code before programming the PIC controller. Even simulating the DSA protocol (which is somewhat complicated but) can be done.
Implemented features
- DSA protocol
- Keyboard control
- Display control
- RC5 remote control protocol
- Power up/down
- Cover open/close
- TOC read
- Play
- Pause
- Stop
- Next track
- Previous track
- Intro scan
- Repeat disc
- Search forward/backward
- Setting the I2S DAC mode
Wish List
Function | Description |
---|---|
|
The ability to play a track by selecting a (double) number on the remote control |
|
A track shuffle play function |
|
Programming tracks in a random order |
Code updates
Version | Changes made |
---|---|
20080520 | The “sensorless” version. For all of you who don’t want to use a (motorized) cover with sensors or switches this is the version to use. Set the variable sensorless on line 33 in the file [CD-Pro2M_main.asm] to “1” to build the sensorless version. The open/close buttons on the front panel and on the remote control unit do not have any function in this sensorless version. |
20071208 | Remote control code adapted to accept RC5 commands from both 36kHz and 38kHz transmitting remote units. So now the controller will also work with most universal remote handsets. Also the remote command validation has become more strict. |
20061114 | It’s now possible to select the DAC mode of the CD-Pro2M. This might be handy when you are using an external DAC connected to the I2S output. |
How to set the I2S mode?
To change the I2S mode of the CD-Pro2M hold the [STOP] button at the CD player during power up. The player will show:
Where ‘n’ is the actual I2S mode setting. By pressing the [PREV] and [NEXT] buttons you select the I2S mode you need (1…9). Be aware that selecting one of the Sony formats will disable the internal DAC.
I2S mode | I2S format | mode |
0 | reserved | (not supported) |
1 | I2S – FS mode (default) | DAC mode |
2 | I2S – 2 FS mode | DAC mode |
3 | I2S – 4 FS mode | DAC mode |
4 | Sony 16 bit FS | DAC mode |
5 | Sony 16 bit 2 FS | DAC mode |
6 | Sony 16 bit 4 FS | DAC mode |
7 | Sony 18 bit FS | DAC mode |
8 | Sony 18 bit 2 FS | DAC mode |
9 | Sony 18 bit 4 FS | DAC mode |
81 | I2S – CD-ROM mode | CD-ROM mode (not supported) |
82 | EIAJ CD-ROM mode | CD-ROM mode (not supported) |
By pressing the [OPEN/CLOSE] button the mode is stored into EEPROM. Now the player will power up for normal use. When the selected I2S mode is not the default mode (1) it is displayed at power up like this: