+ Post New Thread
Results 1 to 4 of 4
  1. #1
    Member level 3
    Points: 529, Level: 4

    Join Date
    Oct 2017
    Posts
    57
    Helped
    0 / 0
    Points
    529
    Level
    4

    Displaying value on 2 line 4 digit 7 segment code

    I have using arduino Uno . I have used serial in parallel out to display the parameter. Here i am pasting the piece of code.

    Totally i have 8 digit of 7 segment display.Dissect & Dissect2 split the value and place into segment

    Currently i have test condition under current fault.
    with below piece of function I could able to display 001.3 on top and UC-F at bottom.

    I am looking for C function where i could able to display like

    R01.3 on top and UC-F on bottom.someone help me coding to display character like mentioned.
    Code:
    
    const unsigned char DISPTABLE[28] = {0x03,0x9F,0x25,0x0D,0x99,0x49,0x41,0x1F,0x01,0x09,0x11,0x83,0x31,
    						  			  //0  //1  //2  //3  //4  //5  //6  //7  //8  //9  //A  //U  //P
    		              			     0xD1,0xE3,0x89,0x63,0xE1,0xF5,0xC1,0x61,0x71,0xF3,0xFD,0xD5,0x85,0xFF,0x91};
    					     			  //h  //L  //Y  //C  //t  //r  //b   //E //F  //I  //-  //n //d  //blank //H
    
    
     
     float Rph_Current=13.0;
     float Yph_Current=0.0;
     float Bph_Current=1.0;
    
    
    
    
    
    void Split(unsigned int Value) {		// Spliting of process value in digits form
    	unsigned char a,Temp;
    	for(a = 4; a >= 1 ; a--) {
    		Temp = Value%10;
    		Value = Value/10;
    		LEDBuffer_1[a-1] = DISPTABLE[Temp];
    	}
    }
    
    
    
    void Split_2(unsigned int Value) {			// Spliting of process value in digits form
    	unsigned char a,Temp;
    	for(a = 4; a >= 1 ; a--) {
    		Temp = Value%10;
    		Value = Value/10;
    		LEDBuffer_1[a-1] = DISPTABLE[Temp];
    	}
    
    }
    
    
    //*********************************************************************************
    //              Current   scaling
    //********************************************************************************
    void current_scaling(unsigned int current) {
    	if(current>=10000) {
    		Dec_pt = 0;
    		temp=current/10;
    		Dissect(temp);
    	} else {
    		Dec_pt = 1 ;
    		Dissect(current);
    	}
    }
    
    void Faults(unsigned char Chr1,unsigned char Chr2,unsigned char Chr3,unsigned char Chr4,unsigned char Chr5,unsigned char Chr6,unsigned char Chr7,unsigned char Chr8) {
    
    	LEDBuffer_1[0] = DISPTABLE[Chr1];
    	LEDBuffer_1[1] = DISPTABLE[Chr2];
    	LEDBuffer_1[2] = DISPTABLE[Chr3];
    	LEDBuffer_1[3] = DISPTABLE[Chr4];
    	LEDBuffer_1[4] = DISPTABLE[Chr5];
    	LEDBuffer_1[5] = DISPTABLE[Chr6];
    	LEDBuffer_1[6] = DISPTABLE[Chr7];
    	LEDBuffer_1[7]=  DISPTABLE[Chr8];
    
    }
    
    void Display_par() {
    	Disply_Par=1;
    
    	switch(Disply_Par) {
    
    		case 1: 
    			Faults(18,0,0,0,11,16,23,21);
    			//             (r,0,0,0,U,C,-,F)   
    			Display_Current(18,Rph_Current);
    			// current_scaling(Rph_Current);
    			UnderCurr_Flag=0;
    			break;
    
    		case 2:
    			Split_2(OL_Point);
    			Faults(20,0,0,0,0,14,23,21); //Overload Error
    			break;
    
    		default :
    			break;
    
    
    
    
    	}
    
    }

    •   AltAdvertisment

        
       

  2. #2
    Super Moderator
    Points: 69,411, Level: 64
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    14,177
    Helped
    3237 / 3237
    Points
    69,411
    Level
    64

    Re: Displaying value on 2 line 4 digit 7 segment code

    Hi,

    R01.3
    there is no "R" in your DISPTABLE, thus you canīt display it.

    If you want to display it you need to
    * decide which of the 7 segements should be active to show an "R".
    * then decide which Hex code this is
    * then add theis HEX code to your DISPTABLE

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



    •   AltAdvertisment

        
       

  3. #3
    Advanced Member level 1
    Points: 2,148, Level: 10
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    414
    Helped
    42 / 42
    Points
    2,148
    Level
    10

    Re: Displaying value on 2 line 4 digit 7 segment code

    Do you still want the code ?

    Display is CCD (Common Cathode Display) or CAD (Common Anode Display) type ?

    Provide circuit.



    •   AltAdvertisment

        
       

  4. #4
    Newbie level 6
    Points: 210, Level: 2

    Join Date
    Jun 2018
    Location
    INDIA
    Posts
    13
    Helped
    5 / 5
    Points
    210
    Level
    2

    Re: Displaying value on 2 line 4 digit 7 segment code

    Hi,

    I have analysed your code. According to how you made your code for each character, I found out that it's a Common Anode (Positive) display {As 7-segment LED's are getting ON when you are giving '0'}. Further, you just provided some related functions for us to analyse which according to me looks fine for the purpose required in your case. So, I logically guess that there is some error in your main function i.e. maybe in void loop() in your arduino C code due to which your data got missed or overlapped.


    2 members found this post helpful.

--[[ ]]--