I had to make few minor changes to Henrik’s code to adapt it to a 12F683 and make the code compatible with my old PBP 2.47.
Here is the working code that generates bursts of 15 mS ON and 5 mS OFF with a carrier frequency of 1MHz (Sorry Henrik for mutilating your nicely commentated code but REMing some of the lines makes it easier on my eyes).
Code:
@ device pic12F683, intrc_osc_noclkout, wdt_on, mclr_off, protect_off
DEFINE OSC 8 ' We're running at 8 Mhz
OSCCON=%01110111 ' 8MHz internal osc
ANSEL = 0 ' Digital only for all PortA pins
TRISIO=%00100000 ' Make PORTA outputs
CCP1CON = %00001100 ' Normal PWM
PR2 = 1 ' 1MHz output @8MHz system clock
CCPR1L = 0 ' 50% Dutycycle
CCP1CON.5 = 1
CCP1CON.4 =1
Main:
T2CON.2 = 1 ' Timebase ON
PAUSE 15
T2CON.2 = 0 ' Timebase OFF
PAUSE 5
Goto Main
This will make my testing a lot easier and fine tune the power transfer part. In the real life I will replace the fixed timing of the T2CON.2 control with some other mechanism (something like Dave did). Right now my first priority is to decide on the final frequency and tune my LC circuits for maximum efficiency on power transfer and maximum reliable speed on data transfer.
Unfortunately I do not have too much time to experiment with the new 12F1840 which is by far the best way to go. It involves so many more variables for me including complete upgrade of my hardware and software and I’m not ready for it yet.
One question for Dave:
You used a data speed of 3000 bps. Did you try to push your system to see what will be the maximum data speed that you could get?
And two questions for everyone:
Is there a 10F, 12F or low pin count 16F PIC, supported by my older 2.47 PBP that will have a 16 MHz internal clock?
What kind of minimal hardware / software upgrade to be able use PIC12F1840?
Thank you in advance.
Bookmarks