Because of the Thanksgiving holiday in the U.S., TI E2E™ design support forum responses may be delayed from November 25 through December 2. Thank you for your patience.

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SN74LV8154: counter resets of RCLK is connected

Part Number: SN74LV8154

Hey, everyone!

I am using SN74LV8154 binary counter with Hercules RM57Lx LaunchPad. It counts but keeps resetting at 15 or 7 (or sometimes less).

After investigating, I observed that when I remove the RCLK connection for a while and then connect it back, the counts' value it shows is more than 15 (e.g. 20-30, 100, 8852, etc.). I checked multiple times. When RCLK is not connected, it counts fine but resets when RCLK is connected.

Please, help!

Thanks,
Apurv

  • I do not have a clean drawn schematic but the connections are the following:

    (left side is SN74LV8154)

    Y0-Y7 -----  GIOA 0, 1, 2, 5, 6, 7, GIOB 2, 3
    VCC   -----  5V
    GND  -----  GND
    GAL   -----  HET1_2
    GAU  -----  HET1_18
    GBL   -----  HET1_16
    GBU  -----  HET1_30
    CLKA -----  HET1_22
    CLKB -----  (not connected)
    RCLK -----  HET1_14
    CCLR -----  HET1_4
    (RCOA and CLKBEN shorted)

    Please, find the code attached as well.

    HL_sys_main.c
    /* pin configurations:
     *
     * GIOA 0,1,2,5,6,7, GIOB 2,3 : to read the 8-bit parallel data
     *
     * GAL : HET1[2]
     * GAU : HET1[18]
     * GBL : HET1[16]
     * GBU : HET1[30]
     *
     * RCLK : HET1[14]
     * CCLR : HET1[4]
     *
     * CLK : HET1[22]
     */
    
    // include files
    #include "HL_sys_common.h"
    #include "HL_gio.h"
    #include "HL_sci.h"
    #include "HL_het.h"
    #include <stdio.h>
    
    #define GAL 2
    #define GAU 18
    #define GBL 16
    #define GBU 30
    #define RCLK 14
    #define CCLR 4
    #define CLK 22
    
    char count[20];
    
    void main()
     {
        uint32 freq = 0;
        uint8 b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20,b21,b22,b23,b24,b25,b26,b27,b28,b29,b30,b31;
    
        __delay_cycles(10);
    
        // Initialize GIO driver
        gioInit();
    
        // Initialize SCI driver
        sciInit();
    
        // Initialize HET driver
        hetInit();
    
        // setting HET1 driver pins as output
        gioSetDirection(hetPORT1, 0xFFFFFFFF);
    
        //setting GIOA and GIOB driver pins as input
        gioSetDirection(gioPORTA, 0x00000000);
        gioSetDirection(gioPORTB, 0x00000000);
    
        // initialization of the register
        gioSetBit(hetPORT1, GAL, 1);
        gioSetBit(hetPORT1, CCLR, 0);
        gioSetBit(hetPORT1, GAU, 1);
        gioSetBit(hetPORT1, GBL, 1);
        gioSetBit(hetPORT1, GBU, 1);
        gioSetBit(hetPORT1, RCLK, 0);
        gioSetBit(hetPORT1, CCLR, 1);
        gioSetBit(hetPORT1, CLK, 0);
    
        while (1)
        {
            freq = 0;
    
            // set CLOCK pulse
            gioSetBit(hetPORT1, CLK, 1);
            __delay_cycles(11);
            gioSetBit(hetPORT1, CLK, 0);
    
            // set RCLK pulse
            gioSetBit(hetPORT1, RCLK, 1);
            __delay_cycles(33);
            gioSetBit(hetPORT1, RCLK, 0);
    
            // read GBU byte
            gioSetBit(hetPORT1, GBU, 0);
    
            // read bits
            b31 = gioGetBit(gioPORTB, 3);
            freq = freq|b31;
            freq<<=1;
            b30 = gioGetBit(gioPORTB, 2);
            freq = freq|b30;
            freq<<=1;
            b29 = gioGetBit(gioPORTA, 7);
            freq = freq|b29;
            freq<<=1;
            b28 = gioGetBit(gioPORTA, 6);
            freq = freq|b28;
            freq<<=1;
            b27 = gioGetBit(gioPORTA, 5);
            freq = freq|b27;
            freq<<=1;
            b26 = gioGetBit(gioPORTA, 2);
            freq = freq|b26;
            freq<<=1;
            b25 = gioGetBit(gioPORTA, 1);
            freq = freq|b25;
            freq<<=1;
            b24 = gioGetBit(gioPORTA, 0);
            freq = freq|b24;
            freq<<=1;
    
            // set GBU to HIGH again
            gioSetBit(hetPORT1, GBU, 1);
    
    
            // read GBL byte
            gioSetBit(hetPORT1, GBL, 0);
    
            // read bits
            b23 = gioGetBit(gioPORTB, 3);
            freq = freq|b23;
            freq<<=1;
            b22 = gioGetBit(gioPORTB, 2);
            freq = freq|b22;
            freq<<=1;
            b21 = gioGetBit(gioPORTA, 7);
            freq = freq|b21;
            freq<<=1;
            b20 = gioGetBit(gioPORTA, 6);
            freq = freq|b20;
            freq<<=1;
            b19 = gioGetBit(gioPORTA, 5);
            freq = freq|b19;
            freq<<=1;
            b18 = gioGetBit(gioPORTA, 2);
            freq = freq|b18;
            freq<<=1;
            b17 = gioGetBit(gioPORTA, 1);
            freq = freq|b17;
            freq<<=1;
            b16 = gioGetBit(gioPORTA, 0);
            freq = freq|b16;
            freq<<=1;
    
            // set GBL to HIGH again
            gioSetBit(hetPORT1, GBL, 1);
    
    
            // read GAU byte
            gioSetBit(hetPORT1, GAU, 0);
    
            // read bits
            b15 = gioGetBit(gioPORTB, 3);
            freq = freq|b15;
            freq<<=1;
            b14 = gioGetBit(gioPORTB, 2);
            freq = freq|b14;
            freq<<=1;
            b13 = gioGetBit(gioPORTA, 7);
            freq = freq|b13;
            freq<<=1;
            b12 = gioGetBit(gioPORTA, 6);
            freq = freq|b12;
            freq<<=1;
            b11 = gioGetBit(gioPORTA, 5);
            freq = freq|b11;
            freq<<=1;
            b10 = gioGetBit(gioPORTA, 2);
            freq = freq|b10;
            freq<<=1;
            b9 = gioGetBit(gioPORTA, 1);
            freq = freq|b9;
            freq<<=1;
            b8 = gioGetBit(gioPORTA, 0);
            freq = freq|b8;
            freq<<=1;
    
            // set GAU to HIGH again
            gioSetBit(hetPORT1, GAU, 1);
    
    
            // read GAL byte
            gioSetBit(hetPORT1, GAL, 0);
    
            // read bits
            b7 = gioGetBit(gioPORTB, 3);
            freq = freq|b7;
            freq<<=1;
            b6 = gioGetBit(gioPORTB, 2);
            freq = freq|b6;
            freq<<=1;
            b5 = gioGetBit(gioPORTA, 7);
            freq = freq|b5;
            freq<<=1;
            b4 = gioGetBit(gioPORTA, 6);
            freq = freq|b4;
            freq<<=1;
            b3 = gioGetBit(gioPORTA, 5);
            freq = freq|b3;
            freq<<=1;
            b2 = gioGetBit(gioPORTA, 2);
            freq = freq|b2;
            freq<<=1;
            b1 = gioGetBit(gioPORTA, 1);
            freq = freq|b1;
            freq<<=1;
            b0 = gioGetBit(gioPORTA, 0);
            freq = freq|b0;
    
            // set GAL to HIGH again
            gioSetBit(hetPORT1, GAL, 1);
    
            printf("%d\r\n", freq);
            //sciSend(sciREG1, sizeof(count), count);
        }
    }
    

    Thanks!


  • Hi Apurv,

    Your code appears fine. RCLK should not cause the counter to clear,  do you have access to an oscilloscope to see if CCLR is glitching low for some reason when RCLK is connected? Also make sure your delay function is meeting the timing requirements for this device.

    regards,

    Gabriel

  • Hi, Gabriel!

    I connected CCLR to an oscilloscope. Whenever the oscilloscope connection was there, CCLR remained high and the count values kept showing as 0. But when the oscilloscope connection was removed, it counted like before (resetting at 15).

    Also, when CCLR is high, the voltage value is around 1.25V. Shouldn't it be 3.3V ?

    Thanks and regards,
    Apurv

  • This sounds as if CCLR is floating, i.e., HET1_4 does not actually drive a valid voltage. Please check the connection.