convert a decimal value to its binary representation ( string )

Wanted to share this snippet of code which I used to display a decimal numbers binary representation. It is quite self explanatory and easy to understand.

/**
  * Turns a decimal value to its binary representation
  */
char* dec2binWzerofill(unsigned long Dec, unsigned int bitLength){
    return dec2binWcharfill(Dec, bitLength, '0');
}

char* dec2binWcharfill(unsigned long Dec, unsigned int bitLength, char fill){
  static char bin[64];
  unsigned int i=0;
unsigned int j;
  while (Dec > 0) {
    bin[32+i++] = ((Dec & 1) > 0) ? '1' : fill;
    Dec = Dec >> 1;
  }

  for ( j = 0; j< bitLength; j++) {
    if (j >= bitLength - i) {
      bin[j] = bin[ 31 + i - (j - (bitLength - i)) ];
    }else {
      bin[j] = fill;
    }
  }
  bin[bitLength] = '';

  return bin;
}
 

AVRWIZ automatic code generator for AVR microcontrollers

AVRWIZ is a code generator for the popular Atmel AVR microcontrollers, optimized for the AVR Studio IDE. Its a very nice automatic code generator for AVR microcontrollers developed by tcg in avrfreaks, which can generate code for most common tasks. It  support baud calculator, timer calculator, multitasking generator, interrupts, ports and more. But there are several thing to be done like TWI, USI. As Author states there is lots of testing to be done. Project is open for new ideas and suggestions.

Nice thing I like about it that program is capable to generate code instantly. It can be saved as single file or whole Avr Studio project with makefile which is ready to compile instantly.
avrwizavrwiz_code

I Like the older version although it has less features still its clean and fast, get it and give it a try. The latest online version has moved from http://greschenz.dyndns.org/indeh.php?title=AvrWiz and now can be found here.

AvrWiz V 22 (latest) 

OLDER VERSIONS:

AvrWiz_0_009

AvrWiz_0_008

AvrWiz_0_007

AvrWiz_0_005

AvrWiz_0_004

AvrWiz_0_003

AvrWiz_0_002

AvrWiz_0_001

 

yet another seven segment display code generator/calculator

Yesterday I made a post regarding a seven segment display code generator, One of our reader Zafer shared his work with us through the comments section. Its a nice and useful utility. Its in Turkish language but its easy to use. Download it here  from Dropbox.

Hi Muhammad
I follow your site with interest.
I’ve prepared the following program. hopefully be useful.
Zafer
http://yadi.sk/d/0PqFkSf2P9gJr

 

 

Seven segment Display code generator / calculator

I found this awesome code generator for seven segments. There are many out there but this one has some good features. first of all you can decide which Segment is attached to which pin  [all pins should be on one port].  secondly you can get values for multiple characters and the code generator will make an array of values for you .

Give it a try. It can be downloaded here  or from codeplex website.

Capture