Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Converting a binary number 0 to 99 into a two digit BCD number

nazzienazzie Posts: 2Member
Hi I am coding a utility with different types of conversion. currently I am compiling my program but it says "warning data definition has no type or storage class c in Line 12"

can someone tell me whats wrong and explain please. thanks.

[code]
#include
#include
#include
#include
#include

//! Converts a binary number 0 to 99 into a two digit BCD number
//extern uint8_t BinBcdB( uint8_t ubBIN );



void uint8_t BinBcdB;
{
uint8_t BcdNumber=0;
if(ubBin>=100)
return 0;
BcdNumber=ubBin%10; // unit place
BcdNumber|=(BcdNumber/10)<<4; // ten's place
return BcdNumber;
}

void uint8_t CvtBin;
{
uint8_t ubBin=0;
ubBin=((BcdNumber&0xF0)>>4)*10 +(BcdNumber&0x0F);
return ubBin;

}

int main()
{
uint8_t binBcdB[] = { 0x01, 0x23 };

uint16_t binaryValue = CvtBin(binBcdB);
printf("BcdBin(%02x%02x) returned %d
", binBcdB[0], binBcdB[1], binaryValue);
return 0;
}
[/code]
Sign In or Register to comment.