inputs and outputs on same port?

Any general or miscellaneous queries that do not fit into the other forum catagories

Moderators: Benj, Mods

Post Reply
hazic
Posts: 24
Joined: Tue Jan 05, 2010 8:59 am
Been thanked: 1 time
Contact:

inputs and outputs on same port?

Post 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

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

Re: inputs and outputs on same port?

Post 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.

hazic
Posts: 24
Joined: Tue Jan 05, 2010 8:59 am
Been thanked: 1 time
Contact:

Re: inputs and outputs on same port?

Post 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

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: inputs and outputs on same port?

Post 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?

hazic
Posts: 24
Joined: Tue Jan 05, 2010 8:59 am
Been thanked: 1 time
Contact:

Re: inputs and outputs on same port?

Post 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

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: inputs and outputs on same port?

Post 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.

hazic
Posts: 24
Joined: Tue Jan 05, 2010 8:59 am
Been thanked: 1 time
Contact:

Re: inputs and outputs on same port?

Post 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.

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: inputs and outputs on same port?

Post by Benj »

Hello Hazic,

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

Post Reply