[SOLVED] MIOS32_AIN_CHANNEL_MASK

Might be really obvious but it’s not clicking for me.

// bit mask to enable channels

//

// Pin mapping on MBHP_CORE_STM32 module:

// 15 14 13 12 11 10 9 8   

// J16.SO J16.SI J16.SC J16.RC J5C.A11 J5C.A10 J5C.A9 J5C.A8

// 7 6 5 4 3 2 1 0

// J5B.A7 J5B.A6 J5B.A5 J5B.A4 J5A.A3 J5A.A2 J5A.A1 J5A.A0

//

// Examples:

// mask 0x000f will enable all J5A channels

// mask 0x00f0 will enable all J5B channels

// mask 0x0f00 will enable all J5C channels

// mask 0x0fff will enable all J5A/B/C channels

// (all channels are disabled by default)

		#define MIOS32_AIN_CHANNEL_MASK 0x0000

If 0x000f is 15, how does that relate to J5A.A0..A3?

Thanks in advance,

Tom

Not sure where you got 15 from?

My interpretation is:

0x0CBA

Replace the letter with 0 if you want it disabled, f for enabled. They are groups of 4 channels (eg. A0… A3)

0x000f in decimal/base10 is 15. The reason I ask is because I’d like to disable all but the first mux (J5A.A0) so I only need to ground 7 inputs while troubleshooting/configuring.

It should be like this for A3…A0:

only enable A0: 1

only enable A1: 2

only enable A2: 4

only enable A3: 8


only enable A0 and A1: 3

...

only enable A1 and A3: a

...

enable all A0 to A3: f

Best, ilmenator

Ah my mistake, I was reading the pin numbers in place of the binary columns (for lack of better words).

J5A.A0 - 1

J5A.A1 - 2

J5A.A2 - 3

J5A.A3 - 4

J5B.A4 - 5

etc

instead of

J5A.A0 - 1

J5A.A1 - 2

J5A.A2 - 4

J5A.A3 - 8

J5B.A4 - 16

etc

Thanks for both of your replies. :slight_smile: Obvious after all!