Page 1 of 1

inputs and outputs on same port?

Posted: Tue Mar 27, 2012 10:07 pm
by hazic
is there a problem with that?
i use PC6 and PC7 as switches
and I want PC2 and PC5 as outputs but these two are not working, the switches works fine.
device is atmega16

Re: inputs and outputs on same port?

Posted: Wed Mar 28, 2012 12:04 am
by DavidA
hello hazic,

Some pins may only allow inputs or outputs on them, i would advise you check the datasheet of your particular device to try and locate your pins and whether they provide input and output, or just one of them.

Re: inputs and outputs on same port?

Posted: Wed Mar 28, 2012 6:32 am
by hazic
Hi David

from what I can see in the datasheet port c can be input/output
but what about the data direction?
it is managed by flowcode when I use OUTPUT or SWITCH components right?
but is it ok to use bothe on the same port?

i dont know wht to do, I even tryied to change the device

Re: inputs and outputs on same port?

Posted: Wed Mar 28, 2012 9:23 am
by Benj
Hello,

Which version of Flowcode are you using?

Switches and outputs can be used on the same ports. For your outputs are you using single pin mode or do you have masking enabled? If not then you are essentially converting the entire port into an output.

What are you using to test your outputs. Do you have access to a multimeter so you can check the voltage level on the pin?

Re: inputs and outputs on same port?

Posted: Wed Mar 28, 2012 2:10 pm
by hazic
v4. i use single pin.
yes i have multimeter,to test the outputs i use LEDs . pins C2 and C5 are low, not changing

Re: inputs and outputs on same port?

Posted: Wed Mar 28, 2012 2:18 pm
by Benj
Hello,

Please can you post up your program and I will have a quick check your doing nothing wrong.

Also please can you post up the C file from the Flowcode project folder so we can check that Flowcode is generating code correctly.

Re: inputs and outputs on same port?

Posted: Wed Mar 28, 2012 10:34 pm
by hazic
thank you for trying to help

problem is solved!
Atmega16 arrives from factory with JTAG enable fuse set and for using all port C pins properly it is nessecary to disable JTAGEN fuse.

Re: inputs and outputs on same port?

Posted: Thu Mar 29, 2012 10:23 am
by Benj
Hello Hazic,

Great glad you got it sorted thanks for letting us know.