A two-minute solution would be to #include <stdio.h> and to use csprintf(Buffer,"%d",Hexvalue);
Buffer must be declared as char [nnn] big enough to hold the characters plus a terminating null-character.
now i want multiply with 60 and i want decimal value ?how bob?
Will csprintf(Buffer,"%d",Hexvalue * 60u); fit your needs?
my doubt is
i got decimal value for sec i.e rps-> eg.1000,5000 like this
now i want rpm for those decimal value in decimal manner
first pitfall could be 5000 * 60 > 32767 which means you cannot use an int to hold the result.
So you have to use a long variable to hold the result of the multiplication.
Next question: What do you want to do with the result?
for finding rpm and displays it in hyperterminal or LCD , i want hex to dec
Use sprintf(), arguments for formatting attached. sprintf()
will convert numeric to formatted character string, in LCD
datasheet is an API to print a character buffer to LCD.
LCD_PrString(CHAR * sRamString);
printf1.pdf 81.5 K
Just for the vocabular: you do not need a hex-to-dec conversion but an int-to-ASCII conversion.
ASCII characters represent human readable characters (and a few control chars)
I wanted to make sure I thanked you for your help. I was going nuts. My compiler at work was able to compile. But my PC at home will not compile properly. I will fix that problem tonight. Any way I just wanted to say may thanks for your help.
hai. i want to changed the adc value from hexa decimal to decimal, i am using a PSoC microcontroller. software is PSoC creator 2.1 k. Help me to convert the value.
My code is follow...
/* Start the components */
/* Start the ADC conversion */
/* Display the value of ADC output on LCD */
output = ADC_DelSig_1_GetResult16();
/*  END OF FILE */
Welcome in the forum!
A couple of suggestions:
Upgrade Creator to 3.0, the version 3.1 will come out shortly and it might be that a project update from version 2 to 3.1 is not possible.
Your main-loop is running very fast, you will not be able to see changes on the LCD. Best is to put a CyDelay() into the loop or to set up a timer, so that you update the LCD not more often than 10 times a second. CyDelay description to be found in "System Reference Guide" under the Help-menu -> Documentation ...
Clear the display by writing a string with spaces before writing a new value. The new value may have lesser digits, so you won't see the correct result.
And lastly: You posted in a PSoC1 forum and you are obviously using a PSoC3, 4 or 5. So some of us will not look at this (rather old) thread to find your question.
One way around the delay problem, the waste of MIPS sitting in a loop that
does nothing, is to create in RAM a display buffer. So for example if your display
is 2 x 16, then a 2 x 16 array. Then when you want to update display, you first
check buffer for any character change from the new display data. If a character has
changed write that char to display, and update buffer. If no change do nothing. This
way you can be in a main( ) loop of any speed, and it will create a clean looking
display with no artifacts. You only change what you have to when you have to.
Eliminates display artifacts due to repeated fast writes