Go Down

Topic: data type sizes (Read 743 times) previous topic - next topic

raalst

Hi all,

   I'm a bit miffed about the data type changes between Uno and Due.

   I'm playing with low level ADC and DAC control via PDC in a Due.
   it seems the PDC transfers data in 16-bit chunks.
   
   however, Int is 4 bytes in Due, as opposed to 2 in Uno.
   sizeof(short) is reported to be two bytes but using shorts creates strange
   issues when declaring the array.

   what do I do to create an array of 1024 16-bit-unsigned values in a DUE ?
   
Regards,
Ronald

TheKitty

uint16_t arrayname[1000];

OutOfLine

You might also need the following line for uint16_t
#include <stdint.h>


uint16_t arrayname[1000];


raalst

Thanks for your help !

I guess the uint32_t and it's kin are the new style of how to code.
worked for me (without needing to use an include file)

Still, there is something fishy in that PDC / DMA.
The DMA can transfer 1, 2 or 4 byte chunks, according to the datasheet,
but it is not clear when it is using what format.
If someone knows where i should look for that nugget of knowledge in the datasheet,
please let me know.


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy