Post on 08-Dec-2015
description
EXP. NO. : 8 STUDY OF ADDRESSING MODES OF DSP
DATE :
AIM:
To study about direct, indirect and immediate addressing modes in TMS320C50 debugger.
TOOLS REQUIRED:
1. System with TMS 320C50 debugger software2. TMS 320C50 Kit.
ALGORITHM:
IMMEDIATE ADDRESSING MODE:
1. Initialize data pointer with 100H data.2. Load the accumulator with first data.3. Add the second data with accumulator content.4. Store the accumulator content in specified address location.
DIRECT ADDRESSING MODE:
1. Initialize data pointer with 100H data.2. Load the accumulator with first data, whose address is specified in the instruction.3. Add the accumulator content with second data, whose address is specified in the
instruction.4. Store the accumulator content in specified address location.
IN-DIRECT ADDRESSING MODE:
1. Load the auxiliary register with address location of first data.2. The auxiliary register (AR0) is modified indirectly as # symbol.3. Load the second data into accumulator and perform addition operation.4. Store the result.
PROCEDURE:
Open ME Debugger for C50. Create a new project and new assembly file. Type the program Save and add the program to the project Add the command file to the project and build the project Load the program to kit through serial port Run the program and verify the output through communication window
PROGRAM:
;program for immediate addressing mode
.MMREGS
.TEXTSTART: LDP #100H;
LACC #1241H;ADD #1200H;SACL 2H;
H: B H;
;program for direct addressing mode
.MMREGS
.TEXTSTART: LDP #100H;
LACC 0H;ADD 1H;SACL 2H;
H: B H;
;program for adding two numbers with indirect addressing mode.
.MMREGS
.TEXTSTART: LAR AR0,#8000H;
MAR *,AR0;LACC *+,0 ;WITH ZERO SHIFTADD *+;SACL *+;
H: B H;
EXP. NO. : 9 IMPLEMENTATION OF LINEAR AND CIRCULAR
DATE : CONVOLUTION
AIM:
To write a program to find the Linear and Circular Convolution of two sequences x(n) and h(n) using TMS320C50 debugger.
TOOLS REQUIRED:
1. System with TMS 320C50 debugger software2. TMS 320C50 Kit.
ALGORITHM:
LINEAR CONVALUTION:
1. Get the first and second input sequence2. From the length of the given sequences find the length of the new sequence3. Fold the values of h(n)4. Do zero padding to x(n) if necessary5. Find the convolution and store the result in memory
CIRCULAR CONVALUTION:
1. Get the length of the sequences2. Get the first and second input sequence3. Find the circular convolution of the given sequences4. Store the result in memory
PROCEDURE:
Open ME Debugger for C50. Create a new project and new assembly file. Type the program Save and add the program to the project Add the command file to the project and build the project Load the program to kit through serial port Run the program and verify the output through communication window
PROGRAM:
LINEAR CONVALUTION:
.MMREGS
.TEXT
START:
LDP #02H
LAR AR1,#8100H ; x(n) data
LAR AR0,#08200H ;h(n) data
LAR AR3,#8300H ;y(n) starting
LAR AR4,#0007 ;N1+N2-1
;to fold the h(n) values
LAR AR0,#8203H ; data memory 8200 to program memory C100(TBLW) LACC #0C100H MAR *,AR0 RPT #3 TBLW *- ;to move 8203- 8200 to C100- C103
;padding of zeros for x(n) values
LAR AR6,#8104H
MAR *,AR6
LACC #0H
RPT #3H
SACL *+
;convolution operation start
LOP:
MAR *,AR1
LACC *+
SACL 050H ;starting of the scope of multiplication
LAR AR2,#0153H ; end of the array, to be multiplied with h(n)
{150+N1-1}
MAR *,AR2
ZAP
RPT #03H ;N1-1 times so that N1 times
MACD 0C100H,*-
APAC ;to accumulate the final product sample
MAR *,AR3
SACL *+
MAR *,AR4
BANZ LOP,*-
H: B H
CIRCULAR CONVALUTION:
TXD .SET 70H
STS .SET 71H
DATA .SET 72H
B3 .SET 0F000H
B2 .SET 00F0H
B0 .SET 000FH
.MMREGS
.TEXT
START:
LDP #100H
LACC 0H ;length of the input is given in 8000
SUB #1H
SACL 1H
LAR AR0,1H
LAR AR1,#8060H
LAR AR2,#8100H
COPYX2:
MAR *,AR1
LACC *+,0,AR2
SACL *+,0,AR0
BANZ COPYX2,*-
LAR AR0,1H
LAR AR2,#8010H
LOOP3:
LAR AR1,#8060H ;give the inputs x1[n] & x2[n] in AR1 & AR3
LAR AR3,#8050H
LAR AR4,1H
ZAP
LOOP:
MAR *,AR3 ;multiply x1[n] & x2[n] and add the multiplication
LT *+,AR1 ;output
MPY *+
SPL 5H
ADD 5H
MAR *,AR4
BANZ LOOP,*-,AR2 ;outputs of correlation are stored in AR2
SACL *+
CALL ROTATE
LOOP2:
MAR *,AR0
BANZ LOOP3,*-
REP:
LAR AR1,#8050H
LAR AR0,1H
REPXN:
MAR *,AR1
LACC *+
SACL DATA ;store the samples in DATA
CALL SERIAL ;subroutine to send DATA
MAR *,AR0
BANZ REPXN,*- ;repeat this for all the 360 output samples
LAR AR1,#8100H
LAR AR0,1H
REPHN:
MAR *,AR1
LACC *+
SACL DATA ;store the samples in DATA
CALL SERIAL ;subroutine to send DATA
MAR *,AR0
BANZ REPHN,*- ;repeat this for all the 360 output samples
LAR AR1,#8010H
LAR AR0,1H
REPOUT:
MAR *,AR1
LACC *+
SACL DATA ;store the samples in DATA
CALL SERIAL ;subroutine to send DATA
MAR *,AR0
BANZ REPOUT,*- ;repeat this for all the 360 output samples
HLT: B HLT
;routine to send each digit of DATA individually to the serial port first send the start of ;character "%" separate and send each digits of DATA from MSB send end of character "$"
SERIAL
SPLK #25H,TXD ;start of character "%"
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B3 ;1st digit (from MSB)
BSAR 12
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B2 ;second digit
BSAR 8
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B1 ;3rd digit
BSAR 4
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B0 ;4th digit
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
SPLK #24H,TXD ;end of character "$"
CALL TXDATA
RPT #0FFFH
NOP
RET
;loop to convert hex data to ASCII input is in address TXD output is also in TXD
;subtracts 9 from input hex data if >0 add 37h to input hex data;Otherwise add 30h to input hex data
HEXASC:
LACC TXD
SUB #9H
BCND GRT9,GT
LACC TXD
ADD #30H
SACL TXD
RET
GRT9:
LACC TXD
ADD #37H
SACL TXD
RET
;loop to send a character to the serial port checks the status of the serial port(TXREADY-;bit2). if not 0, send that character. Otherwise checks it repeatedly.
TXDATA:
REPCHK:
IN STS,9
LACC STS
AND #04H
BCND REPCHK,EQ
OUT TXD,8
RET
H: B H
ROTATE:
LDP #100H ;rotate the values of x2[n]
LACC 1H
SUB #1H
SACL 2H
LACC 0050H
SACB
LAR AR3,#8051H
LAR AR5,#8070H
LAR AR6,2H
LOOP1:
MAR *,AR3
LACC *+,0,AR5
SACL *+,0,AR6
BANZ LOOP1,*-
LACB
MAR *,AR5
SACL *+
LACC #8070H
SAMM BMAR
LAR AR3,#8050H
MAR *,AR3
RPT 0H
BLDD BMAR,*+
RET
INPUT:
LINEAR CONVALUTION:
x(n) 8100 - 18101 - 38102 - 18103 - 3
h(n) 8200 - 08201 - 18202 - 28203 - 1
CIRCULAR CONVALUTION:
8000-0004
x1(n) 8050 - 00028051 - 00018052 - 00028053 - 0001
x2(n ) 8060 - 00018061 - 00028062 - 00038063 - 0004
OUTPUT:
LINEAR CONVALUTION:
y(n) 8301 - 18302 - 58303 - 88304 - 88305 - 78306 - 38307 - 0
CIRCULAR CONVALUTION:
8010-000E8011-00108012-000E8013-0010
EXP. NO. : 10 SAMPLING OF INPUT SIGNAL AND DISPLAY
DATE :
AIM:
To write a program to convert analog signals into digital signals using TMS320C50 debugger.
TOOLS REQUIRED:
1. System with TMS 320C50 debugger software2. TMS 320C50 Kit.3. CRO4. Function generator
ALGORITHM:
1. Initialize data pointer2. Give the analog signal as input3. Introduce the time delay as per required.4. Observe the discrete signal as output5. Plot the graph.
PROCEDURE:
Open ME Debugger for C50. Create a new project and new assembly file. Type the program Save and add the program to the project Add the command file to the project and build the project Switch on the trainer kit. Connect the function generator in the corresponding terminals. Download the program to the trainer kit using Xtalk.exe Quit from the Xtalk. Enter into the basic TB.exe Load and run the program "sample50.bas" which executes the asm program and plots
the samples on the screen.
PROGRAM:
TXD .SET 0H
STS .SET 1H
DATA .SET 2H
DELAY .SET 3H
B3 .SET 0F000H
B2 .SET 0F00H
B1 .SET 00F0H
B0 .SET 000FH
.MMREGS
.TEXT
START:
LDP #100H
LAR AR0,#9000H
LAR AR1,#359
REP:
IN 0,06
RPT #0FH
NOP
IN 0,04
SPLK #5FFH,DELAY
RPT DELAY
NOP
LACC 0
AND #0FFFH
SUB #7FFH
MAR *,AR0
SACL *+,0,AR1
BANZ REP,*-
LACC DELAY
SACL DATA
CALL SERIAL
REPSER:
LAR AR2,#9000H
LAR AR0,#359
REPSAMP:
MAR *,AR2
LACC *+
SACL DATA
CALL SERIAL
MAR *,AR0
BANZ REPSAMP,*-
LAR AR2,#9000H
LAR AR0,#359
REPSAM:
MAR *,AR2
LACC *+
SACL DATA
CALL SERIAL
MAR *,AR0
BANZ REPSAM,*-
REPSER1:
B REPSER1
;routine to send each digit of DATA individually to the serial port first send the start of ;character "%" separate and send each digits of DATA from MSB send end of character "$"
SERIAL
SPLK #25H,TXD ;start of character "%"
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B3 ;1st digit (from MSB)
BSAR 12
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B2 ;second digit
BSAR 8
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B1 ;3rd digit
BSAR 4
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B0 ;4th digit
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
SPLK #24H,TXD ;end of character "$"
CALL TXDATA
RPT #0FFFH
NOP
RET
;loop to convert hex data to ASCII input is in address TXD output is also in TXD;subtracts 9 from input hex data if >0 add 37h to input hex data;Otherwise add 30h to input hex data
HEXASC:
LACC TXD
SUB #9H
BCND GRT9,GT
LACC TXD
ADD #30H
SACL TXD
RET
GRT9:
LACC TXD
ADD #37H
SACL TXD
RET
;loop to send a character to the serial port checks the status of the serial
port(TXREADY-;bit2). if not 0, send that character. Otherwise checks it repeatedly.
TXDATA:
REPCHK:
IN STS,9
LACC STS
AND #04H
BCND REPCHK,EQ
OUT TXD,8
RET
H: B H
EXP. NO. : 11 WAVEFORM GENERATION
DATE :
AIM:
To write a program to generate Triangle Wave, Sine Wave, Square Wave and Sawtooth Wave using TMS320C50 debugger.
TOOLS REQUIRED:
1. System with TMS 320C50 debugger software2. TMS 320C50 Kit.3. CRO4. Function generator
ALGORITHM:
TRIANGLE WAVE GENERATION:
1. Start the program.2. Load the LSBs of the address data memory location.3. Write full 16 bit pattern into address data memory location.4. Load the content of address data memory location.5. Add the content of address data memory location.6. Store the data of accumulator into address data memory location.7. Modify the current AR as specified.8. Repeat the steps 2 and 3.9. Subtract the contents of address data memory location.10. Repeat the steps 5, 6 and 7.11. Stop the program.
SINE WAVE GENERATION:
1. Start the program2. Load the LSBs of the address data memory location3. Write full 16 bit pattern into address data memory location.4. Load the content of address data memory location. Specify the address of a
subroutine.5. Multiply the content of the register.6. Load the content of the register into accumulator.7. Store the 16 LSBs of the accumulator into the address data memory location.8. Modify the current AR & ARP as specified.9. Branch the contents of entire auxiliary register.10. Load the content of address data memory location.11. Repeat the Step.12. Stop the program.
SQUARE WAVE GENERATION:
1. Start the program2. Load the content of address data memory location.3. Store the 16 LSBs of the accumulator into the address data memory location.4. Load the content of address data memory location.5. Complement the contents of the accumulator.6. Stop the program.
SAWTOOTH WAVE GENERATION:
1. Start the program.2. Load the LSBs of the address data memory location3. Load the content of address data memory location into accumulator.4. Store the 16 LSBs of the accumulator into the address data memory location5. Write 16 bit value from a data memory location to the specified I/O Port.6. Add the content of address data memory location.7. Subtract the content of the register.8. Branch the program memory address if the specified conditions are met.9. Stop the program.
PROCEDURE:
Open ME Debugger for C50. Create a new project and new assembly file. Type the program Save and add the program to the project Add the command file to the project and build the project Load the program to kit through serial port Run the program and verify the output using CRO
PROGRAM:
TRIANGLE WAVE:
TXD .SET 0H
STS .SET 1H
DATA .SET 2H
TEMP .SET 3H
B3 .SET 0F000H
B2 .SET 0F00H
B1 .SET 00F0H
B0 .SET 000FH
.MMREGS
.TEXT
START:
LDP #100H
REP:
SPLK #0,DATA
LAR AR0,#60
REPH:
OUT DATA,04H
LACC DATA
ADD #40H
SACL DATA
BANZ REPH,*-
LAR AR0,#60
REPL:
OUT DATA,04H
LACC DATA
SUB #40H
SACL DATA
MAR *,AR0
BANZ REPL,*-
B REP
HLT: B HLT
SINE WAVE:
TXD .SET 0H
STS .SET 1H
DATA .SET 2H
TEMP .SET 3H
B3 .SET 0F000H
B2 .SET 0F00H
B1 .SET 00F0H
B0 .SET 000FH
.MMREGS
.TEXT
START:
LDP #100H
LACC #TABLE
SACL TEMP
REP1:
LACC #TABLE
SACL TEMP
LAR AR0,#372
REP:
LACC TEMP
TBLR DATA
OUT DATA,04H
LACC TEMP
ADD #1H
SACL TEMP
MAR *,AR0
BANZ REP,*-
B REP1
HLT: B HLT
TABLE: .word 0800H .word 0822H .word 0845H .word 0867H .word 088aH .word 08acH .word 08cfH .word 08f1H .word 0913H .word 0935H .word 0958H .word 097aH .word 099cH .word 09bdH .word 09dfH .word 0a01H .word 0a22H .word 0a43H .word 0a64H .word 0a85H .word 0aa6H .word 0ac6H .word 0ae7H .word 0b07H .word 0b27H .word 0b46H .word 0b66H .word 0b85H .word 0ba4H .word 0bc3H .word 0be1H .word 0bffH .word 0c1dH .word 0c3aH .word 0c58H .word 0c74H .word 0c91H .word 0cadH .word 0cc9H .word 0ce5H .word 0d00H .word 0d1bH .word 0d35H .word 0d4fH .word 0d69H .word 0d82H .word 0d9bH .word 0db3H .word 0dcbH .word 0de3H
.word 0dfaH .word 0e11H .word 0e27H .word 0e3dH .word 0e52H .word 0e67H .word 0e7cH .word 0e90H .word 0ea3H .word 0eb6H .word 0ec9H .word 0edbH .word 0eedH .word 0efeH .word 0f0eH .word 0f1eH .word 0f2eH .word 0f3dH .word 0f4bH .word 0f59H .word 0f66H .word 0f73H .word 0f80H .word 0f8bH .word 0f97H .word 0fa1H .word 0fabH .word 0fb5H .word 0fbeH .word 0fc6H .word 0fceH .word 0fd5H .word 0fdcH .word 0fe2H .word 0fe8H .word 0fedH .word 0ff1H .word 0ff5H .word 0ff8H .word 0ffbH .word 0ffdH .word 0ffeH .word 0fffH .word 0fffH .word 0fffH .word 0ffeH .word 0ffdH .word 0ffbH .word 0ff8H .word 0ff5H .word 0ff1H
.word 0fedH .word 0fe8H .word 0fe3H .word 0fddH .word 0fd6H .word 0fcfH .word 0fc7H .word 0fbfH .word 0fb6H .word 0facH .word 0fa2H .word 0f98H .word 0f8cH .word 0f81H .word 0f74H .word 0f68H .word 0f5aH .word 0f4cH .word 0f3eH .word 0f2fH .word 0f20H .word 0f10H .word 0effH .word 0eeeH .word 0eddH .word 0ecbH .word 0eb8H .word 0ea5H .word 0e92H .word 0e7eH .word 0e69H .word 0e54H .word 0e3fH .word 0e29H .word 0e13H .word 0dfcH .word 0de5H .word 0dceH .word 0db6H .word 0d9dH .word 0d84H .word 0d6bH .word 0d51H .word 0d37H .word 0d1dH .word 0d02H .word 0ce7H .word 0cccH .word 0cb0H .word 0c94H .word 0c77H
.word 0c5aH .word 0c3dH .word 0c20H .word 0c02H .word 0be4H .word 0bc5H .word 0ba7H .word 0b88H .word 0b69H .word 0b49H .word 0b2aH .word 0b0aH .word 0aeaH .word 0ac9H .word 0aa9H .word 0a88H .word 0a67H .word 0a46H .word 0a25H .word 0a04H .word 09e2H .word 09c1H .word 099fH .word 097dH .word 095bH .word 0939H .word 0916H .word 08f4H .word 08d2H .word 08afH .word 088dH .word 086aH .word 0848H .word 0825H .word 0803H .word 07e0H .word 07beH .word 079bH .word 0779H .word 0756H .word 0734H .word 0711H .word 06efH .word 06cdH .word 06abH .word 0689H .word 0667H .word 0645H .word 0623H .word 0602H .word 05e0H
.word 05bfH .word 059eH .word 057dH .word 055cH .word 053cH .word 051bH .word 04fbH .word 04dbH .word 04bcH .word 049cH .word 047dH .word 045eH .word 043fH .word 0421H .word 0403H .word 03e5H .word 03c7H .word 03aaH .word 038dH .word 0371H .word 0354H .word 0339H .word 031dH .word 0302H .word 02e7H .word 02cdH .word 02b2H .word 0299H .word 027fH .word 0267H .word 024eH .word 0236H .word 021eH .word 0207H .word 01f0H .word 01daH .word 01c4H .word 01afH .word 019aH .word 0185H .word 0171H .word 015dH .word 014aH .word 0138H .word 0126H .word 0114H .word 0103H .word 00f2H .word 00e2H .word 00d3H .word 00c4H
.word 00b5H .word 00a7H .word 009aH .word 008dH .word 0081H .word 0075H .word 0069H .word 005fH .word 0055H .word 004bH .word 0042H .word 003aH .word 0032H .word 002aH .word 0024H .word 001dH .word 0018H .word 0013H .word 000eH .word 000aH .word 0007H .word 0005H .word 0002H .word 0001H .word 0000H .word 0000H .word 0000H .word 0001H .word 0002H .word 0004H .word 0006H .word 000aH .word 000dH .word 0011H .word 0016H .word 001cH .word 0022H .word 0028H .word 0030H .word 0037H .word 0040H .word 0048H .word 0052H .word 005cH .word 0066H .word 0072H .word 007dH .word 0089H .word 0096H .word 00a3H .word 00b1H
.word 00c0H .word 00ceH .word 00deH .word 00eeH .word 00feH .word 010fH .word 0121H .word 0133H .word 0145H .word 0158H .word 016bH .word 017fH .word 0194H .word 01a9H .word 01beH .word 01d4H .word 01eaH .word 0201H .word 0218H .word 022fH .word 0247H .word 0260H .word 0278H .word 0292H .word 02abH .word 02c5H .word 02dfH .word 02faH .word 0315H .word 0331H .word 034dH .word 0369H .word 0385H .word 03a2H .word 03bfH .word 03ddH .word 03faH .word 0418H .word 0437H .word 0455H .word 0474H .word 0493H .word 04b3H .word 04d2H .word 04f2H .word 0512H .word 0532H .word 0553H .word 0574H .word 0594H .word 05b6H
.word 05d7H .word 05f8H .word 061aH .word 063bH .word 065dH .word 067fH .word 06a1H .word 06c3H .word 06e5H .word 0708H .word 072aH .word 074cH .word 076fH .word 0791H .word 07b4H .word 07d6H
SQUARE WAVE:
.MMREGS
.TEXT
START:
LDP #100H
LACC #0FFFH ;change this value for amplitude.
LOOP:
SACL 0
RPT #0FFH ;change this value for frequency.
OUT 0,04H ;address for DAC.
CMPL
B LOOP
.END
SAWTOOTH WAVE:
TXD .SET 0H
STS .SET 1H
DATA .SET 2H
TEMP .SET 3H
B3 .SET 0F000H
B2 .SET 0F00H
B1 .SET 00F0H
B0 .SET 000FH
.MMREGS
.TEXT
START:
LDP #100H
LAR AR1,#9
REP:
SPLK #0F7ffH,DATA
LAR AR0,#49
REPH:
CALL SERIAL ;subroutine to send DATA
LACC DATA
ADD #100
SACL DATA
MAR *,AR0
BANZ REPH,*- ;repeat this for all the 360 output samples
MAR *,AR1
BANZ REP,*-
HLT: B HLT
;routine to send each digit of DATA individually to the serial port first send the start of ;character "%" separate and send each digits of DATA from MSB send end of character "$"
SERIAL
SPLK #25H,TXD ;start of character "%"
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B3 ;1st digit (from MSB)
BSAR 12
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B2 ;second digit
BSAR 8
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B1 ;3rd digit
BSAR 4
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B0 ;4th digit
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
SPLK #24H,TXD ;end of character "$"
CALL TXDATA
RPT #0FFFH
NOP
RET
;loop to convert hex data to ASCII input is in address TXD output is also in TXD;subtracts 9 from input hex data if >0 add 37h to input hex data;Otherwise add 30h to input hex data
HEXASC:
LACC TXD
SUB #9H
BCND GRT9,GT
LACC TXD
ADD #30H
SACL TXD
RET
GRT9:
LACC TXD
ADD #37H
SACL TXD
RET
;loop to send a character to the serial port checks the status of the serial port(TXREADY-;bit2). if not 0, send that character. Otherwise checks it repeatedly.
TXDATA:
REPCHK:
IN STS,9
LACC STS
AND #04H
BCND REPCHK,EQ
OUT TXD,8
RET
H: B H
EXP. NO. : 12 IMPLEMENTATION OF FIR FILTER
DATE :
AIM:
To design a FIR low pass, high pass, band pass and band reject filters in serial mode.
TOOLS REQUIRED:
1. System with TMS 320C50 debugger software2. TMS 320C50 Kit.3. CRO
ALGORITHM:
1. Start the program.2. Initialize the C table value.3. Load the auxillary register with 0200H.4. Modify the auxillary register zero.5. Block the C table to the program.6. Set configuration control bit.7. Load the data pointer with 0AH.8. Initialize the analog to digital conversion.9. Load the auxillary register 1 with 0300 content.10. Load the accumulator in 8000H.11. AND the accumulator with 0FFFH.12. Subtract the accumulator content with data 800H.13. Modify the auxillary register 1.14. Store the accumulator data in 8000H.15. Load the auxillary register 1 with content 0333H.16. Zero the accumulator register.17. Multiply the accumulator with data.18. Load the program register, with PM bits to accumulator.19. Load the auxillary register 1 with content 0300H.20. Add accumulator content with 800H.21. Shift the accumulator right 1 bit.22. Store the accumulator content in 8200 location.23. Branch the program to step 7.
PROCEDURE:
Open ME Debugger for C50. Create a new project and new assembly file. Type the program Save and add the program to the project Add the command file to the project and build the project Load the program to kit through serial port Run the program and verify the output using CRO
PROGRAM:
LOWPASS FILER:
TXD .SET 50H
STS .SET 51H
DATA .SET 52H
B3 .SET 0F000H
B2 .SET 0F00H
B1 .SET 00F0H
B0 .SET 000FH
.MMREGS
.TEXT
B START
CTABLE:
.word 0FF82H .word 0083H .word 0166H
.word 01CFH .word 0288H .word 009DH
.word 0FF5BH
.word 0FE38H
.word 0FDACH
.word 0FE01H
.word 0FF31H .word 00DEH
.word 0271H
.word 0342H
.word 02DDH
.word 0132H
.word 0FEADH
.word 0FC20H
.word 0FA92H
.word 0FAEEH
.word 0FDB6H
.word 02CCH
.word 096AH
.word 0104CH
.word 015F9H
.word 0192EH
.word 0192EH
.word 015F9H
.word 0104CH
.word 096AH
.word 02CCH
.word 0FDB6H
.word 0FAEEH
.word 0FA92H
.word 0FC20H
.word 0FEADH
.word 0132H
.word 02DDH
.word 0342H
.word 0271H .word 00DEH
.word 0FF31H
.word 0FE01H
.word 0FDACH
.word 0FE38H
.word 0FF5BH .word 009DH .word 0288H
.word 01CFH .word 0166H .word 0083H
.word 0FF82H
START:
MAR *,AR0
LAR AR0,#0200H
RPT #33H
BLKP CTABLE,*+
REPFIL:
LAR AR2,#8100H
LAR AR3,#359
ISR:
SETC CNF
LDP #0AH
IN 0,06H
RPT #01FH
NOP
IN 0,4
MAR *,AR1
LAR AR1,#0300H
LACC 0
AND #0FFFH
SUB #800H
SACL *
LAR AR1,#333H
ZAP
RPT #33H
MACD 0FF00H,*-
APAC
LAR AR1,#0300H
SACH * ;give as sach *,1 incase of overflow
LACC *
ADD #800H
SFR ;remove if o/p is less amplitude
MAR *,AR2
SACL *+,0,AR3
BANZ ISR,*-
REP:
LDP #100H
LAR AR2,#8100H
LAR AR3,#359
REPXN:
MAR *,AR2
LACC *+
SUB #1000
SACL DATA ;store the samples in DATA
CALL SERIAL ;subroutine to send DATA
MAR *,AR3
BANZ REPXN,*- ;repeat this for all the 360 output samples
B REPFIL
;routine to send each digit of DATA individually to the serial port first send the start of ;character "%" separate and send each digits of DATA from MSB send end of character "$"
SERIAL
SPLK #25H,TXD ;start of character "%"
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B3 ;1st digit (from MSB)
BSAR 12
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B2 ;second digit
BSAR 8
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B1 ;3rd digit
BSAR 4
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B0 ;4th digit
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
SPLK #24H,TXD ;end of character "$"
CALL TXDATA
RPT #0FFFH
NOP
RET
;loop to convert hex data to ASCII input is in address TXD output is also in TXD;subtracts 9 from input hex data if >0 add 37h to input hex data;Otherwise add 30h to input hex data
HEXASC:
LACC TXD
SUB #9H
BCND GRT9,GT
LACC TXD
ADD #30H
SACL TXD
RET
GRT9:
LACC TXD
ADD #37H
SACL TXD
RET
;loop to send a character to the serial port checks the status of the serial port(TXREADY-;bit2). if not 0, send that character. Otherwise checks it repeatedly.
TXDATA:
REPCHK:
IN STS,9
LACC STS
AND #04H
BCND REPCHK,EQ
OUT TXD,8 RETH: B H
HIGHPASS FILTER:
TXD .SET 50H
STS .SET 51H
DATA .SET 52H
B3 .SET 0F000H
B2 .SET 0F00H
B1 .SET 00F0H
B0 .SET 000FH
.MMREGS
.TEXT
B START
CTABLE:
.word 0FCEFH .word 62H .word 0FD50H .word 14AH .word 0FE1BH .word 28FH .word 0FF11H .word 3E5H .word 0FFD1H .word 4ECH .word 0FFF5H .word 54FH .word 0FF28H .word 4DAH .word 0FD38H .word 398H .word 0FA2EH .word 1DDH .word 0F627H .word 55H .word 0F131H .word 4BH .word 0EA6DH .word 568H .word 0D950H .word 459EH .word 459EH .word 0D950H .word 568H .word 0EA6DH .word 4BH .word 0F131H .word 55H
.word 0F627H .word 1DDH .word 0FA2EH .word 398H .word 0FD38H .word 4DAH .word 0FF28H .word 54FH .word 0FFF5H .word 4ECH .word 0FFD1H .word 3E5H .word 0FF11H .word 28FH .word 0FE1BH .word 14AH .word 0FD50H .word 62H .word 0FCEFH
START:
MAR *,AR0
LAR AR0,#0200H
RPT #33H
BLKP CTABLE,*+
REPFIL:
LAR AR2,#8100H
LAR AR3,#359
ISR:
SETC CNF
LDP #0AH
IN 0,06H
RPT #01FH
NOP
IN 0,4
MAR *,AR1
LAR AR1,#0300H
LACC 0
AND #0FFFH
SUB #800H
SACL *
LAR AR1,#333H
ZAP
RPT #33H
MACD 0FF00H,*-
APAC
LAR AR1,#0300H
SACH * ;give as sach *,1 incase of overflow
LACC *
ADD #800H
SFR ;remove if o/p is less amplitude
MAR *,AR2
SACL *+,0,AR3
BANZ ISR,*-
REP:
LDP #100H
LAR AR2,#8100H
LAR AR3,#359
REPXN:
MAR *,AR2
LACC *+
SUB #1000
SACL DATA ;store the samples in DATA
CALL SERIAL ;subroutine to send DATA
MAR *,AR3
BANZ REPXN,*- ;repeat this for all the 360 output samples
B REPFIL
;routine to send each digit of DATA individually to the serial port first send the start of ;character "%" separate and send each digits of DATA from MSB send end of character "$"
SERIAL
SPLK #25H,TXD ;start of character "%"
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B3 ;1st digit (from MSB)
BSAR 12
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B2 ;second digit
BSAR 8
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B1 ;3rd digit
BSAR 4
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B0 ;4th digit
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
SPLK #24H,TXD ;end of character "$"
CALL TXDATA
RPT #0FFFH
NOP
RET
;loop to convert hex data to ASCII input is in address TXD output is also in TXD;subtracts 9 from input hex data if >0 add 37h to input hex data;Otherwise add 30h to input hex data
HEXASC:
LACC TXD
SUB #9H
BCND GRT9,GT
LACC TXD
ADD #30H
SACL TXD
RET
GRT9:
LACC TXD
ADD #37H
SACL TXD
RET
;loop to send a character to the serial port checks the status of the serial port(TXREADY-;bit2). if not 0, send that character. Otherwise checks it repeatedly.
TXDATA:
REPCHK:
IN STS,9
LACC STS
AND #04H
BCND REPCHK,EQ
OUT TXD,8 RETH: B H
BANDPASS FILTER:
TXD .SET 50H
STS .SET 51H
DATA .SET 52H
B3 .SET 0F000H
B2 .SET 0F00H
B1 .SET 00F0H
B0 .SET 000FH
.MMREGS
.TEXT
B START
CTABLE:
.word 208H .word 257H .word 218H .word 143H .word 0H .word 0FE9EH .word 0FD7AH .word 0FCE7H .word 0FD08H .word 0FDD1H .word 0FEECH .word 0FFE4H .word 3DH .word 0FFA1H .word 0FDFCH .word 0FB8FH .word 0F8ECH .word 0F6D4H .word 0F608H .word 0F713H .word 0FA21H .word 0FEE6H .word 4A7H .word 0A60H .word 0EF8H .word 1187H .word 1187H .word 0EF8H .word 0A60H .word 4A7H .word 0FEE6H .word 0FA21H .word 0F713H
.word 0F608H .word 0F6D4H .word 0F8ECH .word 0FB8FH .word 0FDFCH .word 0FFA1H .word 3DH .word 0FFE4H .word 0FEECH .word 0FDD1H .word 0FD08H .word 0FCE7H .word 0FD7AH .word 0FE9EH .word 0H .word 143H .word 218H .word 257H .word 208H
START:
MAR *,AR0
LAR AR0,#0200H
RPT #33H
BLKP CTABLE,*+
REPFIL:
LAR AR2,#8100H
LAR AR3,#359
ISR:
SETC CNF
LDP #0AH
IN 0,06H
RPT #01FH
NOP
IN 0,4
MAR *,AR1
LAR AR1,#0300H
LACC 0
AND #0FFFH
SUB #800H
SACL *
LAR AR1,#333H
ZAP
RPT #33H
MACD 0FF00H,*-
APAC
LAR AR1,#0300H
SACH * ;give as sach *,1 incase of overflow
LACC *
ADD #800H
SFR ;remove if o/p is less amplitude
MAR *,AR2
SACL *+,0,AR3
BANZ ISR,*-
REP:
LDP #100H
LAR AR2,#8100H
LAR AR3,#359
REPXN:
MAR *,AR2
LACC *+
SUB #1000
SACL DATA ;store the samples in DATA
CALL SERIAL ;subroutine to send DATA
MAR *,AR3
BANZ REPXN,*- ;repeat this for all the 360 output samples
B REPFIL
;routine to send each digit of DATA individually to the serial port first send the start of ;character "%" separate and send each digits of DATA from MSB send end of character "$"
SERIAL
SPLK #25H,TXD ;start of character "%"
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B3 ;1st digit (from MSB)
BSAR 12
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B2 ;second digit
BSAR 8
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B1 ;3rd digit
BSAR 4
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B0 ;4th digit
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
SPLK #24H,TXD ;end of character "$"
CALL TXDATA
RPT #0FFFH
NOP
RET
;loop to convert hex data to ASCII input is in address TXD output is also in TXD;subtracts 9 from input hex data if >0 add 37h to input hex data;Otherwise add 30h to input hex data
HEXASC:
LACC TXD
SUB #9H
BCND GRT9,GT
LACC TXD
ADD #30H
SACL TXD
RET
GRT9:
LACC TXD
ADD #37H
SACL TXD
RET
;loop to send a character to the serial port checks the status of the serial port(TXREADY-;bit2). if not 0, send that character. Otherwise checks it repeatedly.
TXDATA:
REPCHK:
IN STS,9
LACC STS
AND #04H
BCND REPCHK,EQ
OUT TXD,8 RETH: B H
BAND REJECT FILTER:
TXD .SET 50H
STS .SET 51H
DATA .SET 52H
B3 .SET 0F000H
B2 .SET 0F00H
B1 .SET 00F0H
B0 .SET 000FH
.MMREGS
.TEXT
B START
CTABLE:
.word 0FEB9H .word 14EH .word 0FDA1H .word 155H .word 0FE1BH .word 282H .word 0FEAFH .word 2ACH .word 0FD35H .word 8DH .word 0F9D9H .word 0FE07H .word 0F7CCH .word 0FEE2H .word 0FA2FH .word 4BAH .word 1AH .word 25CH .word 420H .word 1008H .word 89H .word 0D61H .word 0F3F2H .word 0AF9H .word 0DB7EH .word 045DFH .word 045DFH .word 0DB7EH .word 0AF9H .word 0F3F2H .word 0D61H .word 89H .word 1008H
.word 420H .word 25CH .word 1AH .word 4BAH .word 0FA2FH .word 0FEE2H .word 0F7CCH .word 0FE07H .word 0F9D9H .word 8DH .word 0FD35H .word 2ACH .word 0FEAFH .word 282H .word 0FE1BH .word 155H .word 0FDA1H .word 14EH .word 0FEB9H
START:
MAR *,AR0
LAR AR0,#0200H
RPT #33H
BLKP CTABLE,*+
REPFIL:
LAR AR2,#8100H
LAR AR3,#359
ISR:
SETC CNF
LDP #0AH
IN 0,06H
RPT #01FH
NOP
IN 0,4
MAR *,AR1
LAR AR1,#0300H
LACC 0
AND #0FFFH
SUB #800H
SACL *
LAR AR1,#333H
ZAP
RPT #33H
MACD 0FF00H,*-
APAC
LAR AR1,#0300H
SACH * ;give as sach *,1 incase of overflow
LACC *
ADD #800H
SFR ;remove if o/p is less amplitude
MAR *,AR2
SACL *+,0,AR3
BANZ ISR,*-
REP:
LDP #100H
LAR AR2,#8100H
LAR AR3,#359
REPXN:
MAR *,AR2
LACC *+
SUB #1000
SACL DATA ;store the samples in DATA
CALL SERIAL ;subroutine to send DATA
MAR *,AR3
BANZ REPXN,*- ;repeat this for all the 360 output samples
B REPFIL
;routine to send each digit of DATA individually to the serial port first send the start of ;character "%" separate and send each digits of DATA from MSB send end of character "$"
SERIAL
SPLK #25H,TXD ;start of character "%"
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B3 ;1st digit (from MSB)
BSAR 12
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B2 ;second digit
BSAR 8
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B1 ;3rd digit
BSAR 4
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
LACC DATA
AND #B0 ;4th digit
SACL TXD
CALL HEXASC
CALL TXDATA
RPT #0FFFH
NOP
SPLK #24H,TXD ;end of character "$"
CALL TXDATA
RPT #0FFFH
NOP
RET
;loop to convert hex data to ASCII input is in address TXD output is also in TXD;subtracts 9 from input hex data if >0 add 37h to input hex data;Otherwise add 30h to input hex data
HEXASC:
LACC TXD
SUB #9H
BCND GRT9,GT
LACC TXD
ADD #30H
SACL TXD
RET
GRT9:
LACC TXD
ADD #37H
SACL TXD
RET
;loop to send a character to the serial port checks the status of the serial port(TXREADY-;bit2). if not 0, send that character. Otherwise checks it repeatedly.
TXDATA:
REPCHK:
IN STS,9
LACC STS
AND #04H
BCND REPCHK,EQ
OUT TXD,8 RETH: B H