I was trying to display 7-segment LED on MDA-8086 kit, but I am stuck at calculating the hexadecimal values for respective digits. I have the code with me, but I don't understand how it actually works. For example, 0 is represented by hexadecimal value 0xc0 [I guess]. I am wondering, how the values have been calculated here?
C Code for 7-segment LED display:
#include"mde8086.h"
int data[11] = { 0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x90, 0x00 };
void wait(long del)
{
while( del-- );
}
void main(void)
{
int *data1;
/* 8255 -1 Initialization */
outportb( PPI1_CR, 0x80 );
outportb( PPI1_B, 0xf0 );
outportb( PPI1_C, 0x00 );
//main loop
do {
data1 = data;
while( *data1 != 0x00 )
{
outportb( PPI1_A, *data1 );
wait(30000);
data1++;
}
} while(1);
}
The output has been generated from here: