dsPIC30F6014A - ADC reading problem

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
egearabaci
Posts: 10
http://meble-kuchenne.info.pl
Joined: Thu Sep 01, 2022 7:39 am
Has thanked: 3 times
Been thanked: 2 times

dsPIC30F6014A - ADC reading problem

Post by egearabaci »

Hi all,

I got a problem with the analog pins of dsPIC30F6014A controller. I think it reads the voltage at the ADC pins wrong. I am using Flowcode 9.3 and reading the ADC pins with component macro's GetVoltage.

I checked the voltage directly at the ADC pin of controller with a multimeter and its correct. I used a decision block that lights up a LED if the read voltage is not in the wanted interval, but it lights up the LED even read voltage is in the interval. I do not know if there is an offset on the controller's ADC pins.

It happened with different PCBs with same design and circuits with different designs using same controller. It happened with all cases.

Also there is an interesting situation here, when I used Flowcode 7, it reads the ADC pin closer to the real value.

Thanks.

BenR
Matrix Staff
Posts: 1780
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 454 times
Been thanked: 616 times

Re: dsPIC30F6014A - ADC reading problem

Post by BenR »

Hello,

Please can you attach your project file so we can have a look for you.

egearabaci
Posts: 10
Joined: Thu Sep 01, 2022 7:39 am
Has thanked: 3 times
Been thanked: 2 times

Re: dsPIC30F6014A - ADC reading problem

Post by egearabaci »

Sorry for the late reply and thanks for helping,

I attached the mentioned code file.

In attached file;
If I compile the code through the Flowcode 9.3, it turns on the error LEDs (LED situations is in the LEDS macro.) even if there are no problems with voltage on designed PCB.
If I compile the code through the Flowcode 7, it does not turn on the error LED as I expected.

Everything is same with both situations, did not change a single thing in code.

Thanks.
Attachments
flowcode.fcfx
(74.17 KiB) Downloaded 44 times

BenR
Matrix Staff
Posts: 1780
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 454 times
Been thanked: 616 times

Re: dsPIC30F6014A - ADC reading problem

Post by BenR »

Hello,

Many thanks for letting us know. I've put together what I hope will be a fix based on the differences between the v9 and v7 code and hopefully this should help the situation.

I've pushed the changes to the Help -> Library Update system so you should be able to get the latest from there.

Please let us know how you get on.

egearabaci
Posts: 10
Joined: Thu Sep 01, 2022 7:39 am
Has thanked: 3 times
Been thanked: 2 times

Re: dsPIC30F6014A - ADC reading problem

Post by egearabaci »

Hello,

Thanks for fast reply.

My computer that I am using for Flowcode does not have access to the internet. Can you attach the updated library file so I can implement it?

Thanks again.

BenR
Matrix Staff
Posts: 1780
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 454 times
Been thanked: 616 times

Re: dsPIC30F6014A - ADC reading problem

Post by BenR »

Hello,

The file is available here and needs to be placed into this directory. Please note it is hidden by default so copy and paste the path into your file explorer address bar.

C:\ProgramData\MatrixTSL\FlowcodeV9\CAL\PIC16BIT

PIC16BIT_CAL_ADC.c
(95.16 KiB) Downloaded 53 times

egearabaci
Posts: 10
Joined: Thu Sep 01, 2022 7:39 am
Has thanked: 3 times
Been thanked: 2 times

Re: dsPIC30F6014A - ADC reading problem

Post by egearabaci »

Hello,

I updated the file and tried again. This time it worked smoothly.

But there is another problem here. Code runs slower when the hex file is compiled through Flowcode 9.

I noticed it because of the LEDS macro that runs 4 LEDs by binary counting.

Thanks.

WingNut
Posts: 257
Joined: Tue Jul 13, 2021 1:53 pm
Has thanked: 33 times
Been thanked: 23 times

Re: dsPIC30F6014A - ADC reading problem

Post by WingNut »

I'll give it a go when I get home.
Think i tried the physical rotation but i'll confirm

Post Reply