we've finished our project about implementing a delay on a DSP based card. We've promised you to send the code we've implemented on a card based on TMS 320C50 processor The programs i send you are : delayok1 : a simple delay dbldelay : a double repetition of the same note dbdelay2 : well i don't know exactly how to describe the effect but it's built with two circular buffers |------------------------| Circular buffer 1 |------------| Circular buffer 2 both buffers begin at the same address but the length are different. I take a sample value from circular buffer 1 and a value from circular buffer 2 and i had them to the input signal and send this to the output. then i place the value which has just came from input into Circular buffer 1 and the ancient value of Circular buffer 1 is placed in Circular buffer 2. This gives three repetition of the note played when you just play a single note. But when you let the note ring it gives many repetitions of the note until the note stops ringing. it's amazing ! Effect : is a sort of horrible distortion obtained by placing in output the same value during a determined time. Effect2 : is a strange effect obtained by recording every sampled values from input but listening only one recorded value on two (you read, you read not...) every file must be file.asm except delayok1.cmd. To run them you must type dspa -v50 file.asm dsplnk file.cmd then run evm5x and load file.out the file.cmd indicates the memory map. you must correct it for every file you want to run by correcting the first lines with the correct name of the file.asm if you want to ask me questions about what i've send you, don't hesitate dewasmes@isen.fr ************************************************************* * (C) COPYRIGHT ISEN SYSTEM,INC. 1998 * ************************************************************* * MODULE NAME: DELAYOK1.ASM * * * * FUNCTION: Sampling an analog input signal * * and sending it to analog output * * with an overall gain of 1 and a * * delay. * * * * ____[delay]_____ * * / \ * * input____/ /+\_____output * * \ \+/ * * \________________/ * * * * * * DESCRIPTION: This program initializes the TMS320C50 and * * TLC32046 on the C5x EVM Board. * * * * BAND-PASS: ON * * Low cut-off frequency: 300 Hz * * High cut-off frequency: 7.6 kHz * * Sampling frequency: 9.6 kHz * * * * OPERATING CONDITIONS: * * * * ***************************************** * * * CAUTION: MAXIMUM INPUT VOLTAGE: 3 V * * * ***************************************** * * * * ANALOG INPUT <- Function Generator * * * * ANALOG OUTPUT -> Oscilloscope * * * * * ************************************************************* * * * ASSEMBLING AND EXECUTION THROUGH DEBUGGER: * * * * You must assemble and link this program with the * * Assembler/linker provided while purchasing the EVM. * * * * DSPA -v50 DELAYOK1.ASM -> generates DELAYOK1.OBJ * * DSPLNK DELAYOK1.CMD * * EVMRST.EXE * * EVM5X.EXE * * LOAD DELAYOK1.OUT * * * * Then, reset the EVM board by typing RESET. * * Then, execute the EVM program by typing F5 or RUN * ************************************************************* .version 50 ;TMS320C50 .title "InitializeAIC" * Initialize the memory buffer .bss BUFFER,300 * Set addresses of circular buffer registers CBSR1 .set 1Ah CBER1 .set 1Bh CBSR2 .set 1Ch CBER2 .set 1Dh CBCR .set 1Eh .option XREF .mmregs ;Mapping registers validation ************************************************************************* * Set up the interrupt vector table in program memory and make the link * * between the interrupt vector and its associated interrupt subroutine. * * The interrupt vector table starts at 0000h, but location of serial * * port receive interrupt RINT is at 000Ah since it is the 6th in the * * interrupt table. * ************************************************************************* .sect "VECTOR" ;define interrupt vectors B START ;00: RESET .space 128 ; reserves 10 words of memory filled with 0's B RECEIVE ;0A: Serial port receive interrupt RINT B TRANSMIT ;0C: Serial port transmit interrupt XINT ************************* * START OF MAIN PROGRAM * ************************* .text ************************************************************ * TMS320C50 INITIALIZATION * ************************************************************ START DINT ; Disable interrupts LDP #0 ; Set data page pointer OPL #02Ch,PMST ; Configure 9K on-chip RAM as Data ; Disable internal ROM, AR0 in C5x mode SETC SXM ; Set sign extension mode CLRC CNF ; Configure Block as Data Memory LACC #0 ; Set Wait State Control Register SACL CWSR ; for 0 waits in pgm & data memory SACL PDWSR * initalizes and resets serial port LACC #0000000000001000b ; set FSM bit for FSX/FSR per frame SACL SPC ; Configure for 16 bit mode with LACC #0000000011001000b ; external CLKX, reset tx and rx SACL SPC LACC #0 SACL DXR ; clear first int SACL DRR ; clear first int * initializes circular buffer LACC #BUFFER ; indicates the beginning of the circular buffer SAMM CBSR1 ; and store it in CB start register SAMM AR7 ; AR7 is set to be the pointer of the CB ADD #300 ; length of buffer SAMM CBER1 ; store end address of buffer SPLK #0fh,CBCR ; enable CB#1, disable CB#2 and affects AR7 as pointer * Reset AIC by writing to PA2 (address >52) on EVM SPLK #0FFEFh,PA2 ; Pulse AIC reset by setting it low RPT #1000 ; and taking it high after 10000 cycles NOP ; (0.5ms at 50ns) SPLK #0ffffh,PA2 CALL aicinit ; initializes AIC and enables interrupts ***************************************************************************** * After the next 5 instructions, the serial port receive interrupt is * * enabled. When RINT is triggered, the receive interrupt subroutine * * (RECEIVE: ) is executed: it stores the data contained in the DRR register * * to Accumulator then stores it to the DXR register. * * Note: after the end of execution of the aicinit subroutine, the interrupt * * mask allows Receive interrupt only. * ***************************************************************************** LAMM DRR ;Purge DRR LAMM DRR ;Purge DRR EINT ;enable all interrupts ************************************************* * Infinite loop - Waiting for reception of data * * * * NB: the RINT interrupt is enabled * ************************************************* SYNC: B $ ;waiting for a new data to treat ;On a RINT, data is read then sent back. *********************** * END OF MAIN PROGRAM * *********************** ********************** * INTERRUPT ROUTINES * ********************** ************************************** * Receive Interrupt Service Routine * ************************************** RECEIVE: LAMM DRR SAMM AR1 ; store the sample value(in ACC) in AR1 MAR *,AR7 ; AR7 is set as current auxiliary register LAR AR2,* ; store the previous sample in AR2 LAMM AR2 ; store AR2 in ACC ADD AR1 ; add ACC and AR1 AND #1111111111111100b ; to secure primary transmission mode SAMM DXR ; place previous value in output SAR AR1,* ; Store AR1 in data memory ADD *+ ; AR7 is incremented RETE ************************************** * Transmit Interrupt Service Routine * ************************************** TRANSMIT: RETE ************* * FUNCTIONS * ************* ************************************************************************** * The AICINIT routine initializes the Serial Port and the TLC320C46 AIC, * * by the following steps: * * Step 1: Set the Timer frequency (10.368 MHz for AIC MCLK). * * Step 2: Configure frame synchronization signals. * * Step 3: Initialisation of the serial port * * Step 4: Initialisation of the AIC * * * ************************************************************************** .def aicinit * aic initialization data * * master clock = 10.368 MHz * scf clock = 172.8 kHz. * sample rate = 9.6 kHz. * Low-pass cut-off frequency = 4.56 kHz * AIC_CTR: gain=1, band-pass filter, synchro RX & TX, * : loopback disabled ***************************************************************************** * The aiccfg section configures the parameter values for TA, TB and AIC_CTR * * to the AIC for a 9.6 kHz sample rate with a gain setting of 1, BP enabled.* * The contents of TA and TB and AIC_CTR + 2 control bits configure a * * special 16 bit AIC DX DATA word for transmission to the AIC. * * * * NB: Sending such a parameter first requires a "secondary communication". * * This is made by writing 03h to the AIC. * ***************************************************************************** aiccfg .set $ .word 0000h ; first two silent padding .word 0000h ; ; d14 d10 d6 d2 d0 ; |d12| |d8 |d4 | ; | | | | | | | | ; v v v v v v v v ; .word 0000000000000011b ; initialize TA & RA ; ; after initiating a secondary ; ; transmission ; xx|TA |xx|RA | .word 0011110001111000b ; TA=RA=30 for 10.368 MHz clock ; cutting off at 4.56 kHz .word 0000000000000011b ; initialize TA'& RA' ; X|TA' |X|RA'| .word 0000000000000001b ; .word 0000000000000011b ; initialize TB & RB ; x| TB |x| RB | .word 0010010001001010b ; TB=RB=18 for 9.6kHz sampling .word 0000000000000011b ; init control flags ; xxxxxx| ctrl | .word 0000001000100111b ; ; | ||||| ; | |||| \_______ d2 = A/D highpass filter ; | ||| \________ d3 =NO loopback function ; | || \_________ d4 = Aux input pins ; | | \__________ d5 = synchronization of RX & TX ; | \___________ d6 & d7 = Gain; 0 & 0 = 1 ; | 0 & 1 = 4 ; | 1 & 0 = 2 ; | 1 & 1 = 1 ; | d8 = don't care ; \______________ d9 = second order sin x/x filter ; .word 0000h .word 0000h .word 0000h cfgend .word 0000h ; some more silent padding ****************************************************************** * DESCRIPTION: This routine initializes the TLC320C46 for * * a 9.6 kHz sample rate with a gain setting of 1 * ****************************************************************** aicinit .set $ mar *,ar6 ; load arp lar ar6,#0fff0h ; point to (end of buffer - 16) lacc #aiccfg ; load control word table start address rpt #13 ; move 10 configuration word to end of tblr *+ ; FIFO so it will be sent first to AIC. splk #0ffffh,arcr ; load end of table splk #0fff0h,ar6 ; and begining of table *********************************************************************** * The AIC_2ND routine initializes a secondary transmission, by the * * following steps: * * Step 1: enable serial port transmit interrupt * * Step 2: send 0000000000000011b to initiate a secondary transmission * * Step 3: wait until ready for new data (idle) * * Step 4: send AIC parameter * * Step 5: disable serial port transmit interrupt * * * * NB: The lower part of the accumulator contains the contents of * * the AIC DX DATA configuration word. The higher part contains * * a control word which initiates secondary transmission mode * *********************************************************************** aicwait bit SPC, 4 ; wait for xmit ready bcnd aicwait,NTC ; wait until xrdy goes high lacc *+ ; read next control word sacl DXR ; and send to dxr cmpr 0 ; check for end of table bcnd aicwait,NTC ; if pointer<>end, wait done splk #010000b,IMR ; Turn on receive and NOT xmit interupts splk #0,dxr ret .end *********************************************************************** ************************************************************* * (C) COPYRIGHT TEXAS INSTRUMENTS, INC. 1996 * ************************************************************* * MODULE NAME: AICEVM50.ASM * * * * FUNCTION: Sampling an analog input signal * * and sending each sample several times in * * follow to the analog output * * with an overall gain of 1 * * * * DESCRIPTION: This program initializes the TMS320C50 and * * TLC32046 on the C5x EVM Board. * * * * BAND-PASS: ON * * Low cut-off frequency: 300 Hz * * High cut-off frequency: 7.6 kHz * * Sampling frequency: 9.6 kHz * * * * OPERATING CONDITIONS: * * * * ***************************************** * * * CAUTION: MAXIMUM INPUT VOLTAGE: 3 V * * * ***************************************** * * * * ANALOG INPUT <- Function Generator * * * * ANALOG OUTPUT -> Oscilloscope * * * * * * ASSEMBLING AND DIRECT EXECUTION: * * * * You must assemble and link this program with the * * Assembler/linker provided while purchasing the EVM. * * * * DSPA -v50 AICEVM50.ASM -> generates AICEVM50.OBJ * * DSPLNK AICEVM50.CMD * * EVMLOAD AICEVM50.OUT * * * ************************************************************* * * * ASSEMBLING AND EXECUTION THROUGH DEBUGGER: * * * * You must assemble and link this program with the * * Assembler/linker provided while purchasing the EVM. * * * * DSPA -v50 AICEVM50.ASM -> generates AICEVM50.OBJ * * DSPLNK AICEVM50.CMD * * EVMRST.EXE * * EVM5X.EXE * * LOAD AICEVM50.OUT * * * * Then, reset the EVM board by typing RESET. * * Then, execute the EVM program by typing F5 or RUN * ************************************************************* .version 50 ;TMS320C50 .title "InitializeAIC" .option XREF .mmregs ;Mapping registers validation ************************************************************************* * Set up the interrupt vector table in program memory and make the link * * between the interrupt vector and its associated interrupt subroutine. * * The interrupt vector table starts at 0000h, but location of serial * * port receive interrupt RINT is at 000Ah since it is the 6th in the * * interrupt table. * ************************************************************************* * .sect "VECTOR" ;define interrupt vectors B START ;00: RESET .space 128 ; reserves 10 words of memory filled with 0's B RECEIVE ;0A: Serial port receive interrupt RINT B TRANSMIT ;0C: Serial port transmit interrupt XINT ************************* * START OF MAIN PROGRAM * ************************* .text ************************************************************ * TMS320C50 INITIALIZATION ************************************************************ START DINT ; Disable interrupts LDP #0 ; Set data page pointer OPL #02Ch,PMST ; Configure 9K on-chip RAM as Data ; Disable internal ROM, AR0 in C5x mode SETC SXM ; Set sign extension mode CLRC CNF ; Configure Block as Data Memory LACC #0 ; Set Wait State Control Register SACL CWSR ; for 0 waits in pgm & data memory SACL PDWSR * initalizes and resets serial port LACC #0000000000001000b ; set FSM bit for FSX/FSR per frame SACL SPC ; Configure for 16 bit mode with LACC #0000000011001000b ; external CLKX, reset tx and rx SACL SPC LACC #0 SACL DXR ; clear first int SACL DRR ; clear first int * Reset AIC by writing to PA2 (address >52) on EVM SPLK #0FFEFh,PA2 ; Pulse AIC reset by setting it low RPT #1000 ; and taking it high after 10000 cycles NOP ; (0.5ms at 50ns) SPLK #0ffffh,PA2 CALL aicinit ; initializes AIC and enables interrupts ***************************************************************************** * After the next 5 instructions, the serial port receive interrupt is * * enabled. When RINT is triggered, the receive interrupt subroutine * * (RECEIVE: ) is executed: it stores the data contained in the DRR register * * to Accumulator then stores it to the DXR register. * * Note: after the end of execution of the aicinit subroutine, the interrupt * * mask allows Receive interrupt only. * ***************************************************************************** LAMM DRR ; Purge DRR LAMM DRR ; Purge DRR EINT ; enable all interrupts ************************************************* * Infinite loop - Waiting for reception of data * * * * NB: the RINT interrupt is enabled * ************************************************* SYNC: B $ ; waiting for a new data to treat ; On a RINT, data is read then sent back. *********************** * END OF MAIN PROGRAM * *********************** ********************** * INTERRUPT ROUTINES * ********************** ************************************** * Receive Interrupt Service Routine * ************************************** RECEIVE: LAMM DRR AND #1111111111111100b ; to secure primary transmission mode RPT #1fffh SAMM DXR RETE ************************************** * Transmit Interrupt Service Routine * ************************************** TRANSMIT: RETE ************* * FUNCTIONS * ************* ************************************************************************** * The AICINIT routine initializes the Serial Port and the TLC320C46 AIC, * * by the following steps: * * Step 1: Set the Timer frequency (10.368 MHz for AIC MCLK). * * Step 2: Configure frame synchronization signals. * * Step 3: Initialisation of the serial port * * Step 4: Initialisation of the AIC * * * ************************************************************************** .def aicinit * aic initialization data * * master clock = 10.368 MHz * scf clock = 172.8 kHz. * sample rate = 9.6 kHz. * Low-pass cut-off frequency = 4.56 kHz * AIC_CTR: gain=1, band-pass filter, synchro RX & TX, * : loopback disabled ***************************************************************************** * The aiccfg section configures the parameter values for TA, TB and AIC_CTR * * to the AIC for a 9.6 kHz sample rate with a gain setting of 1, BP enabled.* * The contents of TA and TB and AIC_CTR + 2 control bits configure a * * special 16 bit AIC DX DATA word for transmission to the AIC. * * * * NB: Sending such a parameter first requires a "secondary communication". * * This is made by writing 03h to the AIC. * ***************************************************************************** aiccfg .set $ .word 0000h ; first two silent padding .word 0000h ; ; d14 d10 d6 d2 d0 ; |d12| |d8 |d4 | ; | | | | | | | | ; v v v v v v v v ; .word 0000000000000011b ; initialize TA & RA ; ; after initiating a secondary ; ; transmission ; xx|TA |xx|RA | .word 0011110001111000b ; TA=RA=30 for 10.368 MHz clock ; cutting off at 4.56 kHz .word 0000000000000011b ; initialize TA'& RA' ; X|TA' |X|RA'| .word 0000000000000001b ; .word 0000000000000011b ; initialize TB & RB ; x| TB |x| RB | .word 0010010001001010b ; TB=RB=18 for 9.6kHz sampling .word 0000000000000011b ; init control flags ; xxxxxx| ctrl | .word 0000001000100111b ; ; | ||||| ; | |||| \_______ d2 = A/D highpass filter ; | ||| \________ d3 =NO loopback function ; | || \_________ d4 = Aux input pins ; | | \__________ d5 = synchronization of RX & TX ; | \___________ d6 & d7 = Gain; 0 & 0 = 1 ; | 0 & 1 = 4 ; | 1 & 0 = 2 ; | 1 & 1 = 1 ; | d8 = don't care ; \______________ d9 = second order sin x/x filter ; .word 0000h .word 0000h .word 0000h cfgend .word 0000h ; some more silent padding ****************************************************************** * DESCRIPTION: This routine initializes the TLC320C46 for * * a 9.6 kHz sample rate with a gain setting of 1 * ****************************************************************** aicinit .set $ mar *,ar6 ; load arp lar ar6,#0fff0h ; point to (end of buffer - 16) lacc #aiccfg ; load control word table start address rpt #13 ; move 10 configuration word to end of tblr *+ ; FIFO so it will be sent first to AIC. splk #0ffffh,arcr ; load end of table splk #0fff0h,ar6 ; and begining of table *********************************************************************** * The AIC_2ND routine initializes a secondary transmission, by the * * following steps: * * Step 1: enable serial port transmit interrupt * * Step 2: send 0000000000000011b to initiate a secondary transmission * * Step 3: wait until ready for new data (idle) * * Step 4: send AIC parameter * * Step 5: disable serial port transmit interrupt * * * * NB: The lower part of the accumulator contains the contents of * * the AIC DX DATA configuration word. The higher part contains * * a control word which initiates secondary transmission mode * *********************************************************************** aicwait bit SPC, 4 ; wait for xmit ready bcnd aicwait,NTC ; wait until xrdy goes high lacc *+ ; read next control word sacl DXR ; and send to dxr cmpr 0 ; check for end of table bcnd aicwait,NTC ; if pointer<>end, wait done splk #010000b,IMR ; Turn on receive and NOT xmit interupts splk #0,dxr ret .end *********************************************************************** ************************************************************* * (C) COPYRIGHT ISEN SYSTEM,INC. 1998 * ************************************************************* * MODULE NAME: DBLDELAY.ASM * * * * FUNCTION: Sampling an analog input signal * * and sending it to analog output * * with an overall gain of 1 and a * * double repetition of the note played. * * * * DESCRIPTION: This program initializes the TMS320C50 and * * TLC32046 on the C5x EVM Board. * * * * BAND-PASS: ON * * Low cut-off frequency: 300 Hz * * High cut-off frequency: 7.6 kHz * * Sampling frequency: 9.6 kHz * * * * OPERATING CONDITIONS: * * * * ***************************************** * * * CAUTION: MAXIMUM INPUT VOLTAGE: 3 V * * * ***************************************** * * * * ANALOG INPUT <- Function Generator * * * * ANALOG OUTPUT -> Oscilloscope * * * * * ************************************************************* * * * ASSEMBLING AND EXECUTION THROUGH DEBUGGER: * * * * You must assemble and link this program with the * * Assembler/linker provided while purchasing the EVM. * * * * DSPA -v50 DBLDELAY.ASM -> generates DELAYOK1.OBJ * * DSPLNK DBLDELAY.CMD * * EVMRST.EXE * * EVM5X.EXE * * LOAD DBLDELAY.OUT * * * * Then, reset the EVM board by typing RESET. * * Then, execute the EVM program by typing F5 or RUN * ************************************************************* .version 50 ;TMS320C50 .title "InitializeAIC" * Initialize the memory buffer .bss BUFFER,3002 * Set addresses of circular buffer registers CBSR1 .set 1Ah CBER1 .set 1Bh CBSR2 .set 1Ch CBER2 .set 1Dh CBCR .set 1Eh .option XREF .mmregs ;Mapping registers validation ************************************************************************* * Set up the interrupt vector table in program memory and make the link * * between the interrupt vector and its associated interrupt subroutine. * * The interrupt vector table starts at 0000h, but location of serial * * port receive interrupt RINT is at 000Ah since it is the 6th in the * * interrupt table. * ************************************************************************* * .sect "VECTOR" ;define interrupt vectors B START ;00: RESET .space 128 ; reserves 10 words of memory filled with 0's B RECEIVE ;0A: Serial port receive interrupt RINT B TRANSMIT ;0C: Serial port transmit interrupt XINT ************************* * START OF MAIN PROGRAM * ************************* .text ************************************************************ * TMS320C50 INITIALIZATION ************************************************************ START DINT ; Disable interrupts LDP #0 ; Set data page pointer OPL #02Ch,PMST ; Configure 9K on-chip RAM as Data ; Disable internal ROM, AR0 in C5x mode SETC SXM ;Set sign extension mode CLRC CNF ;Configure Block as Data Memory LACC #0 ; Set Wait State Control Register SACL CWSR ; for 0 waits in pgm & data memory SACL PDWSR * initalizes and resets serial port LACC #0000000000001000b ; set FSM bit for FSX/FSR per frame SACL SPC ; Configure for 16 bit mode with LACC #0000000011001000b ; external CLKX, reset tx and rx SACL SPC LACC #0 SACL DXR ; clear first int SACL DRR ; clear first int * initializes circular buffer1 LACC #BUFFER ; indicates the beginning of the circular buffer SAMM CBSR1 ;and store it in CB start register SAMM AR7 ; AR7 is set to be the pointer of the CB ADD #2000 ; length of buffer SAMM CBER1 ; store end address of buffer * initializes circular buffer2 LACC #BUFFER ; indicates the beginning of the circular buffer SAMM CBSR2 ;and store it in CB start register SAMM AR4 ; AR4 is set to be the pointer of the CB ADD #1000 ; length of buffer SAMM CBER2 ; store end address of buffer SPLK #0cfh,CBCR ; enable CB#1, enable CB#2 and affects AR7 as pointer * of CB1 and AR4 as pointer of CB2 * Reset AIC by writing to PA2 (address >52) on EVM SPLK #0FFEFh,PA2 ; Pulse AIC reset by setting it low RPT #1000 ; and taking it high after 10000 cycles NOP ; (0.5ms at 50ns) SPLK #0ffffh,PA2 CALL aicinit ; initializes AIC and enables interrupts ***************************************************************************** * After the next 5 instructions, the serial port receive interrupt is * * enabled. When RINT is triggered, the receive interrupt subroutine * * (RECEIVE: ) is executed: it stores the data contained in the DRR register * * to Accumulator then stores it to the DXR register. * * Note: after the end of execution of the aicinit subroutine, the interrupt * * mask allows Receive interrupt only. * ***************************************************************************** LAMM DRR ;Purge DRR LAMM DRR ;Purge DRR EINT ;enable all interrupts ************************************************* * Infinite loop - Waiting for reception of data * * * * NB: the RINT interrupt is enabled * ************************************************* SYNC: B $ ;waiting for a new data to treat ;On a RINT, data is read then sent back. *********************** * END OF MAIN PROGRAM * *********************** ********************** * INTERRUPT ROUTINES * ********************** ************************************** * Receive Interrupt Service Routine * ************************************** RECEIVE: LAMM DRR SAMM AR1 ;store the sample value(in ACC) in AR1 MAR *,AR7 ;AR7 is set as current auxiliary register LAR AR2,* ;store the previous sample of CB1 in AR2 MAR *,AR4 ;AR4 is now the current auxiliary register LAR AR3,* ;store the previous sample of cb2 in AR3 SAR AR2,* LAMM AR2 ADD AR1 ;addition of the delayed signals and the source ADD AR3 AND #1111111111111100b ; to secure primary transmission mode SAMM DXR ;place previous value in output ADD *+ ;AR4 is incremented MAR *,AR7 ; SAR AR1,* ;store the new value in CB1 ADD *+ ; RETE ************************************** * Transmit Interrupt Service Routine * ************************************** TRANSMIT: RETE ************* * FUNCTIONS * ************* ************************************************************************** * The AICINIT routine initializes the Serial Port and the TLC320C46 AIC, * * by the following steps: * * Step 1: Set the Timer frequency (10.368 MHz for AIC MCLK). * * Step 2: Configure frame synchronization signals. * * Step 3: Initialisation of the serial port * * Step 4: Initialisation of the AIC * * * ************************************************************************** .def aicinit * aic initialization data * * master clock = 10.368 MHz * scf clock = 172.8 kHz. * sample rate = 9.6 kHz. * Low-pass cut-off frequency = 4.56 kHz * AIC_CTR: gain=1, band-pass filter, synchro RX & TX, * : loopback disabled ***************************************************************************** * The aiccfg section configures the parameter values for TA, TB and AIC_CTR * * to the AIC for a 9.6 kHz sample rate with a gain setting of 1, BP enabled.* * The contents of TA and TB and AIC_CTR + 2 control bits configure a * * special 16 bit AIC DX DATA word for transmission to the AIC. * * * * NB: Sending such a parameter first requires a "secondary communication". * * This is made by writing 03h to the AIC. * ***************************************************************************** aiccfg .set $ .word 0000h ; first two silent padding .word 0000h ; ; d14 d10 d6 d2 d0 ; |d12| |d8 |d4 | ; | | | | | | | | ; v v v v v v v v ; .word 0000000000000011b ; initialize TA & RA ; ; after initiating a secondary ; ; transmission ; xx|TA |xx|RA | .word 0011110001111000b ; TA=RA=30 for 10.368 MHz clock ; cutting off at 4.56 kHz .word 0000000000000011b ; initialize TA'& RA' ; X|TA' |X|RA'| .word 0000000000000001b ; .word 0000000000000011b ; initialize TB & RB ; x| TB |x| RB | .word 0010010001001010b ; TB=RB=18 for 9.6kHz sampling .word 0000000000000011b ; init control flags ; xxxxxx| ctrl | .word 0000001000100111b ; ; | ||||| ; | |||| \_______ d2 = A/D highpass filter ; | ||| \________ d3 =NO loopback function ; | || \_________ d4 = Aux input pins ; | | \__________ d5 = synchronization of RX & TX ; | \___________ d6 & d7 = Gain; 0 & 0 = 1 ; | 0 & 1 = 4 ; | 1 & 0 = 2 ; | 1 & 1 = 1 ; | d8 = don't care ; \______________ d9 = second order sin x/x filter ; .word 0000h .word 0000h .word 0000h cfgend .word 0000h ; some more silent padding ****************************************************************** * DESCRIPTION: This routine initializes the TLC320C46 for * * a 9.6 kHz sample rate with a gain setting of 1 * ****************************************************************** aicinit .set $ mar *,ar6 ; load arp lar ar6,#0fff0h ; point to (end of buffer - 16) lacc #aiccfg ; load control word table start address rpt #13 ; move 10 configuration word to end of tblr *+ ; FIFO so it will be sent first to AIC. splk #0ffffh,arcr ; load end of table splk #0fff0h,ar6 ; and begining of table *********************************************************************** * The AIC_2ND routine initializes a secondary transmission, by the * * following steps: * * Step 1: enable serial port transmit interrupt * * Step 2: send 0000000000000011b to initiate a secondary transmission * * Step 3: wait until ready for new data (idle) * * Step 4: send AIC parameter * * Step 5: disable serial port transmit interrupt * * * * NB: The lower part of the accumulator contains the contents of * * the AIC DX DATA configuration word. The higher part contains * * a control word which initiates secondary transmission mode * *********************************************************************** aicwait bit SPC, 4 ; wait for xmit ready bcnd aicwait,NTC ; wait until xrdy goes high lacc *+ ; read next control word sacl DXR ; and send to dxr cmpr 0 ; check for end of table bcnd aicwait,NTC ; if pointer<>end, wait done splk #010000b,IMR ; Turn on receive and NOT xmit interupts splk #0,dxr ret .end *********************************************************************** ************************************************************* * (C) COPYRIGHT ISEN SYSTEM,INC. 1998 * ************************************************************* * MODULE NAME: EFFECT2.ASM * * * * FUNCTION: Sampling an analog input signal * * and sending it to analog output * * with an overall gain of 1 and a * * delay. * * * * DESCRIPTION: This program initializes the TMS320C50 and * * TLC32046 on the C5x EVM Board. * * * * BAND-PASS: ON * * Low cut-off frequency: 300 Hz * * High cut-off frequency: 7.6 kHz * * Sampling frequency: 9.6 kHz * * * * OPERATING CONDITIONS: * * * * ***************************************** * * * CAUTION: MAXIMUM INPUT VOLTAGE: 3 V * * * ***************************************** * * * * ANALOG INPUT <- Function Generator * * * * ANALOG OUTPUT -> Oscilloscope * * * * * ************************************************************* * * * ASSEMBLING AND EXECUTION THROUGH DEBUGGER: * * * * You must assemble and link this program with the * * Assembler/linker provided while purchasing the EVM. * * * * DSPA -v50 EFFECT2.ASM -> generates DELAYOK1.OBJ * * DSPLNK EFFECT2.CMD * * EVMRST.EXE * * EVM5X.EXE * * LOAD EFFECT2.OUT * * * * Then, reset the EVM board by typing RESET. * * Then, execute the EVM program by typing F5 or RUN * ************************************************************* .version 50 ;TMS320C50 .title "InitializeAIC" * Initialize the memory buffer .bss BUFFER,300 * Set addresses of circular buffer registers CBSR1 .set 1Ah CBER1 .set 1Bh CBSR2 .set 1Ch CBER2 .set 1Dh CBCR .set 1Eh .option XREF .mmregs ;Mapping registers validation ************************************************************************* * Set up the interrupt vector table in program memory and make the link * * between the interrupt vector and its associated interrupt subroutine. * * The interrupt vector table starts at 0000h, but location of serial * * port receive interrupt RINT is at 000Ah since it is the 6th in the * * interrupt table. * ************************************************************************* * .sect "VECTOR" ;define interrupt vectors B START ;00: RESET .space 128 ; reserves 10 words of memory filled with 0's B RECEIVE ;0A: Serial port receive interrupt RINT B TRANSMIT ;0C: Serial port transmit interrupt XINT ************************* * START OF MAIN PROGRAM * ************************* .text ************************************************************ * TMS320C50 INITIALIZATION ************************************************************ START DINT ; Disable interrupts LDP #0 ; Set data page pointer OPL #02Ch,PMST ; Configure 9K on-chip RAM as Data ; Disable internal ROM, AR0 in C5x mode SETC SXM ;Set sign extension mode CLRC CNF ;Configure Block as Data Memory LACC #0 ; Set Wait State Control Register SACL CWSR ; for 0 waits in pgm & data memory SACL PDWSR * initalizes and resets serial port LACC #0000000000001000b ; set FSM bit for FSX/FSR per frame SACL SPC ; Configure for 16 bit mode with LACC #0000000011001000b ; external CLKX, reset tx and rx SACL SPC LACC #0 SACL DXR ; clear first int SACL DRR ; clear first int * initializes circular buffer LACC #BUFFER ; indicates the beginning of the circular buffer SAMM CBSR1 ;and store it in CB start register SAMM AR7 ; AR7 is set to be the pointer of the CB ADD #300 ; length of buffer SAMM CBER1 ; store end address of buffer SPLK #0fh,CBCR ; enable CB#1, disable CB#2 and affects AR7 as pointer * Reset AIC by writing to PA2 (address >52) on EVM SPLK #0FFEFh,PA2 ; Pulse AIC reset by setting it low RPT #1000 ; and taking it high after 10000 cycles NOP ; (0.5ms at 50ns) SPLK #0ffffh,PA2 CALL aicinit ; initializes AIC and enables interrupts ***************************************************************************** * After the next 5 instructions, the serial port receive interrupt is * * enabled. When RINT is triggered, the receive interrupt subroutine * * (RECEIVE: ) is executed: it stores the data contained in the DRR register * * to Accumulator then stores it to the DXR register. * * Note: after the end of execution of the aicinit subroutine, the interrupt * * mask allows Receive interrupt only. * ***************************************************************************** LAMM DRR ;Purge DRR LAMM DRR ;Purge DRR LAR AR4,#0 ;initialize AR4 to 0 EINT ;enable all interrupts ************************************************* * Infinite loop - Waiting for reception of data * * * * NB: the RINT interrupt is enabled * ************************************************* SYNC: B $ ;waiting for a new data to treat ;On a RINT, data is read then sent back. *********************** * END OF MAIN PROGRAM * *********************** ********************** * INTERRUPT ROUTINES * ********************** ************************************** * Receive Interrupt Service Routine * ************************************** RECEIVE: LAMM DRR SAMM AR1 ;store the sample value(in ACC) in AR1 MAR *,AR7 ;AR7 is set as current auxiliary register LAR AR2,* ;store the previous sample in AR2 LAMM AR4 BCND TAKE,EQ done1 BCND NOTAKE,NEQ done2 LAMM AR3 ADD AR1 AND #1111111111111100b ; to secure primary transmission mode SAMM DXR ;place previous value in output SAR AR1,* ;Store AR1 in data memory ADD *+ ;AR7 is incremented RETE TAKE: LAMM AR2 SAMM AR3 LACL #0 LAR AR4,#1 B done1 NOTAKE: NOP LAR AR4,#0 B done2 ************************************** * Transmit Interrupt Service Routine * ************************************** TRANSMIT: RETE ************* * FUNCTIONS * ************* ************************************************************************** * The AICINIT routine initializes the Serial Port and the TLC320C46 AIC, * * by the following steps: * * Step 1: Set the Timer frequency (10.368 MHz for AIC MCLK). * * Step 2: Configure frame synchronization signals. * * Step 3: Initialisation of the serial port * * Step 4: Initialisation of the AIC * * * ************************************************************************** .def aicinit * aic initialization data * * master clock = 10.368 MHz * scf clock = 172.8 kHz. * sample rate = 9.6 kHz. * Low-pass cut-off frequency = 4.56 kHz * AIC_CTR: gain=1, band-pass filter, synchro RX & TX, * : loopback disabled ***************************************************************************** * The aiccfg section configures the parameter values for TA, TB and AIC_CTR * * to the AIC for a 9.6 kHz sample rate with a gain setting of 1, BP enabled.* * The contents of TA and TB and AIC_CTR + 2 control bits configure a * * special 16 bit AIC DX DATA word for transmission to the AIC. * * * * NB: Sending such a parameter first requires a "secondary communication". * * This is made by writing 03h to the AIC. * ***************************************************************************** aiccfg .set $ .word 0000h ; first two silent padding .word 0000h ; ; d14 d10 d6 d2 d0 ; |d12| |d8 |d4 | ; | | | | | | | | ; v v v v v v v v ; .word 0000000000000011b ; initialize TA & RA ; ; after initiating a secondary ; ; transmission ; xx|TA |xx|RA | .word 0011110001111000b ; TA=RA=30 for 10.368 MHz clock ; cutting off at 4.56 kHz .word 0000000000000011b ; initialize TA'& RA' ; X|TA' |X|RA'| .word 0000000000000001b ; .word 0000000000000011b ; initialize TB & RB ; x| TB |x| RB | .word 0010010001001010b ; TB=RB=18 for 9.6kHz sampling .word 0000000000000011b ; init control flags ; xxxxxx| ctrl | .word 0000001000100111b ; ; | ||||| ; | |||| \_______ d2 = A/D highpass filter ; | ||| \________ d3 =NO loopback function ; | || \_________ d4 = Aux input pins ; | | \__________ d5 = synchronization of RX & TX ; | \___________ d6 & d7 = Gain; 0 & 0 = 1 ; | 0 & 1 = 4 ; | 1 & 0 = 2 ; | 1 & 1 = 1 ; | d8 = don't care ; \______________ d9 = second order sin x/x filter ; .word 0000h .word 0000h .word 0000h cfgend .word 0000h ; some more silent padding ****************************************************************** * DESCRIPTION: This routine initializes the TLC320C46 for * * a 9.6 kHz sample rate with a gain setting of 1 * ****************************************************************** aicinit .set $ mar *,ar6 ; load arp lar ar6,#0fff0h ; point to (end of buffer - 16) lacc #aiccfg ; load control word table start address rpt #13 ; move 10 configuration word to end of tblr *+ ; FIFO so it will be sent first to AIC. splk #0ffffh,arcr ; load end of table splk #0fff0h,ar6 ; and begining of table *********************************************************************** * The AIC_2ND routine initializes a secondary transmission, by the * * following steps: * * Step 1: enable serial port transmit interrupt * * Step 2: send 0000000000000011b to initiate a secondary transmission * * Step 3: wait until ready for new data (idle) * * Step 4: send AIC parameter * * Step 5: disable serial port transmit interrupt * * * * NB: The lower part of the accumulator contains the contents of * * the AIC DX DATA configuration word. The higher part contains * * a control word which initiates secondary transmission mode * *********************************************************************** aicwait bit SPC, 4 ; wait for xmit ready bcnd aicwait,NTC ; wait until xrdy goes high lacc *+ ; read next control word sacl DXR ; and send to dxr cmpr 0 ; check for end of table bcnd aicwait,NTC ; if pointer<>end, wait done splk #010000b,IMR ; Turn on receive and NOT xmit interupts splk #0,dxr ret .end *********************************************************************** ************************************************************* * (C) COPYRIGHT ISEN SYSTEM,INC. 1998 * ************************************************************* * MODULE NAME: DBLDELAY.ASM * * * * FUNCTION: Sampling an analog input signal * * and sending it to analog output * * with an overall gain of 1 and a * * double repetition of the note played. * * * * * * * * ____[delay1]___ * * / \ * * input______/ /+\_____ output * * \ \+/ * * \____[delay2]___/ * * * * * * DESCRIPTION: This program initializes the TMS320C50 and * * TLC32046 on the C5x EVM Board. * * * * BAND-PASS: ON * * Low cut-off frequency: 300 Hz * * High cut-off frequency: 7.6 kHz * * Sampling frequency: 9.6 kHz * * * * OPERATING CONDITIONS: * * * * ***************************************** * * * CAUTION: MAXIMUM INPUT VOLTAGE: 3 V * * * ***************************************** * * * * ANALOG INPUT <- Function Generator * * * * ANALOG OUTPUT -> Oscilloscope * * * * * ************************************************************* * * * ASSEMBLING AND EXECUTION THROUGH DEBUGGER: * * * * You must assemble and link this program with the * * Assembler/linker provided while purchasing the EVM. * * * * DSPA -v50 DBLDELAY.ASM -> generates DELAYOK1.OBJ * * DSPLNK DBLDELAY.CMD * * EVMRST.EXE * * EVM5X.EXE * * LOAD DBLDELAY.OUT * * * * Then, reset the EVM board by typing RESET. * * Then, execute the EVM program by typing F5 or RUN * ************************************************************* .version 50 ;TMS320C50 .title "InitializeAIC" * Initialize the memory buffer .bss BUFFER,2002 * Set addresses of circular buffer registers CBSR1 .set 1Ah CBER1 .set 1Bh CBSR2 .set 1Ch CBER2 .set 1Dh CBCR .set 1Eh .option XREF .mmregs ;Mapping registers validation ************************************************************************* * Set up the interrupt vector table in program memory and make the link * * between the interrupt vector and its associated interrupt subroutine. * * The interrupt vector table starts at 0000h, but location of serial * * port receive interrupt RINT is at 000Ah since it is the 6th in the * * interrupt table. * ************************************************************************* .sect "VECTOR" ;define interrupt vectors B START ;00: RESET .space 128 ; reserves 10 words of memory filled with 0's B RECEIVE ;0A: Serial port receive interrupt RINT B TRANSMIT ;0C: Serial port transmit interrupt XINT ************************* * START OF MAIN PROGRAM * ************************* .text ************************************************************ * TMS320C50 INITIALIZATION ************************************************************ START DINT ; Disable interrupts LDP #0 ; Set data page pointer OPL #02Ch,PMST ; Configure 9K on-chip RAM as Data ; Disable internal ROM, AR0 in C5x mode SETC SXM ;Set sign extension mode CLRC CNF ;Configure Block as Data Memory LACC #0 ; Set Wait State Control Register SACL CWSR ; for 0 waits in pgm & data memory SACL PDWSR * initalizes and resets serial port LACC #0000000000001000b ; set FSM bit for FSX/FSR per frame SACL SPC ; Configure for 16 bit mode with LACC #0000000011001000b ; external CLKX, reset tx and rx SACL SPC LACC #0 SACL DXR ; clear first int SACL DRR ; clear first int * initializes circular buffer1 LACC #BUFFER ; indicates the beginning of the circular buffer SAMM CBSR1 ; and store it in CB start register SAMM AR7 ; AR7 is set to be the pointer of the CB ADD #1000 ; length of buffer SAMM CBER1 ; store end address of buffer * initializes circular buffer2 LACC #BUFFER ; indicates the beginning of the circular buffer ADD #1001 ; length of buffer SAMM CBSR2 ; and store it in CB start register SAMM AR4 ; AR4 is set to be the pointer of the CB ADD #1000 ; length of buffer SAMM CBER2 ; store end address of buffer SPLK #0cfh,CBCR ; enable CB#1, enable CB#2 and affects AR7 as pointer * of CB1 and AR4 as pointer of CB2 * Reset AIC by writing to PA2 (address >52) on EVM SPLK #0FFEFh,PA2 ; Pulse AIC reset by setting it low RPT #1000 ; and taking it high after 10000 cycles NOP ; (0.5ms at 50ns) SPLK #0ffffh,PA2 CALL aicinit ; initializes AIC and enables interrupts ***************************************************************************** * After the next 5 instructions, the serial port receive interrupt is * * enabled. When RINT is triggered, the receive interrupt subroutine * * (RECEIVE: ) is executed: it stores the data contained in the DRR register * * to Accumulator then stores it to the DXR register. * * Note: after the end of execution of the aicinit subroutine, the interrupt * * mask allows Receive interrupt only. * ***************************************************************************** LAMM DRR ;Purge DRR LAMM DRR ;Purge DRR EINT ;enable all interrupts ************************************************* * Infinite loop - Waiting for reception of data * * * * NB: the RINT interrupt is enabled * ************************************************* SYNC: B $ ;waiting for a new data to treat ;On a RINT, data is read then sent back. *********************** * END OF MAIN PROGRAM * *********************** ********************** * INTERRUPT ROUTINES * ********************** ************************************** * Receive Interrupt Service Routine * ************************************** RECEIVE: LAMM DRR SAMM AR1 ; store the sample value(in ACC) in AR1 MAR *,AR7 ; AR7 is set as current auxiliary register LAR AR2,* ; store the previous sample of CB1 in AR2 MAR *,AR4 ; AR4 is now the current auxiliary register LAR AR3,* ; store the previous sample of cb2 in AR3 SAR AR2,* ; store the previous sample of CB1 in CB2 LAMM AR2 ADD AR1 ; addition of the delayed signals and the source ADD AR3 AND #1111111111111100b ; to secure primary transmission mode SAMM DXR ; place previous value in output ADD *+ ; AR4 is incremented MAR *,AR7 ; change the curent register SAR AR1,* ; store the new value in CB1 ADD *+ ; RETE ************************************** * Transmit Interrupt Service Routine * ************************************** TRANSMIT: RETE ************* * FUNCTIONS * ************* ************************************************************************** * The AICINIT routine initializes the Serial Port and the TLC320C46 AIC, * * by the following steps: * * Step 1: Set the Timer frequency (10.368 MHz for AIC MCLK). * * Step 2: Configure frame synchronization signals. * * Step 3: Initialisation of the serial port * * Step 4: Initialisation of the AIC * * * ************************************************************************** .def aicinit * aic initialization data * * master clock = 10.368 MHz * scf clock = 172.8 kHz. * sample rate = 9.6 kHz. * Low-pass cut-off frequency = 4.56 kHz * AIC_CTR: gain=1, band-pass filter, synchro RX & TX, * : loopback disabled ***************************************************************************** * The aiccfg section configures the parameter values for TA, TB and AIC_CTR * * to the AIC for a 9.6 kHz sample rate with a gain setting of 1, BP enabled.* * The contents of TA and TB and AIC_CTR + 2 control bits configure a * * special 16 bit AIC DX DATA word for transmission to the AIC. * * * * NB: Sending such a parameter first requires a "secondary communication". * * This is made by writing 03h to the AIC. * ***************************************************************************** aiccfg .set $ .word 0000h ; first two silent padding .word 0000h ; ; d14 d10 d6 d2 d0 ; |d12| |d8 |d4 | ; | | | | | | | | ; v v v v v v v v ; .word 0000000000000011b ; initialize TA & RA ; ; after initiating a secondary ; ; transmission ; xx|TA |xx|RA | .word 0011110001111000b ; TA=RA=30 for 10.368 MHz clock ; cutting off at 4.56 kHz .word 0000000000000011b ; initialize TA'& RA' ; X|TA' |X|RA'| .word 0000000000000001b ; .word 0000000000000011b ; initialize TB & RB ; x| TB |x| RB | .word 0010010001001010b ; TB=RB=18 for 9.6kHz sampling .word 0000000000000011b ; init control flags ; xxxxxx| ctrl | .word 0000001000100111b ; ; | ||||| ; | |||| \_______ d2 = A/D highpass filter ; | ||| \________ d3 =NO loopback function ; | || \_________ d4 = Aux input pins ; | | \__________ d5 = synchronization of RX & TX ; | \___________ d6 & d7 = Gain; 0 & 0 = 1 ; | 0 & 1 = 4 ; | 1 & 0 = 2 ; | 1 & 1 = 1 ; | d8 = don't care ; \______________ d9 = second order sin x/x filter ; .word 0000h .word 0000h .word 0000h cfgend .word 0000h ; some more silent padding ****************************************************************** * DESCRIPTION: This routine initializes the TLC320C46 for * * a 9.6 kHz sample rate with a gain setting of 1 * ****************************************************************** aicinit .set $ mar *,ar6 ; load arp lar ar6,#0fff0h ; point to (end of buffer - 16) lacc #aiccfg ; load control word table start address rpt #13 ; move 10 configuration word to end of tblr *+ ; FIFO so it will be sent first to AIC. splk #0ffffh,arcr ; load end of table splk #0fff0h,ar6 ; and begining of table *********************************************************************** * The AIC_2ND routine initializes a secondary transmission, by the * * following steps: * * Step 1: enable serial port transmit interrupt * * Step 2: send 0000000000000011b to initiate a secondary transmission * * Step 3: wait until ready for new data (idle) * * Step 4: send AIC parameter * * Step 5: disable serial port transmit interrupt * * * * NB: The lower part of the accumulator contains the contents of * * the AIC DX DATA configuration word. The higher part contains * * a control word which initiates secondary transmission mode * *********************************************************************** aicwait bit SPC, 4 ; wait for xmit ready bcnd aicwait,NTC ; wait until xrdy goes high lacc *+ ; read next control word sacl DXR ; and send to dxr cmpr 0 ; check for end of table bcnd aicwait,NTC ; if pointer<>end, wait done splk #010000b,IMR ; Turn on receive and NOT xmit interupts splk #0,dxr ret .end *********************************************************************** /* TMS320C50 EVM LINKER COMMAND FILE */ delayok1.obj /* input file*/ -o delayok1.out /* output file*/ -m delayok1.map /* map file */ /* MP=1, microprocessor mode, all program space in external access*/ /* CNF=0, all RAM capacity for data space, maximum external program*/ /* RAM=0, all RAM capacity internal*/ /* OVLY=1, all RAM capacity internal*/ MEMORY { PAGE 0: /*Program space */ VECS : o = 0000H , l = 0030H /*Std.Vectors */ PROG : o = 0800H , l = 02400H /*internal*/ PAGE 1: /*Data space */ REGS : o = 0000H , l = 0060H /*MMR'S */ BLKB2 : o = 0060H , l = 0020H /*BLK B2 */ B0 : o = 0100H , l = 0200H /*BLK B0 */ B1 : o = 0300H , l = 0200H /*BLK B1,DARAM */ RAM : o = 0800H , l = 2400H /*Internal Mem 9k RAM*/ EXT : o = 2c00H , l = 0D400H /*External Mem*/ PAGE 2: PORT2 : o = 0052H , l = 0001H /*Dialog with AIC*/ } SECTIONS { .text : {} > PROG PAGE 0 /*Code in Prog memory*/ .data : {} > B1 PAGE 1 /*Variables in Data memory*/ .bss : {} > PROG PAGE 0 VECTOR: {} > VECS PAGE 0 /*Interrupt vectors*/ }