ADC problem pic18F

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
maxtisc
Posts: 110
Joined: Mon Dec 23, 2013 9:34 pm
Has thanked: 2 times
Been thanked: 9 times
Contact:

ADC problem pic18F

Post by maxtisc »

Hello everyone
I do not know if I'm doing something wrong but that's my problem

I'm using a pic 18f87k22, writing a simple program to read an analog
input with View stored in the display, in simulation works, but on the
hardware does not work, this happens when I want to display the value
of the ADC as BYTE or integer
Example 1: read the value of the ADC with the block getByte or getint
and then I try to display the value with the block printnumber but does
not work
Example 2: If I read the value of the ADC with getstring displays
the value of ADC in volts

tanks

User avatar
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: ADC problem pic18F

Post by Benj »

Hello,

Please can you attach your Flowcode project to the forums so we can take a look for you.

maxtisc
Posts: 110
Joined: Mon Dec 23, 2013 9:34 pm
Has thanked: 2 times
Been thanked: 9 times
Contact:

Re: ADC problem pic18F

Post by maxtisc »

Hy Benj
I am attaching 3 files, the file called ADC voltage as string is copied from your example and works, the other 2 I have changed and always display a fixed value in the mid-scale 127 and 2,047.
I modified
1) change the type of micro 18f87k22
2) change the working frequency to 16Mhz
3) disabled the PLL
4) extended instruction disabled
tanks of your help
Attachments
ADC Voltage as intero.fcfx
fixed value to 2047
(5.89 KiB) Downloaded 139 times
ADC Voltage as byte.fcfx
fixed value to 127
(5.89 KiB) Downloaded 150 times
ADC Voltage as String.fcfx
working
(5.82 KiB) Downloaded 146 times

User avatar
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: ADC problem pic18F

Post by Benj »

Hello,

I have looked at the program and that looks fine. The config doesn't look to be quite correct, the oscillator seems to be currently set to a none valid setting.

A 1 second flasher test should help to confirm if these settings are ok for your device.

http://www.matrixtsl.com/wiki/index.php ... ED_flasher

maxtisc
Posts: 110
Joined: Mon Dec 23, 2013 9:34 pm
Has thanked: 2 times
Been thanked: 9 times
Contact:

Re: ADC problem pic18F

Post by maxtisc »

hello Benj
I try with the program led flaher and this works well, even if in fact the settings of the oscillator were not exactly correct, now I put the oscillator as HS and followed the suggestions at the end of the page, but in my programs I always read a fixed value of bytes, while using the program string it all works properly
thank you

Post Reply