I want to control multi GPIO , say multi pins in different port, the application is to drive a stepper motor, the driver pins are in different port, instead of doing output_high(PIN_x), is there a way to control all these pins at one time ?
I test with the 4 bit of different port, it works fine, Thanks
However I was wondering can I do it in the "struct" way ?
I searched about the Microchip C18 about the same question got like:
# How can I remap a group of pins on different ports into a single structure?
You can't. C places all of the members of a structure in address order. C does not support the concept of writing to scattered memory addresses in a single operation.
There is no simple or clean mechanism to logically rearrange port pins. The most straightforward technique is to write a function that encapsulates the necessary operations on the port pins. See the following three questions for further discussion.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum