Both DutyCycle and Frquency MUST be WORD variables.
I put it in the comments, but I should have mentioned it in the post too.
That... Frequency con 1000 will cause problems.
<br>
Both DutyCycle and Frquency MUST be WORD variables.
I put it in the comments, but I should have mentioned it in the post too.
That... Frequency con 1000 will cause problems.
<br>
DT
I just finished testing it with this code:
The output is not steady when I use ADCIN, if I enable the calibrapin then it goes to steady mode.Code:' Pic Configuration @ device pic12f683,INTRC_OSC_NOCLKOUT , wdt_on, mclr_off, protect_off ' Hardware configuration ' I/Os TRISIO = %00010010 ' pin1 is ADC , pin4 is the calibration button ' ADC's ANSEL = %00000010 DEFINE ADC_BITS 10 ' ADCIN resolution (Bits) DEFINE ADC_CLOCK 1 ' ADC clock source (Fosc/8) DEFINE ADC_SAMPLEUS 11 ' ADC sampling time (uSec) ADCON0.7 = 1 ' Right justified results ' Comparator CMCON0 = %00000111 ' Disable comparator VRCON = %00000000 ' disable 'cmcon0 = %00001110 ' Multiplexed Input with Internal Reference CIS=1 'vrcon = %10001010 ' set vref=2.25v (from 4v input) include "HPWM10.pbp" ' definitions pote var word Frequency var word calibraled var gpio.5 calibrapin var gpio.4 gpio=0 frequency=1000 pause 50 ' coffee break loop: if calibrapin=0 then adcin 1, pote if pote>1000 then pote=1000 endif @ HPWM10 1, _pote, _Frequency pause 10 goto loop end
To generate the adcin values I used a 10k pot instead of the sensor Im using for simplicity sakes.
Am I doing something wrong?
Thanks!
Pablo
Can't tell ya! But as far i remind, the datasheet suggest a maximum impedance of 2.xxx Kohm.
I tested my code on a EASYPIC 4 board with 10K trim pot... seems to work.
Post your schematic but make sure your PSU is well filtered and is strong enough for your need first.
Weird, weird, weird.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Oh Great!
Thanks for trying it Steve.
It helps to know not all is lost.
I think I've got a 683 around here somewhere.
Maybe there's something I missed for the little guys.
<br>
DT
Im using this schematic:
Im using a recently charged Li-Ion (3.635v measured under load using a good multimeter) all is mounted in a protoboard
Using my last posted code the LED flickers, if I press the button it goes steady
Thanks!
Last edited by peu; - 7th May 2007 at 02:37.
mmm, yeah it works.. but a scope attach to show few glitches... mine too.
Deeper analysis show that flicker go away if i don't turn off the PWM off before updating the duty cycle. So maybe i have those latest silicon version.. and why the datasheet no longer suggest to turn off the PWM module...
aarrrggghh
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
let me join your ARGHHH...
Thanks Steve, at least now I know Im not alone here
I ordered some 12f683 samples not so long ago, if they changed something I guess I could test it with a rather new IC. But they are at my office, will check tomorrow if time allows.
Thanks for the continued help guys!
Pablo
in my code just remove the following line
and also that oneCode:CCP1CON = PWM_OFF
In darrel's include, comment out line 160Code:CCP1CON = CCP1CON | PWM_ON
At least, it work here.. thanks to my scopeCode:MOVE?CB 0, CCP1CON
Now the history don't tell if this will work with ALL PIC #, and with ALL silicone release. Time will tell.
Last edited by mister_e; - 7th May 2007 at 03:11.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks