How To Write Properly Command

Hi All !

This is my 2nd post on forum & i am novice for Arduino.

My problem is when i write any command like

portc = 0; compiler generate error

but if i change it to

PORTC = 0; then no error comes

same thing

digitalwrite(led,high); error comes

but when i write

digitalWrite(led,HIGH); no error

how can i decide it ? Is there is any option where arduino automatically check command's & correct them.

Thanks

Roshani

The gcc C/C++ language the arduino uses is case sensitive so you have to know the proper name for the functions. PORTC and portc are different and only PORTC is a predefined name. The arduino reference section is a good place to see what the proper naming of all the arduino supplied functions and library names are:

Lefty

Is there is any option where arduino automatically check command's & correct them.

No... you have to follow the rules Edit.... just like lefty said 8)

Thanks Sir.

Please clear one more thing.

If i want to clear value of portc, i tried it PORTC = 0, but it not works, how can i clear value of portc.

Thanks

What do you mean by clear ?

Do you want to 'clear' PORTC or portc ? As been explained they are different.

I've never used ports, so I'm guessing.... maybe you have to send it binary, to talk to each pin bit by bit?

PORTB = B00000000;

Just a guess though 8)

I want to clear all bits of portc.

If you want to clear all the bits of portc then, as has been explained, it is no good doing

PORTC = 0;

because portc is not the same as PORTC
You might just as well write

ELEPHANT= 0;

for all the good it would do to clear the bits of portc

How and where is portc defined ?
Please post the code (all of it) showing where you try to clear portc (or is it PORTC ?)

Please read this

PORTC is for analog input pins and it was defined as input by default, so if you did not defined it as output then you can not clear all the bits, it will depend on the pins status.

Hi Mr. Bill !

Thanks for info & help.

This is the info which i want.

Roshani

Roshani:
This is my 2nd post on forum & i am novice for Arduino.

Given the level of understanding implied by your questions, I suggest that you should not be trying to access the hardware ports directly in any case. The Arduino provides a nice simple API that protects you from the hardware details and bypassing that to access the hardware directly is not usually necessary and not recommended for inexperienced programmers. What are you trying to achieve?