View previous topic :: View next topic |
Author |
Message |
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
gethex() |
Posted: Sun Feb 05, 2012 12:22 pm |
|
|
Hi I'm a new in a CCS programming. I met the function gethex() in one code, but I can't figure out what is that mean. The code is from the Examples folder of CCS program directory.
Here is the code:
Code: |
void main() {
unsigned int8 i, j, address;
INTEE value;
do {
printf("\r\n\nEEPROM:\r\n"); // Display contents of the first 64
for(i=0; i<=3; ++i) { // bytes of the data EEPROM in hex
for(j=0; j<=15; ++j) {
printf( "%2x ", read_eeprom( i*16+j ) );
}
printf("\n\r");
}
printf("\r\nLocation to change: ");
address = gethex();
printf("\r\nNew value: ");
value = gethex(); // Rikotech8: My attention point!
write_eeprom( address, value );
} while (TRUE);
} |
Excuse my poor english!
thx in advance. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Sun Feb 05, 2012 1:36 pm |
|
|
gethex() allows you to enter a byte of data in hex format instead of decimal (00 to FF instead of 0 to 255).
Very handy for loading in long data streams, especially from an 'outside ' source (like a file on a PC). Quicker if inputting by a keypad, 1 less keypress (2 instead of 2). |
|
|
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
|
Posted: Tue Feb 07, 2012 11:36 am |
|
|
Ahem I see. OK Thx@ |
|
|
|