ESP32 16bit variable count, unifying output port bits
Posted: Thu Sep 09, 2021 1:34 pm
Hi
I'mm working with ESP32 DEVKIT.
I will need to count up on a 16 bit variable ( Uint ), lets suppose variable V, and output its contents to portA of ESP32 .
As its bits (numbering) aren't all contiguous ones,
I was thinking to:
output
the Less Significant Byte of variable V ( V0 V1 V2 V3 V4 V5 V6 V7 )
to ( D1 D2 D3 D4 D5 D21 D22 D23 ) respectively .
and output
Most Significant Byte of variable variable V ( V8 V9 V10 V11 V12 V13 V14 V15 )
to ( D12 D13 D14 D15 D16 D17 D18 D19 ) respectively .
like this
I can preview this may imply perhaps some shifting and calculations and probably isolating the LSB and MSB of variable V ,
but I have not a clear view on how to implement it .
Question is :
Can someone put some light here, by giving here some ideas / tips on how to achieve this.
NOTES:
Variable V will be incremented at a speed as high as the
ESP32/flowcode permits so, it should be available on ESP12 above
mentioned bits, as soon as possible...
Writing to the PORT should be done without changing any other existing bits, besides the mentioned ones.
lots of thanks in advance,
Miguel
I'mm working with ESP32 DEVKIT.
I will need to count up on a 16 bit variable ( Uint ), lets suppose variable V, and output its contents to portA of ESP32 .
As its bits (numbering) aren't all contiguous ones,
I was thinking to:
output
the Less Significant Byte of variable V ( V0 V1 V2 V3 V4 V5 V6 V7 )
to ( D1 D2 D3 D4 D5 D21 D22 D23 ) respectively .
and output
Most Significant Byte of variable variable V ( V8 V9 V10 V11 V12 V13 V14 V15 )
to ( D12 D13 D14 D15 D16 D17 D18 D19 ) respectively .
like this
I can preview this may imply perhaps some shifting and calculations and probably isolating the LSB and MSB of variable V ,
but I have not a clear view on how to implement it .
Question is :
Can someone put some light here, by giving here some ideas / tips on how to achieve this.
NOTES:
Variable V will be incremented at a speed as high as the
ESP32/flowcode permits so, it should be available on ESP12 above
mentioned bits, as soon as possible...
Writing to the PORT should be done without changing any other existing bits, besides the mentioned ones.
lots of thanks in advance,
Miguel