Converting a binary number 0 to 99 into a two digit BCD number - Programmers Heaven

Howdy, Stranger!

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

Categories

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.