Sounds simple,
I presume I only need one comparator so I would make CMCON = %100101
I would then connect RA1 (VIN-) to ground and feed RA2(VIN+) from RB3 (PWM signal)
I would connect my Tx to RA2 and pick another unsused pin (RB5)
I figure I would get the inverted signal from RA2 by reading CMCON.7
But how to I pass the value of CMCON.7 to RB5?
Or am I going the wrong way?
This is what works feeding just one pin of the Tx
Code:
Main:
;reset timer
hpwm 1, 127,40000 ; Send burst, Ch1, D.Cycle50%, Freq 40Khz
pauseus 150 ; length of burst.
CCP1CON = 0 ; Turn off PWM
pause 100 ; Wait to prevent picking up
; noise generated by Tx
; detect timer overflow
; do the maths
; display results
GOTO Main
Mike
Bookmarks