Did I see something about 24 bit integer support in AS7?

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Everyone,

 

Should there be a uint24_t ?

 

I am processing a grid keyboard in an ISR and I've always been able to fit them into a single 32 bit variable.  This time I have 34 inputs and am trying to think of the best way to deal with it.  It is a 6x6 grid, so I was thinking of 6 uint8_t's, but then to test for a key, I have to compare all 6 bytes.  I realize it is doing that anyway even when using uint32_t when it compiles.  The ISR debounces it into the "34 bits" and then a later process in the main loop decodes the bits into an actual "key" and puts it in a buffer for processing.

 

So, processing 34 input bits in an ISR, how would you do it?

Thanks,

 

Alan

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I vaguely recall that 24 bit had something to do with pointers to allow for larger memory devices and that it was not a true data type tike uint24_t.

 

 

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alank2 wrote:
Should there be a uint24_t ?

https://gcc.gnu.org/wiki/avr-gcc#Types

Types

  • Signed and unsigned 24-bit integers: __int24 (v4.7), __uint24 (v4.7).

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't get your question (maybe the muscle relaxants haven't worn off). How could __unt24 help with a 34 bit data structure?

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Joey,

 

I was thinking it would simplify:

 

        if ((InputState[0]!=AInput[0] || InputState[1]!=AInput[1] || InputState[2]!=AInput[2] || InputState[3]!=AInput[3] || InputState[4]!=AInput[4] || InputState[5]!=AInput[5]) && InputDebounceCount>=3)

into:

        if ((InputState[0]!=AInput[0] || InputState[1]!=AInput[1]) && InputDebounceCount>=3)

 

If each were 24 bits, but I suppose I could just do a uint32_t and uint8_t the same way and be 8 bits ahead of the game...