nabla101
Junior Member level 3
Hi,
I'm using a PIC18F46k80 microcontroller, and I want to use the CTMU for time measurements.
I want to drive a 40kHz ultrasonic transceiver via a bridge circuit, with pulses, and trigger the CTMU current source to begin the time measurement, on the rising edge of the pulse (The second trigger will come from one of the external pins - from the ultrasonic receiver circuit - to end the time measurement).
So I need to generate a 40kHz burst on demand from the software application to drive the ultrasonic transmitter with a pulse, and simultaneously start the CTMU current source.
I don't know if I am able to use either of the two internal triggers for the CTMU, or whether I would need to an external trigger for the transmit?
I was thinking of generating the timing signal with the ECCP module which supports half and full bridge PWM signalling, and then using the ouput from an envelope/peak detector circuit on the PWM output pin to provide an (almost instantaneous) input trigger for the CTMU module?
Firstly I don't know if this is a good idea, since there may be an easier, better (e.g. configurable via software), way to do this, and secondly I don't know how to generate the busrt signal with the pwm module (It has to be a 40kHz burst, fixed, 50% duty cycle) on demand from the software application.
p.s. actually can I set the PWM settings first (e.g. half-bridge, 50% duty cycle, 40kHz), and then just enable/disable the PWM module when I want to send a burst? If I do it this way, can I send an internal flag to the CTMU to start the current source? ...It says the two internal flags available for the CTMU triggers are "ECCP1" and "CCP2"....so maybe I can use "ECCP1"?
Thanks
I'm using a PIC18F46k80 microcontroller, and I want to use the CTMU for time measurements.
I want to drive a 40kHz ultrasonic transceiver via a bridge circuit, with pulses, and trigger the CTMU current source to begin the time measurement, on the rising edge of the pulse (The second trigger will come from one of the external pins - from the ultrasonic receiver circuit - to end the time measurement).
So I need to generate a 40kHz burst on demand from the software application to drive the ultrasonic transmitter with a pulse, and simultaneously start the CTMU current source.
I don't know if I am able to use either of the two internal triggers for the CTMU, or whether I would need to an external trigger for the transmit?
I was thinking of generating the timing signal with the ECCP module which supports half and full bridge PWM signalling, and then using the ouput from an envelope/peak detector circuit on the PWM output pin to provide an (almost instantaneous) input trigger for the CTMU module?
Firstly I don't know if this is a good idea, since there may be an easier, better (e.g. configurable via software), way to do this, and secondly I don't know how to generate the busrt signal with the pwm module (It has to be a 40kHz burst, fixed, 50% duty cycle) on demand from the software application.
p.s. actually can I set the PWM settings first (e.g. half-bridge, 50% duty cycle, 40kHz), and then just enable/disable the PWM module when I want to send a burst? If I do it this way, can I send an internal flag to the CTMU to start the current source? ...It says the two internal flags available for the CTMU triggers are "ECCP1" and "CCP2"....so maybe I can use "ECCP1"?
Thanks