

ORG 00H
LJMP MAIN
ORG 002BH
LJMP T2ISR

MAIN:

MOV P1,#0FFH
MOV T2MOD,#02H    ;initialising timer 2 as auto-reload 16 bit
MOV T2CON,#4CH     timer, counting upwards
MOV IE,#0A0H

MOV RCAP2L,#0F0H  ;1ms timer over flow time
MOV RCAP2H,#0D8H
SETB TR2
SETB TF2          ;forcing interrupt, this does not             
                                      seem to be working
SJMP $

T2ISR:

CLR TR2
CLR TF2
CLR EXF2

CPL P1.6
CPL P1.5

SETB TR2
RETI
 

END
