You are not logged in.
How do I use the hex mask for Arduino MEGA2560? I do not understand the configuration parameters.
Offline
When the HEX mask is used, the pin modes are defined by hexadecimal numbers. E.g. for pins 0 to 7 the parameter pinmodes_00_07 can be 0x320A0800, which means:
pin 7: mode 3 = digital input
pin 6: mode 2 = digital output
pin 5: mode 0 = not used
pin 4: mode A = counter DIR
pin 3: mode 0 = not used
pin 2: mode 8 = counter pulses
pin 1: mode 0 = not used
pin 0: mode 0 = not used
Note the reversed order.
Numbering of the modes is the following:
0: Not connected
1: Not connected
2: Digital output
3: Digital input
4: Digital input with internal pull-up
5: Analog output (PWM)
6: Analog input
7: 1-Wire temperature
8: Counter (only pins 2 and 3)
9: Encoder A (only pins 2 and 3)
A: Counter DIR / Encoder B (only pins 4 and 5, pin pairs are 2+4 and 3+5)
Monarco HAT for Raspberry Pi - Lightweight I/O for monitoring, archiving and control.
Raspberry Pi in industrial automation!
Offline