Page 1 of 1
PIC18F46K80 ADC Config Adcon1 in C-Code
Posted: Tue Oct 09, 2012 11:46 am
by PIC-Speed32
Hello all.
i have a problem with converting thinks from the datesheet in to C-Code for the PIC18F46K80 ADC Config Adcon1.
Pleas could someone help me out, i just need to know how to convert the 0-8 BIT to programm in Flowcode V5.
Best regards,
Uwe Kapuschinski
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
Posted: Wed Oct 10, 2012 10:20 am
by Benj
Hello,
I think I have found the ADC related bug that was causing the issue.
Please copy the files below into your Flowcode install folder before starting Flowcode and hopefully the ADC should work correctly for you now.
Extract and copy these files into "v5/FCD/"
And copy this file into "v5/CAL/PIC/"
Let me know how you get on.
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
Posted: Wed Oct 10, 2012 11:07 am
by PIC-Speed32
The ADC query works.
New problem:
The ADC value overwrites a string variable S minvalue (29) has nothing to do with the ADC value S ADC0 (20). I have therefore created a new variable S Analog1 (20), the ADC is in the macro for the first time used. The second time it is used in the serial output.
Now another variable is maxvalue S (20) which has to do with anything overwritten.
Thanks in advance Uwe
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
Posted: Sat Oct 13, 2012 8:39 am
by PIC-Speed32
Hi, I have a problem.
First The PIC18F46K80 has 12 bit analog inputs. In PIC_Cal_ADC_c for this PIC family only 10 and 8 is provided. (As far as I understand it)
Second The PIC has differential inputs as analog input.
That means it can directly measure the voltage between 2 analog inputs.
Here come out and negative voltage values.
Which may be determined by the configuration.
E.G. all I can say is AN0 + and An1 is -. Then I can put a 1.5 volt battery dierkt to both terminals and get a mere 1.5 volts + or when the battery is rotated 1.5 volts -.
In my project I do not need that.
I do not know whether the V5 already configured Sun
My problem:
I measure ADC2. ADC2 is connected to the PIC leg AN6. ADC2 has a reference VDD 500 x 10mV Fosc/64.
The connection is now connected to 0Volt. The measurement shows me at 4.99??
If the input is open, returns the value fluctuates and as is usual for an open entrance.
with kind regards
Uwe
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
Posted: Tue Oct 16, 2012 11:47 am
by Benj
Hello Uwe,
Please try this updated PIC CAL ADC file and see if this helps to solve the problem.
Let me know how you get on.
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
Posted: Tue Oct 16, 2012 5:30 pm
by PIC-Speed32
Hi Benj,
my main problem is still present.
At 0 V input voltage to get 4.99 Displayed.
That was the reason to test it with Microbesic Pro.
Micro Basic shows here really to 0.
Therefore, I know that my hardware is ok.
There is still a bug.
Sincerely
Uwe
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
Posted: Tue Oct 16, 2012 5:40 pm
by PIC-Speed32
Hi Benj,
again.
I had changed the file already.
I had (TYPE 28) copies to (TYPE 32).
This was the same result.
Can make the compiler a mistake?
Sincerely
Uwe
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
Posted: Wed Oct 17, 2012 10:31 am
by PIC-Speed32
Hello Benj.
Here a file can help.
The software reads only once the ADC port.
I hope this helps.
Sincerely
Uwe
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
Posted: Wed Oct 17, 2012 1:55 pm
by Benj
Hello Uwe,
Please can you post your flowchart so I can try and see what's going wrong for you.
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
Posted: Wed Oct 17, 2012 4:03 pm
by PIC-Speed32
Hi Benj,
in Main
Macro is measured in the ADC call.
Prozent_Wert in the output.
Sincerely
Uwe
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
Posted: Thu Oct 25, 2012 9:11 am
by PIC-Speed32
ADC PIC18f46K80
Sent: Thu Oct 25, 2012 8:09 am
From: PIC-Speed32
To: Benj
hi Benj.
sorry I'm writing again
is there a solution?
I have not heard anything.
Please see (viewtopic.php? f = 40 & t = 11366)
I have made new measurements.
The PIC is not set correctly
Sincerely
Uwe