how to make DP flash every sec in 2-digit 7-segments without separation of track

Submitted by lara on Thu, 06/20/2019 - 02:03

In multiplxing of 2-digit 7-segments disp and to get all two dotpoint(dp) in vetically (i,e. 2nd digit is inverted at 180 degree) pin swaping is made each others.
Further that two digit were bought alongwith pre-made standrad pcb. And the pcb is Common Anode and dot track of its is also interconnected with common point anode.
My question is, I want to make that two DPs flash together at every second without cutting(disconnecting) the tack from common which is alredy connceted with CA point in fabricated pcb??
The xc8, pic887 code is here,

//***Define the signal pins of all four displays***//
#define s1 RC0
#define s2 RC1



void main()
{
unsigned int e,f,g,h; //just variables
int i = 0; //the 2-digit value that is to be displayed
int flag =0; //for creating delay

unsigned int seg[]={0XC0, //Hex value to display the number 0
                    0XF9, //Hex value to display the number 1
                    0XA4, //Hex value to display the number 2
                    0XB0, //Hex value to display the number 3
                    0X99, //Hex value to display the number 4
                    0X92, //Hex value to display the number 5
                    0X82, //Hex value to display the number 6
                    0XF8, //Hex value to display the number 7
                    0X80, //Hex value to display the number 8
                    0X90  //Hex value to display the number 9
                   }; // dot not incoporated here


//*****I/O Configuration****//
TRISC=0X00;
TRISD=0x00;


PORTC=0XFF; 


#define _XTAL_FREQ 20000000

while(1)
{
    
  //***Splitting "i" into four digits***//  

e=d%10; //2nd digit is saved here
f=d/10;
g=f%10; //1st digit is saved here
h=f/10;


PORTD=seg[g];s1=0; //Turn ON display 1 and print 4th digit
__delay_ms(5);s1=1;     //Turn OFF display 1 after 5ms delay
PORTD=seg[e];s2=0; //Turn ON display 2 and print 3rd digit
__delay_ms(5);s2=1;     //Turn OFF display 2 after 5ms delay



if(flag>=10) //wait 
{
    i++;flag=0; 
}
flag++; //increment flag for each flash
}
}

How do i medify this code to get expetaion without hapmering the track of fabricated pcb..
Your suggestion please??
tnk u...

The Decimal Point (DP) a.k.a dot led on the 7-segment display is connected out as h pin. Now if you want to blink this for every 1 sec then just make it high for one second and turn it off for 1 sec. Since you also have to control the control pins to display numeric values while doing this you cannot use delay function. You have to use timers.

Just create a timer to overflow for every one sec and when every it overflows just toggle the value of h pin. Its pretty easy. 

  Joined April 17, 2018      120
Tuesday at 07:57 AM