PDA

View Full Version : UnderWater Antenna 125KHz Driver using a 16F628 @20MHz Example Code



Zebryk
- 9th April 2022, 23:16
Hello,

I am looking for a PBP 3.1 example of how to implement hardware PWM @125KHz using a 16F628.
Attached below is a link to the Microchip App note showing the schematic that I intended to build.
I have an old development board from Bruc Reynolds which is all set up with a 20MHz Xtal.

From the data sheet...(Linked Below)

For a device operating at20 MHz, one can obtain a 125 kHz signal by setting theTimer2 prescaler to 1.
A period of 8 μs is then obtainedby setting the PR2 register to 39.
To get a 50% dutycycle output, set CCPR1L to 14 and CCP1CON<5:4>to <0:0>.
These settings will ensure a constant carrier.
To modulate the data, one can turn the drive signal onand off by setting and clearing the CCP1RIL bit.

FYI, this is for an underwater antenna that I am experimenting with.

Thanks,

Jay Zebryk, W1JRZ

https://ww1.microchip.com/downloads/en/AppNotes/00232B.pdf

Zebryk
- 10th April 2022, 01:00
This might make things easier:-)

9211

Ioannis
- 11th April 2022, 07:21
Hi Jay.

I am not sure what RB3, RB4 and RB7 are used for. I guess the RB3 is the PWM signal output, but the rest?

As I understand it, you just want a 50% square signal at 125KHz?

Ioannis

Zebryk
- 13th April 2022, 00:48
Ioannis,

I have the beast generating 125KHz from the hardware module quite nicely.
To modulate a data stream, I am simply changing TRISB.3 from an Output to an Input.

Peace,

Jay Zebryk

Ioannis
- 13th April 2022, 08:33
So, you are generating the 125KHz 50% duty cycle signal?

Ioannis