Pins defined as Analog AND Digital

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

Moderators: Benj, Mods

Post Reply
Ron
Posts: 225
Joined: Wed Apr 11, 2007 6:15 pm
Has thanked: 2 times
Contact:

Pins defined as Analog AND Digital

Post by Ron »

Hi,

I want to "define" 8 pins for 18F4620 as both analog and digital in different sections of my program. A variable downloaded on power up via rs232 will determine which logic will be solved for each pin, digital or analog. If a pin is defined by RS232 as digital the analog logic will never solve, if a pin is defined as analog by var sent via RS232 the digital logic will never solve.

Will flowcode work this way or will defining the pins as both, even if both sections of logic are not solved cause problems?

I have has some strange behavior in my program and I have made several changes, one of which was to remove all logic including delete the analog macro and things are now working. To try to figure out what was causing the issue I removed the call for my analog macro from the main { }. I did not delete the analog macro though. The pin that I now had as digital (also defined as analog in analog macro) did not appear to work. After deleting the analog macro the switch started working.

I am trying to determine what I am doing wrong.

Thank you,

Ron

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: Pins defined as Analog AND Digital

Post by Benj »

Hello Ron

Any calls to an input icon or switch component macro will configure the port / pin for a digital input. Likewise any call to a ADC component macro will configure the pin as an analogue input.

Therefore in your program you should be able to decide which mode you require and then call the appropriate macro to read the data as required.

If this is not the case then please sent me your FCF flowcode program and your C file, specifying where the problems occur, and I will have a look.

Post Reply