Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
For those compilers that do not have a built-in function for swapping a byte's nibbles, a simple user function can be created:
unsigned char SwapNibbles (unsigned char x)
{
return ((x >> 4) & 0x0F) | ((x << 4) & 0xF0);
}
And a couple of function call examples:
unsigned char...
Some compilers may have built in functions for these convertions, but others don't. Below are two functions for converting a BCD number to decimal and vice versa:
#define uint8 unsigned char
uint8 BCDToDecimal (uint8 bcdByte)
{
return (((bcdByte & 0xF0) >> 4) * 10) + (bcdByte & 0x0F)...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.