lpcware

Masked port output.

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 18, 2016 by lpcware
Content originally posted in LPCWare by JulianCox on Fri May 13 08:06:52 MST 2016
I have read a number of posts on this subject, but one thing is not clear. I wish to output data to a 7-bit port. I have initialised the port, but the pins are [u]not contiguous[/u] due to board layout constraints.
To output data do I simply send a 7 (or 8) bit value using the instruction Chip_GPIO_SetMaskedPortValue(LPC_GPIO_PORT, 0, value);
or must I map the individual bits onto a 32-bit word to match up with the mask bits. If this is the case it would take longer to shift the bits than it would to set the port pins one at a time.
As a simple example using  8-bit registers. I set the mask for port pins 0, 2, 4 and 6. I wish to output  a value of 00001111 which is 15. Do I pass a value of 15 to Chip_GPIO_SetMaskedPortValue(); or do I have to send the value 01010101 (which is 85)?

Also, is Chip_GPIO_SetMaskedPortValue(); the correct instruction as I have seen other instructions used for this purpose in various posts on this forum?

Outcomes