cancel
Showing results for 
Search instead for 
Did you mean: 

How to divide word variable into 2x halfword?

oeliks
Senior

Hi? I set my ADC1&2 in simultanous mode. I write these 2 data halfword to 1 - 32 bit variable word.

How can I divi​de this 32 bit variable into 2 separate variables? To get values of ADC1 and ADC2 separate?

ADC is 12 bit.

Thank You :)

13 REPLIES 13

> No, it does not. In any architecture, given a 32-bit value, ...

32 bit is not given.

16 bit MCUs still exist, I deal with them on almost daily basis. Thank god my company has never used 8-bitters ...

oeliks
Senior

How to do this?

Im using dma to transfer adc1&adc2 in one transfer to a buffer. I have only 1 dma but 2 adc.

Thanks :)​

Declare the buffer as

uint16_t adcbuffer[N][2];

then the values from one ADC would go to adcbuffer[x][0], from the other ADC to adcbuffer[x][1]

oeliks
Senior

I will try this, thanks ! If it will work for me it will speed up the processing of data :)​