PDA

View Full Version : POT Command



Acetronics2
- 3rd May 2004, 15:23
I realised a "scale factor wiewer" with LCD ( see scheme on LCDOUT page ... ).

It Works fairly well at 4 Mhz ...everything perfect !!!

BUT, I need to run the POT command with a 20Mhz crystal ...

of course, I added the right DEFINE ...

It's really awful as a result, even after trying different R an C's ...

Anyone having an idea or a solution ???

( Those with RCTime are a little bit late on this game ) !!!

Alain

Keith55555
- 3rd May 2004, 17:09
This is a long shot but I learned this the hard way and sometimes something that is obvious, isn't, as we have all seen.So just in case this is something you have assumed,I'll throw it out there :are you using an EPIC to program?and did you use 'HS' for the clock configuration in Epic.I once did a define with the osc 20 DEFINE but used :the 'XT' for the clock .The device worked but did some freaky things.-Keith

Acetronics2
- 3rd May 2004, 19:04
Thanks to you, Keith.

From the lab' point of view, everything is here;picstart + , MPlab 6.50, PbP 2.44...and the right crystal.

From the software point the difference is just a little "DEFINE OSC 20" ...

And Further, Melabs has no solution and tell me to use an ADC !!! Just understand my wish was to make simple ...

"Is there a solution " seem to be the good question !!!

Alain

CocaColaKid
- 3rd May 2004, 20:34
I believe the reason behind using ADC versus the POT command is because the ADC offers a higher resolution. The POT is limited to 255 I think where as the ADC goes up to 1023. If you want simple just use the ADCIN command and divide the result by 4.

Melanie
- 4th May 2004, 10:18
You can use POT on PIC's with no ADC's (like F84 or F628 etc) which makes it useful in some situations.

I've found that you have to play with the POT scale settings sometimes, as it doesn't quite follow the manual. I've had a situation (10K pot and 100nF capacitor) where using the recommended scale of 127 as a starting point (see manual) did not return meaningful results in Var (always zero I recall), and only when scale was reduced to around 100 did things start to work as expected.

This is one of those experiment and see situations.

Just as a reminder for everyone else reading this thread... never use the open drain pin on the PIC (PortA.4 I believe).

Acetronics2
- 4th May 2004, 11:26
Hello, Melanie

Thanks for this answer ... reading between the lines tells me there's no future for my superb PCB !!!

So, last question ( with humour ...)

Why are there " IF OSC >=16..." and " IF OSC >= 20 ..." in lines 3213-3218 in PBPic xx.lib ???

Let' Hotten the Persulfate Bath ... and modify POT to RCTime !!!

Alain

Melanie
- 5th May 2004, 08:53
You know, I've never had reason to poke around those lib files... nice collection of "If OSC" statements though...

I'm surprised... you should get the POT to function... even at higher OSC speeds... just play with the scale value until sensible figures start appearing and then adjust accordingly from there.

What values of VR and C are you using? For C, I tend to use the same 100nF Capacitors as I do for board decoupling (makes life easy for assembly on the factory floor)... despite being a cheap Y5V spec, for non-precision user adjustments work really well.

Acetronics2
- 5th May 2004, 13:33
Hello, Melanie

I've tried from 1 nF to 1µF for caps and got a wristache turning the 47k pot back and forth.

Results are really awful ( no usable range and min R give max result )

May be a "capacitive load problem" occurs ...

I already saw that with PULSOUT command ( just switch and unswitch the servo, without removing power ...)
...write a LOW portx.y just before PULSOUT
or also when driving mosfets with an RCDiode array on the gate
writing " portx.y =1 "
...write " HIGH portx.y " not the mosfet to sleep too long a time !!!

I' ve chosen to use RCTIME ...that will be kwicker to have my model plane's canopy closed !!!

Alain

Keith55555
- 5th May 2004, 16:32
Since the pot command has relationship to pulsout architecture and pulsout is dependent on the oscillator frequency(a DEFINE does not change this dependency)isn't it correct to assume that pot will be effected by this, by possibly a way too short charging of the capacitor?Could you emulate this structure of what goes on in 'pot'and increase the time of the pulse(1 period at 4 mhz in pulsout=10us and at 20mhz=2us,so times five).Scaling under these conditions may not do the job if it is frequency dependent.PBP manual does not comment on how the clock effects the 'pot' command although is quite 'vocal' about pulsout's relationship to the clock.Simply put a question to MELABS,that asks,"does the clock freq. effect the 'pot' command?"That's either a yes or no answer and we can eliminate that part of the question.
I do believe I am going to have to try this 'in-circuit',myself just to put this to rest.

Acetronics2
- 5th May 2004, 16:54
Hello Keith

It's a long time I went to a trip through PBPic14.lib ... lines 3170 to 3237 ...

I didn't see anything strange, as the cap charge is driven through a PAUSE 10 instruction ...and PAUSE goes well if the right define is here !!!

sorry, that's not the right solution ...

Alain