WORKING WITH HEXADECIMAL ADDRESSES

I an working on a data logger for temperature measurement using a one wire IC and the one wire arduino library . Everything is working ok but I am having difficulty programming the hexadecimal address that the IC uses as follows.: 1. I wish to declare the following IC component address as a HEX constant 28 B0 FE E 2 0 0 47 2. The one wire examples suggest that I should declare the constant as follows uint_8 insidethermometer[8]; with an assignment statment like : insidethermometer = { 0x28, 0xB0, 0xFE, 0xE, 0x2, 0x0, 0x0, 0x47 };

I am probably doing something stupid but I keep getting a warning , " error: expecting primary expression before '{' token", when I compile the program.

Could anyone help

john

When the declaration and assignment are combined in one statement, the {} syntax works:

uint_8 insidethermometer[8] = { 0x28, 0xB0, 0xFE, 0xE, 0x2, 0x0, 0x0, 0x47 };

If the declaration and assignment are separate statements, the individual elements of the array need to be set. The {} format can not be used to set multiple values.

Thanks Paul
I tried your suggestion but I get another error:: uint_8 does name a type. While uint_8 does not make any sense to me either it is the syntax that is used in the one wire library examples.

john

Sorry Paul but the error message should read- error: unit_8 does not name a type

john

A more usual spelling is "uint8" or "uint8_t"

Wouldn't the most common spelling be "byte"? :)

-Mike

Wouldn't the most common spelling be "byte"?

Although byte is defined in the Arduino environment (for compatibility with wiring), its not a primitive data type defined by the compiler. Indeed it seems to be common practice (even by the arduino core team) to use the uint8_t as defined by the AVR GCC compiler for unsigned 8 bit values in core and library code.

Thanks , now I understand