ok well these are the bare bones of my code so far... i havnt actually created the algorithm yet so i havnt actually got a proper dutycycle to put in yet. and things like config settings etc i still have yet to choose. just hope its going in the right direction

'''''''''''''''''''''''''''''''''''Assembley to collect period on cap1 cap2 and cap3''''''
asm

cap1m0 = 0101
cap1ren = 1
cap2m0 = 0101
cap2ren = 1
cap3m0 = 0101
cap3ren = 1

endasm

'''''''''''''''''''''''''''values put in var for us in calculation''''''''''''''''''

F69H VAR BYTE 'Value of period at CAP1 ready for calculation
F67H VAR BYTE 'Value of period at CAP2 ready for calculation
F65H VAR BYTE 'Value of period at CAP3 ready for calculation

''''''''''''''''''''''''''''''''''''Algorithm for finding average''''''''''''''''''''''''


'yet to write it



'''''''''''''''''''''''''''''''''''pwm output'''''''''''''''''''''''''''''''''''''''''''' '''

HPWM 1, 127, 20000
'obviously unfinished and dutycycle would not be a fixed 50%