Details
BUY YM3526 https://www.utsource.net/itm/p/12606149.html
Below is the parameter table and instructions for the YM3526, also known as the OPL2 sound chip:
YM3526 (OPL2) Parameter Table
| Parameter | Description | Range | Default Value |
|---|---|---|---|
| Register Address | The address of the register to be written or read | 0x00 - 0xBF | N/A |
| Data | The data to be written to the specified register | 0x00 - 0xFF | N/A |
| Clock Frequency | The clock frequency input to the chip | 1.78975 MHz - 8 MHz | 3.579545 MHz |
| Power Supply Voltage | The operating voltage range | 4.5 V - 5.5 V | 5 V |
| Operating Temperature | The temperature range for operation | -20掳C to +70掳C | N/A |
| Output Level | The output level control | 0x00 - 0x0F | 0x07 |
| Tone Generation | Number of channels for tone generation | 9 channels | N/A |
| Noise Generation | Number of channels for noise generation | 3 channels | N/A |
| Envelope Control | Control over the envelope generator | 0x00 - 0xFF | N/A |
| Frequency Modulation | Control over the frequency modulation | 0x00 - 0xFF | N/A |
Instructions for Using the YM3526 (OPL2)
Initialization:
- Set the Clock Frequency:
- Ensure the clock frequency is within the supported range (1.78975 MHz to 8 MHz).
- Set the Power Supply Voltage:
- Apply a stable power supply voltage between 4.5 V and 5.5 V.
- Reset the Chip:
- Write to the reset register (0x01) with the value 0x00 to reset the chip.
- Set the Clock Frequency:
Writing to Registers:
- Select Register:
- Write the register address to the address port (usually 0x388 for PC applications).
- Write Data:
- Write the data to the data port (usually 0x389 for PC applications).
- Select Register:
Setting Output Level:
- Output Level Register:
- Write the desired output level (0x00 - 0x0F) to the output level register (0x08).
- Output Level Register:
Configuring Channels:
- Tone Channels:
- Configure the 9 tone channels by writing to the appropriate registers (0x20 - 0x2E).
- Noise Channels:
- Configure the 3 noise channels by writing to the appropriate registers (0x30 - 0x32).
- Tone Channels:
Envelope Control:
- Envelope Generator Registers:
- Write to the envelope generator registers (0x40 - 0x4F) to control the attack, decay, sustain, and release parameters.
- Envelope Generator Registers:
Frequency Modulation:
- FM Control Registers:
- Write to the FM control registers (0x60 - 0x6F) to enable or disable frequency modulation for each channel.
- FM Control Registers:
Reading from Registers:
- Select Register:
- Write the register address to the address port.
- Read Data:
- Read the data from the data port.
- Select Register:
Power Management:
- Power Down:
- To reduce power consumption, write to the power down register (0x0B) with the appropriate value to disable unused channels.
- Power Down:
Example Code (PC Assembly)
; Initialize YM3526
mov dx, 0x388 ; Address port
mov al, 0x01 ; Reset register
out dx, al
inc dx ; Data port
mov al, 0x00 ; Reset value
out dx, al
; Set Output Level
mov dx, 0x388 ; Address port
mov al, 0x08 ; Output level register
out dx, al
inc dx ; Data port
mov al, 0x07 ; Output level value
out dx, al
; Configure Tone Channel 1
mov dx, 0x388 ; Address port
mov al, 0x20 ; Tone channel 1 register
out dx, al
inc dx ; Data port
mov al, 0x3F ; Configuration value
out dx, al
; Configure Envelope Generator
mov dx, 0x388 ; Address port
mov al, 0x40 ; Envelope generator register
out dx, al
inc dx ; Data port
mov al, 0x1F ; Envelope configuration value
out dx, al
This table and set of instructions should help you understand and use the YM3526 (OPL2) sound chip effectively.
(For reference only)View more about YM3526 on main site
