Pages: [1]   Go Down
Author Topic: data type sizes  (Read 614 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 2
Posts: 109
ArduiYES!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

US
Offline Offline
Full Member
***
Karma: 4
Posts: 183
Electronics are the new Legos
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

uint16_t arrayname[1000];
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

uint16_t arrayname[1000];
Logged

0
Offline Offline
Full Member
***
Karma: 2
Posts: 109
ArduiYES!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Pages: [1]   Go Up
Jump to: