//include file
#include <pic.h>
//16F84 configuration
__CONFIG(0x3FF1);
//defining the switches
#define PORTBIT(adr, bit) ((unsigned)(&adr)*8+(bit))
//display function
send_7_seg(int);
//main function
void main(void)
{
TRISA = 0x01;
PORTA = 0b00000000;
while(1)
{
for(int a=0; a<8; a++)
{
if ( PORTBIT(PORTA, a)==1){
send_7_seg(a);
};
}
}
void send_7_seg(int seg_num)
{
TRISB = 0x00;
PORTB = 0b00000000;
//you should write here to send your data to display
};
//i didnt simulate this program and i am not very good at pics but it could help you
//to build you project
//if you want more help, dont hesitate to send ne a private message