Using the 'short' data type in Arduino


i'm playing round code run tlv5618 dac via arduino.

it's working fine - uses 'short' data type (i think) based on c.

it's used few times in function declarations - e.g.

code: [select]
void setdacavoltage (short involtage) {
 setdacvoltage (involtage, 1);
}


i can't find explanation data type in arduino reference - i'm wondering 2 things:

1) 'short' data type , 2) there better/more efficient way of writing in arduino?

the main reason i'm asking want try , change data type things these functions referencing - try optimise 1 part of code, don't want before understand type of data these functions looking now.

hope makes sense - in advance.

j

on arduino, "short" same "int".
it's signed 16 bit quantity, capable of representing range -32 768 +32 767.

imho, it's better (more portable) write "short" (almost) 16 bit quantity, whereas "int" depends on platform.

in fact, better write "int16" or "int16_t" there's no argument.


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Using the 'short' data type in Arduino


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums