hello,
more simple solution
The mikroC PRO for PIC compiler provides a set of useful built-in utility functions.
The Lo, Hi, Higher, Highest routines are implemented as macros. If you want to use these functions
you must include built_in.h header file (located in the include folder of the compiler) into your project.
example
Code: Select all
// to load TMR1 value 0x0BDB ( 3035 decimal)
TMR1H= Hi (3035);
TMR1L= Lo (3035);
or for eeprom:
to store the value 32769 into Eeprom adresse 0 and 1
Code: Select all
unsigned int My_DAta; //integer 16 bits data
My_Data = 32769 ;
EEPROM_Write(0x0000, HI(My_Data);
EEPROM_Write(0x0001, Lo(My_Data);
another way : use pointer .
Code: Select all
unsigne int My_Data;
unsigned char *p1;
p1= &My_Data;
My_Data=32769;
EEPROM_Write(0x0000, *(p1));
EEPROM_Write(0x0001, *(p1+1));