binary to hex display decoder

Thread Starter

Robin Mitchell

Joined Oct 25, 2009
819
what retard in the electornics industry decided to make EVERY BLOODY seven seg decoder not use HEX....its the most bloody used thing!
 

Thread Starter

Robin Mitchell

Joined Oct 25, 2009
819
I just made a PIC program where it can drive up to 16 seven seg diplays. It needs four IO ports (A to D) and you have the following:
Port A - 8 bit binary number
Port B - The address to save the number / the other four pins are control
Port C - The address selector ( selects which dispaly you want to drive)
Port D - The seven seg out

the trick is to split the 8 bit number into two four bit numbers and then save the first fourbit number into address (x) and the second number into address(x+1)

So when it displays the hex you get an 8 bit number into two hex displays :D
What do ya think...its also my first free product :D for the PIC18F45K20
 

tom66

Joined May 9, 2009
2,595
I just made a PIC program where it can drive up to 16 seven seg diplays. It needs four IO ports (A to D) and you have the following:
Port A - 8 bit binary number
Port B - The address to save the number / the other four pins are control
Port C - The address selector ( selects which dispaly you want to drive)
Port D - The seven seg out

the trick is to split the 8 bit number into two four bit numbers and then save the first fourbit number into address (x) and the second number into address(x+1)

So when it displays the hex you get an 8 bit number into two hex displays :D
What do ya think...its also my first free product :D for the PIC18F45K20
It seems you started liking microcontrollers after you fixed all of your problems with the PICkit 3... :)
 

spinnaker

Joined Oct 29, 2009
7,830
I just made a PIC program where it can drive up to 16 seven seg diplays. It needs four IO ports (A to D) and you have the following:
Port A - 8 bit binary number
Port B - The address to save the number / the other four pins are control
Port C - The address selector ( selects which dispaly you want to drive)
Port D - The seven seg out

the trick is to split the 8 bit number into two four bit numbers and then save the first fourbit number into address (x) and the second number into address(x+1)

So when it displays the hex you get an 8 bit number into two hex displays :D
What do ya think...its also my first free product :D for the PIC18F45K20


So that is 24 pins??? Yikes!

I would think you could do better with POV. You would probably want t a decoder chip or two to select each of the displays.
 

Thread Starter

Robin Mitchell

Joined Oct 25, 2009
819
but its a damn good chip :D
I could use a tiny pic which would take a single Hex number in and drive a single display...this one is for use with cpus like z80 so seeing the data is easier...
 

MMcLaren

Joined Feb 14, 2010
861
Sorry for the late reply but I just wanted to mention that this old design works quite well... Use two of them to display a 16-bit number (example silkscreen below)...

Regards, Mike




Rich (BB code):
;
;  // psuedo C code program example
;
;  char DigSel = 0;                     // digit select, 0 or 128
;
;  char SegData [] = { 0b00111111,      // "0"   -|-|F|E|D|C|B|A
;                      0b00000110,      // "1"   -|-|-|-|-|C|B|-
;                      0b01011011,      // "2"   -|G|-|E|D|-|B|A
;                      0b01001111,      // "3"   -|G|-|-|D|C|B|A
;                      0b01100110,      // "4"   -|G|F|-|-|C|B|-
;                      0b01101101,      // "5"   -|G|F|-|D|C|-|A
;                      0b01111101,      // "6"   -|G|F|E|D|C|-|A
;                      0b00000111,      // "7"   -|-|-|-|-|C|B|A
;                      0b01111111,      // "8"   -|G|F|E|D|C|B|A
;                      0b01101111,      // "9"   -|G|F|-|D|C|B|A
;                      0b01110111,      // "A"   -|G|F|E|-|C|B|A
;                      0b01111100,      // "b"   -|G|F|E|D|C|-|-
;                      0b00111001,      // "C"   -|-|F|E|D|-|-|A
;                      0b01011110,      // "d"   -|G|-|E|D|C|B|-
;                      0b01111001,      // "E"   -|G|F|E|D|-|-|A
;                      0b01110001 };    // "F"   -|G|F|E|-|-|-|A
;
;  void Main()
;  { char temp = porta;                 // sample input 
;    CMCON = 7;                         // turn comparator off
;    TRISA = 255;                       // Port A all inputs
;    TRISB = 0;                         // Port B all outputs
;    while(1)                           // loop forever
;    { if(DigSel.b7)                    // if left (hi) digit
;        temp /= 16;                    // use hi nibble, 0..15
;      else                             // otherwise
;        temp &= 15;                    // use lo nibble, 0..15
;      temp = SegData[temp];            // get segment data
;      temp |= DigSel;                  // pick up digit select bit
;      PORTB = temp;                    // update display
;      DelayUS(8000-23);                // delay 8-msecs total
;      DigSel ^= 128;                   // toggle digit select bit
;    }
;  }
;
 

Attachments

Last edited:
Top