Due Port proramming

I got a question about this statement on Arduino Due:

PIOC->PIO_SODR=(1u<<22);  //digitalWrite(RA_STP, HIGH);

I can work out most of it. I would just like to know what the "1u" means?
Is there any timing in this statement? Will the pin go "HIGH" and stay high or does it go "HIGH" for a certain time defined in the statement?

Hi @anon77222424

Literal constants (known as literals) like variables have a data type (int, long, float, etc...). Usually it's enough just to specify the number and its data type is implied. However, there are occasions where it might be necessary to inform the compiler that constant differs from the default. This is achieved by adding a literal suffix to the number.

In your example:

PIOC->PIO_SODR=(1u<<22);  //digitalWrite(RA_STP, HIGH);

The 1u specifies that the literal constant is of type unsigned int.

For more information just google "C Literals".

Thanks for your reply.

So this statement does not specify how long it will stay "HIGH"

I will look at finding info on "C Literals"

Yes, it just sets the pin HIGH.


This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.