A: Yes, there is. As an extension, mikroC (as well as other mikroElektronika compilers) offers four built-in functions for this purpose: Lo(), Hi(), Higher() and Highest(). As expected, they return single byte from the lowest to the highest one, respectively. So, instead of using the 'classical' C-way of reading the multiple-byte variables:
Code: Select all
unsigned ui1;
unsigned short usa1[50];
...
usa1[i++] = ui1;
usa1[i++] = ui1 >> 8;
...
Code: Select all
...
usa1[i++] = Lo(ui1);
usa1[i++] = Hi(ui1);
...
Code: Select all
...
ui1 = usa1[i] | usa1[i + 1] << 8;
...
Code: Select all
...
Lo(ui1) = usa1[i++];
Hi(ui1) = usa1[i++];
...
-