PIC ASSEMBLER LISTING
Address Opcode Instruction
000052 EC38 START: CALL UNPACK
000054 F000
000056 EC40 CALL OUTLED
000058 F000
00005A 0E05 MOVLW D'5'
000070 5000 UNPACK: MOVF COUNTER, W
000072 0B0F ANDLW 0x0F
00007C 3A02 SWAPF BCD1, F
00007E 0012 RETURN
000080 5001 OUTLED: MOVF BCD0, W
000082 EC4B CALL GETCODE
000084 F000
000086 CFF5 MOVFF TABLAT, PORTC
000096 6E03 GETCODE: MOVWF TEMP
000098 0E00 MOVLW UPPER LEDCODE
2. Write a subroutine that counts the number of positive entries in a data table
(terminated by 00). The input to the subroutine is a pointer to the table in FSR1 and the
output is a count of the positive entries in WREG.
a) Draw a flowchart for the subroutine (and indicate any registers used).
b) Write the assembly language for the subroutine (called by a main program) and
simulate using a sample data table.
c) Your solution should include the assembler listing (with subroutine header) and an
annotated screen capture of the simulator showing the final register values.