4 3-to-8 Binary Decoder

In the previous example, four CLCs were used to implement a 2-to-4 binary encoder in hardware. The following example will demonstrate how to implement 3-to-8 binary decoder using the same principals. Table 4-1 below shows the truth table for the 3-to-8 binary decoder, and Figure 4-1 illustrates the resulting circuit that should be implemented using CLCs, based on the derived Boolean expressions. MCC was used to setup the CLC modules for this application, and the configuration settings can be found in the figures below. The configuration code can be found in 3-to-8 Binary Decoder Initialization Code.

Table 4-1. 3-to-8 Binary Decoder Truth Table
A2A1A0Y7Y6Y5Y4Y3Y2Y1Y0
00010000000
00101000000
01000100000
01100010000
10000001000
10100000100
11000000010
11100000001
Equation 4-1. 3-to-8 Binary Decoder Boolean Expressions
Y0=ABC
Y1=ABC
Y2=ABC
Y3=ABC
Y4=ABC
Y5=ABC
Y6=ABC
Y7=ABC
Figure 4-1. 3-to-8 Binary Decoder Circuit
Figure 4-2. CLC1 Configuration for 3-to-8 Binary Decoder
Figure 4-3. CLC2 Configuration for 3-to-8 Binary Decoder
Figure 4-4. CLC3 Configuration for 3-to-8 Binary Decoder
Figure 4-5. CLC4 Configuration for 3-to-8 Binary Decoder
Figure 4-6. CLC5 Configuration for 3-to-8 Binary Decoder
Figure 4-7. CLC6 Configuration for 3-to-8 Binary Decoder
Figure 4-8. CLC7 Configuration for 3-to-8 Binary Decoder
Figure 4-9. CLC8 Configuration for 3-to-8 Binary Decoder

3-to-8 Binary Decoder Initialization Code

/*This code block configures the CLCs
for 3-to-8 Binary Decoder.
  */

void CLC1_Initialize(void) {    
    CLCSELECT = 0x00; 	   // SLCT 0
    CLCnPOL = 0x07;	      // Gate and CLCnOUT Output polarity Selection
    CLCnSEL0 = 0x00;	     // D1S CLCIN0 (CLCIN0PPS)
    CLCnSEL1 = 0x01;	     // D2S CLCIN1 (CLCIN1PPS)
    CLCnSEL2 = 0x02;	     // D3S CLCIN2 (CLCIN2PPS) 
    CLCnSEL3 = 0x00;	     // D4S CLCIN0 (CLCIN0PPS)
    CLCnGLS0 = 0x02;	     // CLCn Gate 1 Logic Selection
    CLCnGLS1 = 0x08;	     // CLCn Gate 2 Logic Selection
    CLCnGLS2 = 0x08;	     // CLCn Gate 3 Logic Selection
    CLCnGLS3 = 0x00;	     // CLCn Gate 4 Logic Selection
    CLCDATA = 0x00;	      // CLC1OUT 0
    CLCnCON = 0x80;	      // EN enabled; INTN disabled; INTP disabled; MODE AND-OR
}

void CLC2_Initialize(void) {
    CLCSELECT = 0x01;	    // SLCT 1
    CLCnPOL = 0x03;	      // Gate and CLCnOUT Output polarity Selection
    CLCnSEL0 = 0x00;	     // D1S CLCIN0 (CLCIN0PPS)
    CLCnSEL1 = 0x01;	     // D2S CLCIN1 (CLCIN1PPS)
    CLCnSEL2 = 0x02;	     // D3S CLCIN2 (CLCIN2PPS)
    CLCnSEL3 = 0x00;	     // D4S CLCIN0 (CLCIN0PPS)
    CLCnGLS0 = 0x02;	     // CLCn Gate 1 Logic Selection
    CLCnGLS1 = 0x08;            // CLCn Gate 2 Logic Selection
    CLCnGLS2 = 0x20; 	    // CLCn Gate 3 Logic Selection
    CLCnGLS3 = 0x00; 	    // CLCn Gate 4 Logic Selection
    CLCDATA = 0x00;	      // CLC2OUT 0
    CLCnCON = 0x80;	      // EN enabled; INTN disabled; INTP disabled; MODE AND-OR
}

void CLC3_Initialize(void) {
    CLCSELECT = 0x02;	    // SLCT 2
    CLCnPOL = 0x05;	      // Gate and CLCnOUT Output polarity Selection
    CLCnSEL0 = 0x00;	     // D1S CLCIN0 (CLCIN0PPS)
    CLCnSEL1 = 0x01;	     // D2S CLCIN1 (CLCIN1PPS)
    CLCnSEL2 = 0x02;	     // D3S CLCIN2 (CLCIN2PPS)
    CLCnSEL3 = 0x00;	     // D4S CLCIN0 (CLCIN0PPS)
    CLCnGLS0 = 0x02;	     // CLCn Gate 1 Logic Selection
    CLCnGLS1 = 0x08;	     // CLCn Gate 2 Logic Selection
    CLCnGLS2 = 0x20;	     // CLCn Gate 3 Logic Selection
    CLCnGLS3 = 0x00;	     // CLCn Gate 4 Logic Selection
    CLCDATA = 0x00;	      // CLC3OUT 0
    CLCnCON = 0x80;	      // EN enabled; INTN disabled; INTP disabled; MODE AND-OR
}

void CLC4_Initialize(void) {    
    CLCSELECT = 0x03;	    // SLCT 3
    CLCnPOL = 0x01;	      // Gate and CLCnOUT Output polarity Selection
    CLCnSEL0 = 0x00;	     // D1S CLCIN0 (CLCIN0PPS) 
    CLCnSEL1 = 0x01;	     // D2S CLCIN1 (CLCIN1PPS)
    CLCnSEL2 = 0x02;	     // D3S CLCIN2 (CLCIN2PPS)
    CLCnSEL3 = 0x00;	     // D4S CLCIN0 (CLCIN0PPS)
    CLCnGLS0 = 0x02;	     // CLCn Gate 1 Logic Selection
    CLCnGLS1 = 0x08;	     // CLCn Gate 2 Logic Selection
    CLCnGLS2 = 0x20;	     // CLCn Gate 3 Logic Selection
    CLCnGLS3 = 0x00; 	    // CLCn Gate 4 Logic Selection
    CLCDATA = 0x00;	      // CLC4OUT 0
    CLCnCON = 0x80;	      // EN enabled; INTN disabled; INTP disabled; MODE AND-OR
}

void CLC5_Initialize(void) {    
    CLCSELECT = 0x04;	    // SLCT 4
    CLCnPOL = 0x06;	      // Gate and CLCnOUT Output polarity Selection
    CLCnSEL0 = 0x00;	     // D1S CLCIN0 (CLCIN0PPS)
    CLCnSEL1 = 0x01;	     // D2S CLCIN1 (CLCIN1PPS)
    CLCnSEL2 = 0x02;	     // D3S CLCIN2 (CLCIN2PPS)
    CLCnSEL3 = 0x00;	     // D4S CLCIN0 (CLCIN0PPS)
    CLCnGLS0 = 0x02;	     // CLCn Gate 1 Logic Selection
    CLCnGLS1 = 0x08; 	    // CLCn Gate 2 Logic Selection
    CLCnGLS2 = 0x20;	     // CLCn Gate 3 Logic Selection
    CLCnGLS3 = 0x00;	     // CLCn Gate 4 Logic Selection
    CLCDATA = 0x00;	      // CLC5OUT 0
    CLCnCON = 0x80;	      // EN enabled; INTN disabled; INTP disabled; MODE AND-OR
}

void CLC6_Initialize(void) {    
    CLCSELECT = 0x05;	    // SLCT 5 
    CLCnPOL = 0x02;	      // Gate and CLCnOUT Output polarity Selection
    CLCnSEL0 = 0x00;	     // D1S CLCIN0 (CLCIN0PPS)
    CLCnSEL1 = 0x01;	     // D2S CLCIN1 (CLCIN1PPS)
    CLCnSEL2 = 0x02;	     // D3S CLCIN2 (CLCIN2PPS)
    CLCnSEL3 = 0x00;	     // D4S CLCIN0 (CLCIN0PPS)
    CLCnGLS0 = 0x02;	     // CLCn Gate 1 Logic Selection
    CLCnGLS1 = 0x08;	     // CLCn Gate 2 Logic Selection
    CLCnGLS2 = 0x20;	     // CLCn Gate 3 Logic Selection
    CLCnGLS3 = 0x00;	     // CLCn Gate 4 Logic Selection
    CLCDATA = 0x00;	      // CLC6OUT 0
    CLCnCON = 0x80;	      // EN enabled; INTN disabled; INTP disabled; MODE AND-OR
}

void CLC7_Initialize(void) {    
    CLCSELECT = 0x06;	    // SLCT 6; 
    CLCnPOL = 0x04;	      // Gate and CLCnOUT Output polarity Selection
    CLCnSEL0 = 0x00;	     // D1S CLCIN0 (CLCIN0PPS); 
    CLCnSEL1 = 0x01;	     // D2S CLCIN1 (CLCIN1PPS); 
    CLCnSEL2 = 0x02;	     // D3S CLCIN2 (CLCIN2PPS); 
    CLCnSEL3 = 0x00;	     // D4S CLCIN0 (CLCIN0PPS); 
    CLCnGLS0 = 0x02;	     // CLCn Gate 1 Logic Selection
    CLCnGLS1 = 0x08;	     // CLCn Gate 2 Logic Selection
    CLCnGLS2 = 0x20;	     // CLCn Gate 3 Logic Selection
    CLCnGLS3 = 0x00;	     // CLCn Gate 4 Logic Selection
    CLCDATA = 0x00;	      // CLC7OUT 0; 
    CLCnCON = 0x80;	      // EN enabled; INTN disabled; INTP disabled; MODE AND-OR; 
}

void CLC8_Initialize(void) {    
    CLCSELECT = 0x07;	    // SLCT 7; 
    CLCnPOL = 0x00;             // Gate and CLCnOUT Output polarity Selection
    CLCnSEL0 = 0x00;	     // D1S CLCIN0 (CLCIN0PPS); 
    CLCnSEL1 = 0x01;	     // D2S CLCIN1 (CLCIN1PPS); 
    CLCnSEL2 = 0x02;	     // D3S CLCIN2 (CLCIN2PPS); 
    CLCnSEL3 = 0x00;	     // D4S CLCIN0 (CLCIN0PPS); 
    CLCnGLS0 = 0x02;	     // CLCn Gate 1 Logic Selection
    CLCnGLS1 = 0x08;	     // CLCn Gate 2 Logic Selection
    CLCnGLS2 = 0x20;	     // CLCn Gate 3 Logic Selection
    CLCnGLS3 = 0x00;	     // CLCn Gate 4 Logic Selection
    CLCDATA = 0x00;	      // CLC8OUT 0; 
    CLCnCON = 0x80;	      // EN enabled; INTN disabled; INTP disabled; MODE AND-OR; 
}