Hi, my program does not do the expected things, printf a unsigned long long int.
#include <aduc7026.h> #include"stdio.h" void RS232_init(void); int main (void) { unsigned long long int A; RS232_init(); printf("Start \n"); while(1) { while(1) { printf("Enter a Hex-number\n"); if (scanf("%X",&A)) break; scanf("%*"); //Clearing scanf input stream } printf ("Your input %64.64lX\n",A); A *= A; printf ("The result %64.64lX\n",A); } } void RS232_init(void) { GP1CON = 0x011; // Setup tx & rx pins on P1.0 and P1.1 // Start setting up UART at 9600bps COMCON0 = 0x080; // Setting DLAB COMDIV0 = 0x088; // Setting DIV0 and DIV1 to DL calculated COMDIV1 = 0x000; COMCON0 = 0x007; // Clearing DLAB }
"See me as someone, who is learning to fly C like the man in the film Those Magnificent Men In Their Flying Machines" remember - that film is a comedy As I've said before, this is not a very effective way to learn 'C'. Continuing with the film analogy, you have already landded yourself in the Sewage Farm several times!! "But by the way, what is the difference between all this different compilers?" As any good textbook will tell you, 'C' has a number of things which are implementation-defined, unspecified, and undefined. The stuff we're talking about here is implementation-defined. Also, the long long business is an extension to the original ANSI 'C' specification - that's why not all compilers support it! "Isn't the Keil-Compiler the best in the world?" Which one? There are two! http://www.keil.com/arm/