| поискавой системы для электроныых деталей |
|
SSM2163 датащи(PDF) 15 Page - Analog Devices |
|
|
|||||||||||||||||||||||||||||
SSM2163 датащи(HTML) 15 Page - Analog Devices |
|
15 / 16 page ![]() SSM2163 REV. 0 –15– The 80C51 sends data out of its shift register LSB first, while the SSM2163 requires data MSB first. The subroutine therefore includes a BYTESWAP subroutine to reformat the data. This routine transfers the MSB-first byte at location SHIFTREG to an LSB-first byte at location SENDBYTE. The routine rotates the MSB of the first byte into the carry with a Rotate Left Carry instruction, then rotates the carry into the MSB of the second byte with a Rotate Right Carry instruction. After 8 loops, SENDBYTE contains the data in the proper format. The BYTESWAP routine in Listing 1 is convenient because the attenuator data can be calculated in normal LSB form. For example, fading a channel on the SSM2163 is simply a matter of repeatedly incrementing the LEVEL_VALUE location and calling the SEND_VAL subroutine. (Remember, the 6-bit Listing 1. Software for the 80C51-SSM2163 Serial Port Interface ; This subroutine loads an SSM2163 mixer channel with a 6-bit ; attenuator value, and turns the Left or Right mixer switch ON or OFF. ; The attenuator value is stored at location ATTEN_VALUE ; The mixer channel address is stored at location INPUT_ADDR ; PORT1 DATA 90H ;SFR register for port 1 ATTEN_VALUE DATA 40H ;Attenuation level (0=0dB) ;ATTEN-VALUE: B7=0, B5–B0=Attenuation Value INPUT_ADDR DATA 41H ;Mixer Channel Address ;INPUT_ADDR: B7=1, B4=L chnl, B3=R chnl, B2-B0=address LOOPCOUNT DATA 42H ;Count loops for byte swap SHIFTREG DATA 43H ;Shift reg. for byte swap SENDBYTE DATA 44H ;Destination reg. for byte swap ; ORG 100H ;arbitrary starting address LD_2163: CLR SCON.7 ;set serial CLR SCON.6 ; data mode 0 CLR SCON.5 ;Clr SM2 for mode 0 CLR SCON.1 ;clr the transmit flag CLR PORT1.3 ;Mute function off SETB PORT1.4 ;WRITE and LOAD High MOV SHIFTREG,INPUT_ADDR ;Get mixer channel address ACALL SEND_IT ; send to SSM2163 SEND_VAL: MOV SHIFTREG,ATTEN_VALUE ;Get the attenuation level ACALL SEND_IT ; send it to the SSM2163 RET ;Done ; ;Convert the byte to LSB-first format and send ; it to the SSM2163 SEND_IT: MOV LOOPCOUNT,#8 ;Shift 8 bits BYTESWAP: MOV A,SHIFTREG ;Get source byte RLC A ;rotate MSB to carry MOV SHIFTREG,A ;Save new source byte MOV A,SENDBYTE ;get destination byte RRC A ;Move carry into MSB MOV SENDBYTE,A ;Save DJNZ LOOPCOUNT,BYTESWAP ;Done? CLR PORT1.4 ;Set WRITE and LOAD low MOV SBUF,SENDBYTE ;Send the byte SEND_WAIT: JNB SCON.1,SEND_WAIT ;Wait until 8 bits are send CLR SCON.1 ;Clear the serial flag SETB PORT1.4 ;Set WRITE and LOAD high to latch RET ; data into the SSM2163 END The subroutine begins by setting appropriate bits in the Serial Control register to configure the serial port for Mode 0 operation. Next the SSM2163’s Chip Select input is set low to enable the SSM2163. The input channel address is obtained from memory location INPUT_ADDR, adjusted to compensate for the 80C51’s serial data format, and moved to the serial buffer register. At this point, serial data transmission begins automatically. When all 8 bits have been sent, the Transmit Interrupt bit is set, and the Chip Select output is set high to latch the channel address into the SSM2163. The subroutine then sets Chip Select low again and proceeds to send the attenuation value stored at location LEVEL_VALUE. When the Chip Select input is returned high, the appropriate SSM2163 input channel will be updated with the new attenuation value and the subroutine ends. |
|
|
ссылки URL |
| Вашему бизинису помогли Аллдатащит? [ DONATE ] |
Что такое Аллдатащит | реклама | контакт | Конфиденциальность | Ссылка на техническое описание | обмен ссыками | поиск по производителю All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |