ECIO-40P and ADC

Forum for problems or queries regarding Flowcode Comms Components. Eg LIN, I2C, SPI, RS232, CAN, IrDA etc

Moderators: Benj, Mods

Post Reply
wim314
Posts: 12
Joined: Tue Dec 25, 2007 1:51 pm
Location: Belgium
Contact:

ECIO-40P and ADC

Post by wim314 »

Hello,

I am trying to use the ADC(7) input (RE2) of the ECIO-40P module.
One reason or another, the pin OUTPUTS a voltage of around 4V instead of sampling the INPUT voltage.
Does someone has an idea? Or do I do something totally wrong?

Best regards
Wim
Last edited by wim314 on Sat Feb 28, 2009 3:10 pm, edited 3 times in total.

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: ECIO-40P and ADC

Post by Benj »

Hello Wim

The ADC component will switch the pin to an input automatically and then restore after the sample so if you are outputting a 1 at the same time then it could be the switching in and out that is causing the apparent 4V to be generated on the pin. What value are you getting when you read the sample back.

wim314
Posts: 12
Joined: Tue Dec 25, 2007 1:51 pm
Location: Belgium
Contact:

Re: ECIO-40P and ADC

Post by wim314 »

Hi Ben,

I am getting as sample value something around 210 (corresponding with the 4V). When I disconnect the wire between the RE2 pin and the sensor, then there is still 4V on the RE2 pin, while there is 2,5V at the sensor output.
I have looked into the code and I cannot find a reference to the RE2 pin other than sampling the ADC(7).
Is there an easy way to launch a FIND command within flowcode that will look also inside all macro's?

best regards
Wim

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: ECIO-40P and ADC

Post by Benj »

Hello Wim

Sorry my mistake. RE2 is used by the ECIO as the USB detect pin and also the ECIO LED pin. You are still free to use this pin as an input or output but the analogue value read in will be dominated by the USB voltage eg your 4V. I would suggest disconnecting the USB detect circuitry but then the bootloader would not work correctly and that wouldn't really be much use... unless that is you can alter the voltage to this pin easy enough to send the voltage high when resetting to allow for reprogramming and low when resetting to enter the user program mode.

Sorry for the runaround, should have spotted this when you asked before.

wim314
Posts: 12
Joined: Tue Dec 25, 2007 1:51 pm
Location: Belgium
Contact:

Re: ECIO-40P and ADC

Post by wim314 »

Hi Ben,

thanks for the clarification. Now I do not have to try it again :D .
I will try to recuperate some of the other ADC input pins (this needs a little bit of rewire in my robot, but I think it sould be possible). I have somewhere still some ICs of Microchip which allows me to expand the IO pins via the I2C interface.
Maybe it is a good idea to add the remark about pin RE2 to the ECIO-40P datasheet?

Best regards,
Wim

wim314
Posts: 12
Joined: Tue Dec 25, 2007 1:51 pm
Location: Belgium
Contact:

Re: ECIO-40P and ADC

Post by wim314 »

Ben,

still one small issue. When removing ADC(7) and adding a new ADC which I want to assign to ADC(9) then the channel is correctly set to ADC(9), but the component itself is called ADC(7). Probably because 7 is the first free number in the row as ADC(0)... ADC(6) are in use. When I try to add ADC(9) to my project, it is not in the list. Any suggestions how I can add ADC(9)?
ADC9.JPG
ADC9.JPG (72.92 KiB) Viewed 5942 times
Best regards,
Wim

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: ECIO-40P and ADC

Post by Sean »

Hello Wim,

The allocation of the number 7 in ADC(7) is controlled by Flowcode. It is the internal index number of the individual instance of the ADC component (allocated sequentially). It has no relation to the ADC channel being accessed.

If you want the ADC component accessing ADC Channel 9 to be referenced as ADC(9), you can create ADC(7), ADC(8) and ADC(9), then delete ADC(7) and ADC(8). Flowcode will not produce any code relating to the deleted components.

wim314
Posts: 12
Joined: Tue Dec 25, 2007 1:51 pm
Location: Belgium
Contact:

Re: ECIO-40P and ADC

Post by wim314 »

Hi Sean,

Thank you very much for the tip. I have just tested it and it works!
Great, you helped me further in developing my project.

Best regards,
Wim

Post Reply