Difference between FIOPIN and FIOSET

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Difference between FIOPIN and FIOSET

4,772 Views
nt_mahmood
Contributor I

Hi, I want to know what is the difference between

LPC_GPIO1->FIODIR=0x00000001;

LPC_GPIO1->FIOSET=0x00000001;

and

LPC_GPIO1->FIODIR=0x00000001;

LPC_GPIO1->FIOPIN=0x00000001;

The first, set P1[0] to output and also drives 1 to it. The second also set P1[0] to output and writes 1 (vdd) to that and 0 to other pins.

So, both are driving vdd to P1[0]. Is that right?

Is there any technical difference here or it is a programming habit?!

Labels (2)
0 Kudos
3 Replies

3,684 Views
nt_mahmood
Contributor I

So you are saying that reading FIOSET only returns the state (IN or OUT) while FIOPIN returns the value. Is that right?

Still I want to know if the two sets that I wrote are equal because in both, I am driving 1 to that pin. Isn't that correct?

 

How do you interpret two sets that I wrote? I think both are doing the same thing. Isn't that?

0 Kudos

3,684 Views
soledad
NXP Employee
NXP Employee

Hello,

FIOSET:Fast Port Output Set Register.
This register controls the state of output pins. Writing 1s produces highs at the corresponding port pins. Writing 0s has no effect. Reading this register returns the current contents of the port output register not the physical port value.

FIOPIN:Fast Port Pin Value Register.
This register is used for both reading and writing data from/to the PORT.
Output: Writing to this register places corresponding values in all bits of the particular PORT pins.
Input: The current state of digital port pins can be read from this register, regardless of pin direction or alternate function selection (as long as pins are not configured as an input to ADC).
Note:It is recommended to configure the PORT direction and pin function before using it. 


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

3,684 Views
nt_mahmood
Contributor I

So you are saying that reading FIOSET only returns the state (IN or OUT) while FIOPIN returns the value. Is that right?

Still I want to know if the two sets that I wrote are equal because in both, I am driving 1 to that pin. Isn't that correct?

How do you interpret two sets that I wrote?

0 Kudos