NEW DATABASE - 350 MILLION DATASHEETS FROM 8500 MANUFACTURERS
SNC600 SNC668 SNC658 SNC678 SNC688 SNC698 SNC658/668/ SNC678/ SNC688/SNC698 - Datasheet Archive
Easy Format Programming Guide = Contents = 1
SNC600 SNC600 Easy Format Programming Guide = Contents = 1 OVERVIEW.3 2 CHIPS .3 3 PROGRAM STRUCTURE.4 4 COMMANDS .9 4.1. 4.2. 4.3. 4.4. 4.5. 4.6. 5 I/O COMMANDS .9 ARITHMETIC LOGIC COMMANDS.10 CONDITION JUMP COMMANDS .11 SPEECH/MELODY COMMANDS .12 MISC COMMANDS .16 NEW COMMANDS .17 INITIAL INSTRUMENT FILE .20 5.1. 5.2. 6 [INSTRUMENT_FILE].20 CONTENT OF INSTRUMENT FILE .21 .MLD FILE FORMAT .23 6.1. 6.2. 6.3. 6.4. 6.5. DECLARATION PART : .24 ENTITY PART: .24 CONTROL CODE: [CTRL].26 BEAT .26 OUTPUT STATE CONTROL CODE .26 7 CODING ENVIRONMENT .28 8 UTILITY PROGRAMS .29 8.1. 8.2. 8.3. 8.4. 9 MID2MLD.29 MLD2MID.32 WAVESPILT .32 SPLIT.32 WAVEFORM LIBRARY .33 10 RHYTHMS.36 11 COMMANDS LIST .38 Version: 1.3 1 September 25, 2003 SNC600 SNC600 Easy Format Programming Guide AMENDENT HISTORY Version Date Description Ver1.0 First issue Ver 1.1 May 2, 2003 Ver 1.2 August 26 ,2003 Add new body SNC668 SNC668, 698 Page16: Add new command as following Pn=Mi Mi=Randn PLAY1?:PathName PLAY2?:PathName PLAY3?:PathName PLAY4?:PathName Melody?:PathName Mi>Mj?:PathName Mi>=Mj?:PathName Mi=data?:PathName Mi=data?:PathName Mi!=Mj?:PathName Mi!=data?:PathName Add amendent history Add CHIPS in chapter 2 Ver 1.3 September 25,2003 Add new chip SNC658 SNC658 Version: 1.3 2 September 25, 2003 SNC600 SNC600 Easy Format Programming Guide 1 OVERVIEW SNC600 SNC600 series is a series of 20-85 seconds single chip with four-channel voice/melody synthesizer IC. It is built in a 4-bit tiny controller with six I/O ports and a PWM direct drive circuit. By programming through the tiny controller, user's varied applications including voice section combination, key trigger arrangement, output control and other logic functions can be easily implemented. We provide EZ format platform for users to easily complete their programs in a short time. In general, users would use micro assembly language to realize their applications, but it is very time-consuming and difficult to approach. Thus, a user-friendly language EZ format is provided to accelerate the development of user's applications. The followings are the description on how to program EZ format to realize your applications. 2 CHIPS SNC658 SNC658, 668, 678, 688, 698 Chip Voice Channel RAM ROM Duration number Size IO Size SNC658 SNC658 20 sec 4 256x4 64Kx12 24 I/O (P1, P2, P3, P4, P5, P6) SNC668 SNC668 31 sec 4 256x4 96Kx12 24 I/O (P1, P2, P3, P4, P5, P6) SNC678 SNC678 42 sec 4 256x4 132Kx12 24 I/O (P1, P2, P3, P4, P5, P6) SNC688 SNC688 61 sec 4 256x4 184Kx12 24 I/O (P1, P2, P3, P4, P5, P6) SNC698 SNC698 85 sec 4 256x4 256Kx12 24 I/O (P1, P2, P3, P4, P5, P6) Version: 1.3 3 September 25, 2003 SNC600 SNC600 Easy Format Programming Guide 3 PROGRAM STRUCTURE A typical EZ file written by Easy format is described as follows: [device] . [core] . [key] . [Speaker_Type] . [files] . [Instruments] . [rhythms] . [instrument_files] . [random] . [input_states] . [output_states] . [asm] . [paths] . Version: 1.3 4 September 25, 2003 SNC600 SNC600 Easy Format Programming Guide (1) [device] SNC678 SNC678 Device declaration such as SNC678 SNC678. The device can be any one of the following chip part number. SNC658/668/ SNC658/668/ SNC678/ SNC678/ SNC688/SNC698 SNC688/SNC698 (2) [core] xxx.asm The default setting is defined as EZ600 EZ600.asm (for SNC658 SNC658~SNC698 SNC698) Declare core programs used in your applications. If users do not use this default setting of EZ600 EZ600.asm and use his own setting for the core program, be sure that the core program must exist in working directory. (3) [key] scan=n or direct=n This command is to specify the trigger configuration. There are two different types of trigger settings. One is keyboard scanning and the other one is direct key input. For Direct key input, the declaration is as follows: direct=n (direct=n, n=1.24) Relation between Trigger Number and IO port. TR1 TR2 TR3 TR4 TR5 TR6 TR7 TR8 TR9 TR10 TR11 TR12 P10 P11 P12 P13 P20 P21 P22 P23 P30 P31 P32 P33 TR13 TR14 TR15 TR16 TR17 TR18 TR19 TR20 TR21 TR22 TR23 TR24 P40 P41 P42 P43 P50 P51 P52 P53 P60 P61 P62 P63 For keyboard scanning, the declaration is as follows: scan=n (scan=n, n=5.32) P20 P21 P22 P23 P40 P41 P42 P43 P10 TR1 TR5 TR9 P11 TR2 TR6 TR10 TR14 TR18 TR22 TR26 TR30 P12 TR3 TR7 TR11 TR15 TR19 TR23 TR27 TR31 P13 TR4 TR8 TR12 TR16 TR20 TR24 TR28 TR32 Version: 1.3 TR13 TR17 TR21 TR25 TR29 5 September 25, 2003 SNC600 SNC600 Easy Format Programming Guide (4) [Speaker Type] The default speaker configuration is defined as 1. There are four speaker types can be selected, i.e., VO1 VO1 VO1 VO1 VO2 VO2 VO2 VO2 Type 2 Type 3 Type 4 Type 1 (5) [files] abc.wav bell.mld Declare Voice files and Melody files used in your applications. (6) [instruments] piano violin trumpet . Declare musical instruments used in your applications. A specific number will be assigned to represent a musical instrument according to the sequence as declaration. For example, piano is assigned to "ins 0", violin is "ins 1", and trumpet is "ins 2". The maximum number of instrument declaration is 16 (0~15). Thus, there are 16 different kinds of musical instruments that can be used in an easy program. Easy Format compiler will automatically include all necessary waves and suitable convert parameters of instruments. Some musical instruments provided by Sonix are listed in Chapter. 5. Users can also use those musical instruments by extracting them out from our library. For details, please refer to Chap. 4. (7) [rhythms] r0.wav r1.wav r2.wav . (maximum number=16) Version: 1.3 6 September 25, 2003 SNC600 SNC600 Easy Format Programming Guide Some rhythm-type instruments are declared in this section. A specific number will be assigned to represent one type of rhythm voice according to the sequence declared in [rhythms]. For instance, r0.wav is assigned to "rhythm 0", r1.wav is "rhythm 1", and r2.wav is "rhythm 2". When a melody song (xxx.mld) is playing and a rhythm code ([r.=.k@.]) is encountered, the corresponding rhythm wave will be played according to this section declaration. For example, [r1=8k@2] will play r1.wav using 8Khz on channel 2. Some rhythm waves provided by Sonix are listed in Chap. 5. The wave files defined in this section can be also used as normal voice files. (8) [instrument_files] abcd.ini If you use your own instruments, some waveform filenames and parameters of those instrument must be defined in a ".ini" file. The filename of this ".ini" file must be defined in [instrument_files] section, and ".ini" (e.g., abcd.ini) must exist in the working directory. For more details, please refer to Chap 4. (9) [random] rand0=max1 rand1=max2 rand2=max3 The Easy program can generate maximum 3 random numbers for user's usage. For example, rand1=4, indicating that the value of the variable rand1 can be from 0 to 4 randomly. (10) [input_states] input_state_name: cond1 cond2 cond3 .condn . The number of input_state can be maximum 255 and the condition number n must be the same as the trigger number where cond1 corresponds to TR1, cond2 corresponds to TR2 and so on. And cond1 cond2 .condn can be one of the followings: X : Nothing happened when the state (`H'/'L') of TRn changes. Path_name : When TRn changes from `L' to `H', path equation named `Path_name' will be executed. /Path_name : When TRn changes from `H' to `L', path equation named `Path_name' will be executed. Path_name1/path_name2: When TRn changes from `L' to `H'/ `H' to `L', path equation named `Path_name1'/ `Path_name2' will be executed individually. Version: 1.3 7 September 25, 2003 SNC600 SNC600 Easy Format Programming Guide (11) [output_states] Output_state_name: Pn=[Cn3 Cn2 Cn1 Cn0] Pk=[Ck3 Ck2 Ck1 Ck0] {output_state_name}O: equations. There are two types of output declarations. (12) Simple Output Setting Output_state_name: Pn=[Cn3 Cn2 Cn1 Cn0] Pk=[Ck3 Ck2 Ck1 Ck0] Where Cn3 is assigned to Pn3 , Cn2 is assigned to Pn2 and so on. Cn3 to Cn0 and Ck3 to Ck0 can be one of the following: 1 : Set the corresponding output pin to be `1'. 0 : Reset the corresponding output pin to be `0'. X : Keep the corresponding output pin unchanged. Fv : Set the corresponding output pin to flash according to the volume of voice or melody playing. Pn, Pk can be P1, to P6. (In addition, the output setting `fv' can only be assigned for P3 and P4.) (13) Background output equations {output_state_name}O: equations. The number of background output equations can be maximum 255. About the equations, see [Paths]. (14) [asm] If some applications can not be programmed by easy format, user can write assembly program in this area. The assembly format is as follows: asm_AsmName1: . end_AsmName1 asm_AsmName2: . end_AsmName2 (15) [paths] The general format for path equations is as follows: Path_name: command1 command2 .commandn The path_name is the name of this path consisting of command1, command2,.commandn. While this path is executed, the system will execute the path equation starting from first command to the last. When the system is power up, it will execute the path `init' first. Version: 1.3 8 September 25, 2003 SNC600 SNC600 Easy Format Programming Guide 4 COMMANDS The command belonging to the path equation could be one of the followings: 4.1. I/O Commands (1) Input_state_name The input state defined by Input_state_name is activated when this path command is executed. (2) output_state_name The output state defined by output_state_name is activated when this path command is executed to assign the value of output ports. (3) {output_state_name}O {Output_ state_ name}O is used to execute main equation and sub-equation simultaneously where the function of sub_equation is defined by {output_state_name}O at [Output_states]. For instance, when the program is running on some commands of main equation like delay, voice/ melody playing for defined seconds, at the same time, the sub-equation pre-defined by {output_ state_ name}O is still executing Note:Voice/melody playing ,{PathName}P,{Output_state_Name}O and Stop ,Stop_P, Stop_O commands are not available and can not be defined in {output_state_name}O. Those commands will be described later. (4) PathName Execute a path equation named PathName. (5) {PathName}P {PathName}P is used to execute main equation and sub-equation simultaneously where the function of sub_equation is defined by {PathName}P. Just like {output_state_name}O , when a command of main equation (like delay, voice/ melody playing) is executing, at the same time the sub-equation pre-defined by {PathName}P is still executing. Note: Commands as {PathName}P ,Stop ,Stop_P are not available and can not be defined in {PathName}P. (6) Pn=[1 0 fv x ] Assign output states to port Pn where n can be 1 to 6. But fv only can be assigned to P3 and P4. Please see section [output_states] for details. Version: 1.3 9 September 25, 2003 SNC600 SNC600 Easy Format Programming Guide 4.2. Arithmetic Logic Commands (1) Mi=data Set the content of register Mi to be data, where i can be 0 to 15 and data can be #0 to #15 or #0000b to #1111b. (2) Mi=Pn Set the content of register Mi to be the input value of Pn. Where i can be 0 to 15 and Pn can be P1 to P6. (3) Mi(n)=1 or 0 Set the nth bit of register Mi to be either 1 or 0, where i can be 0 to 15 and n can be 0 to 3. (4) Mi=Mj+data Set the content of register Mi to be the content of register Mj plus data, where both i and j can be 0 to 15. (5) Mi=Mj.and.data Set the content of register Mi to be the content of register Mj AND data, where both i and j can be 0 to 15. (6) Mi=Mj.and.Mk Set the content of register Mi to be the content of register Mj AND Mk, where i, j and k can be 0 to 15. (7) Mi=Mj.or.data Set the content of register Mi to be the content of register Mj OR data, where both i and j can be 0 to 15. (8) Mi=Mj.or.Mk Set the content of register Mi to be the content of register Mj OR Mk, where i, j and k can be 0 to 15. (9) Mi=Mj.xor.data Set the content of register Mi to be the content of register Mj XOR data, where both i and j can be 0 to 15. (10) Mi=Mj.xor.Mk Set the content of register Mi to be the content of register Mj XOR Mk, where i , j and k can be 0 to 15. Version: 1.3 10 September 25, 2003 SNC600 SNC600 Easy Format Programming Guide (11) .inv.Mi Invert each bit of register Mi, where i can be 0 to 15. For example: if Mi=0011b, the content of register can be inverted from 0011b to 1100b after executing inv.Mi command. (12) .inv.Mi(n) Invert nth bit of register Mi, where n can be 0 to 3, and i can be 0 to 15. For example: if Mi=0011b, the content of register can be inverted from 0011b to 0010b after executing .inv.Mi(0) command. 4.3. Condition Jump Commands (1) Mi?data:PathName If the content of register Mi is "data", then the path equation with the name "PathName" will be executed, where i can be 0 to 15. (2) Mi?Mj:PathName If the content of register Mi equals the content of register Mj, then the path equation with the name "PathName" will be executed, where i, j can be 0 to 15. (3) Mi:[path0 path1 .pathn] If the content of register Mi equals to 0, then execute path0. If the content of register Mi equals to 1, then execute path1, and so forth, where i can be 0 to 15. (4) Mi(n)?0:PathName If the nth bit of Mi is "0", then path equation with the name "PathName" will be executed. Where n can be 0 to 3 and i can be 0 to 15. (5) Mi(n)?1:PathName If the nth bit of Mi is "1", then path equation with the name "PathName" will be executed. Where n can be 0 to 3 and i can be 0 to 15. (6) TRn?H:PathName If the trigger TRn is `H", then the path equation with the name "pathname" will be executed where n can be 1 to maximum trigger number defined in [key]. Version: 1.3 11 September 25, 2003 SNC600 SNC600 Easy Format Programming Guide (7) TRn?L:PathName If the trigger TRn is `L", then the path equation with the name "pathname" will be executed where n can be 1 to maximum trigger number defined in [key]. (8) Pn?[0 1 x 0]:PathName If Pn3, Pn2 and Pn0 equal to 0 1 0, then the path named "PathName" will be executed. Where n can be 1 to 6. (9) Pn?[x d x d]:[Path0 Path1 .Pathn] If Pn2 and Pn0 =00, then execute path0, if Pn2 and Pn0 =01, then execute path1, and so on. Where n can be 1 to 6. (10) randn?data:PathName If the random number Randn equals data, then path with PathName will be executed. Where n can be 0 to 2. (11) randn?Mi:PathName If the random number Randn equals the content of register Mi, then path with PathName will be executed. Where n can be 0 to 2 (12) randi:[path0 path1.pathn] If the random number randi equals 0, then execute path0. If the random number randi equals to 1, then execute path1, and so on. Where i can be 0 to 2. 4.4. Speech/Melody Commands (1) Freq1=nK / Freq2=nK / Freq3=nK/ Freq4=nK Set voice playing rate to the corresponding channel, where n can be 4 to 40. For example, freq1=6.7k. Channel 1 =6.7K freq4=16k. Channel 4 =16K (2) m_Vol1=n / m_Vol2=n /m_Vol3=n /m_Vol4=n Set volume of melody playing of channel 1~4, where n = 0~63 (0:off, 63:maximum). Note: m_Vol1~m_Vol4 will not affect the volume of VOICE playing of the corresponding channel. Note: m_Voln command is to store a volume value in register of chip. The value is loaded into volume control unit when a new note starts to play. Thus, it will not affect the notes that had been playing. Version: 1.3 12 September 25, 2003 SNC600 SNC600 Easy Format Programming Guide volume of voice will not change Note 1 (vol=40) m_voln=40 (3) Note2 (vol=60) m_voln=30 m_voln=60 v_Vol1=n / v_Vol2=n / v_Vol3=n / v_Vol4=n Set volume of voice playing of channel 1~4, where n = 0~63 (0:off, 63:maximum). Note: v_Vol1~v_Vol4 will not affect the volume of MELODY playing of the corresponding channel. Note: v_Voln command is to store a volume value in register of chip. The value is loaded into volume control unit when a voice starts to play. Thus, it will not affect the voices that have been playing. volume of voice will not change voice 1 (vol=40) v_voln=40 (4) v_voln=30 voice 2 (vol=60) v_voln=60 Ins1=n / Ins2=n / Ins3=n / Ins4=n Change instrument of channel 1~ 4, where n = 0~15. The mapping between the number n and type of instrument is declared in [Instruments] section, For example: [Instruments] Trumpet ; Ins1=0 Channel 1 = trumpet Piano ; Ins2=1 Channel 2 = piano If user selects an instrument number which exceeds the total instrument number, (e.g., declare 3 instrument, but Ins1=3), no voice will be played! (5) Ins1=mn / Ins2=mn / Ins3=mn / Ins4=mn mn=m0~m15 Like Ins1=n, but now instrument number is the content of register. Version: 1.3 13 September 25, 2003 SNC600 SNC600 Easy Format Programming Guide (6) VoiceName1@n+VoiceName2@m+. Play voice with file name "VoiceName1" on channel n, "VoiceName2" on channel m . concurrently. And the next command will not be executed until all voice playing is finished. In addition, users can use commend k*Voicename1@n to play the voice k times. Moreover, if user want to execute repeation function on more than one channel, users can use the command, k*[ VoiceName1@n+VoiceName2@m+.]. where k