PIC18F46K80 ADC Config Adcon1 in C-Code
Moderator: Benj
-
- Posts: 33
- Joined: Tue May 08, 2012 3:48 pm
- Location: Germany
- Has thanked: 7 times
PIC18F46K80 ADC Config Adcon1 in C-Code
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
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
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 33
- Joined: Tue May 08, 2012 3:48 pm
- Location: Germany
- Has thanked: 7 times
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
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
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
-
- Posts: 33
- Joined: Tue May 08, 2012 3:48 pm
- Location: Germany
- Has thanked: 7 times
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
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
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
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
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.
Please try this updated PIC CAL ADC file and see if this helps to solve the problem.
Let me know how you get on.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 33
- Joined: Tue May 08, 2012 3:48 pm
- Location: Germany
- Has thanked: 7 times
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
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
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
-
- Posts: 33
- Joined: Tue May 08, 2012 3:48 pm
- Location: Germany
- Has thanked: 7 times
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
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
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
-
- Posts: 33
- Joined: Tue May 08, 2012 3:48 pm
- Location: Germany
- Has thanked: 7 times
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
Hello Benj.
Here a file can help.
The software reads only once the ADC port.
I hope this helps.
Sincerely
Uwe
Here a file can help.
The software reads only once the ADC port.
I hope this helps.
Sincerely
Uwe
- Attachments
-
- PIC18F46K80.mbppi_callertable.txt
- (44 Bytes) Downloaded 318 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
Hello Uwe,
Please can you post your flowchart so I can try and see what's going wrong for you.
Please can you post your flowchart so I can try and see what's going wrong for you.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 33
- Joined: Tue May 08, 2012 3:48 pm
- Location: Germany
- Has thanked: 7 times
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
Hi Benj,
in Main
Macro is measured in the ADC call.
Prozent_Wert in the output.
Sincerely
Uwe
in Main
Macro is measured in the ADC call.
Prozent_Wert in the output.
Sincerely
Uwe
- Attachments
-
- HTK6fcf.fcf
- (203.83 KiB) Downloaded 306 times
-
- Posts: 33
- Joined: Tue May 08, 2012 3:48 pm
- Location: Germany
- Has thanked: 7 times
Re: PIC18F46K80 ADC Config Adcon1 in C-Code
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
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