Replies: 1 comment
-
@Tow96 You can use the gpio functions, that are part of the SDK - you don't have to do anything special to use them: https://raspberrypi.github.io/pico-sdk-doxygen/group__hardware__gpio.html For example, if you want to output a byte on 8 consecutively numbered IO pins, you can use the gpio_put_masked() function. You give it a bit mask and a value, both 32 bit. Here's what I did to drive an 8 bit R2R ladder DAC (a DAC made from resistors):
The pin numbering is in gpio pin numbers, rather than pins numbered like on a chip. It works as one 32 bit port, but not all pins are accessible, and you should mask off ones you're not using, when you write to them. You could use gpio functions to control the mode of the pins too, but pinMode() works fine. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Everyone,
In the regular arduino library, there is a way to read/write/set multiple pins at once by using the registers, for example using register B, you can read, write and setIO using: PINB PORTB and DDRB respectively.
Is there a way to do the same using the pi pico?
Beta Was this translation helpful? Give feedback.
All reactions