- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
now i want multiply with 60 and i want decimal value ?how bob?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Will csprintf(Buffer,"%d",Hexvalue * 60u); fit your needs?
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks bob
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
plz help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
for finding rpm and displays it in hyperterminal or LCD , i want hex to dec
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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)
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bob,
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.
Philip
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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...
void main()
{
uint16 output;
uint16 output1;
/* Start the components */
LCD_Start();
ADC_DelSig_1_Start();
/* Start the ADC conversion */
ADC_DelSig_1_StartConvert();
/* Display the value of ADC output on LCD */
LCD_Position(0u, 0u);
LCD_PrintString("ADC_Output");
for(;;)
{
if(ADC_DelSig_1_IsEndConversion(ADC_DelSig_1_RETURN_STATUS))
{
output = ADC_DelSig_1_GetResult16();
LCD_Position(1u, 5u);
LCD_PrintNumber(output);
}
}
}
/* [] END OF FILE */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Regards, Dana.