DAC EQU 0600h ;DAC memory mapped at address 600h tbl_len EQU 24 ;length of sine wave table ORG 8100H ;start of program sine: mov R7, #tbl_len ;initialise table counter mov R6, #0 ;initialise table pointer sloop: mov dptr, #table ;load dptr with address of table mov a, R6 ;load acc with table pointer movc a, @a+dptr ;read from table + table pointer mov dptr, #DAC ;load dptr with 0600 DAC base address movx @dptr, a ;Output table value from DAC acall delay inc R6 ;inc table pointer djnz R7, sloop ;dec table counter until zero sjmp sine ;Repeat loop delay: mov R0, #11 loop: djnz R0, dloop ;go around this loop 11 times ret table: DB 1,5,18,38,65,95,128,161,192,218,238,251 DB 255,251,238,218,192,161,128,95,65,38,18,5