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 software 2. 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.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
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.
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
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.
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.
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.
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.