MCUmall EPROM BIOS Chip Burner Forum
MCUmall EPROM BIOS Chip Burner Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 MCUmall Forums
 Novice Place
 Troubles Occurred when Debugging SN74HC165
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

fanda

China
1 Posts

Posted - 07/06/2017 :  23:24:02  Show Profile  Reply with Quote
Hello~all
I would like to ask some questions about debugging SN74HC165.
The program is so easy and there are many examples in the internet. I have debuged it two days after board-making. I don’t know why it still cannot read data out and always keep 0xFF. The wave which I detect it by oscilloscope is normal. When program is ready to install into the inside register of HX165 as well as shifting out,but why the data can’t be read out?
The SN74HC165 PDF: www.kynix.com/uploadfiles/pdf8798/SN74HC165D.pdf
My program is as following:
void HC_74165Init(void){
        GPIO_InitTypeDef GPIO_InitStructure;
        RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOC|RCC_APB2Periph_GPIOD, ENABLE);
                                                      //HC165 CLK   //HC165 SH
        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12|GPIO_Pin_11; 
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;        
    GPIO_Init(GPIOD, &GPIO_InitStructure);        
        
        
        
                                                //HC-SO
    GPIO_InitStructure.GPIO_Pin =GPIO_Pin_8; 
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode =GPIO_Mode_IPD; ; //GPIO_Mode_IPU;        
    GPIO_Init(GPIOA, &GPIO_InitStructure);                
}

u8 Read_HC165(void)
{
        u8 i;
        u8 Byte=0;
        u8 Data=0;
        SHLD_165=0;//The external port data into internal registers
        delay_nus(100);
        SHLD_165=1; //ready to shift
        delay_nus(100);
        CLK_165=1;
        for(i=0;i<8;i++)
        {
                        
                
                Byte<<=1;        
                Data=GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_8);
                        printf("%X ",Data);
                Byte|=Data;
                CLK_165=0;
                delay_nus(5000);
                CLK_165=1;
                
        }
        
        return Byte;
        
}



Image Insert:

89452 bytes

Image Insert:

7585 bytes

Image Insert:

8337 bytes

Nothing is impossible.

Edited by - fanda on 07/06/2017 23:25:16
Reply #1

supervizeur

462 Posts

Posted - 07/09/2017 :  08:22:17  Show Profile  Reply with Quote
quote:
Originally posted by fanda

Hello~all
I would like to ask some questions about debugging SN74HC165.
The program is so easy and there are many examples in the internet. I have debuged it two days after board-making. I don’t know why it still cannot read data out and always keep 0xFF. The wave which I detect it by oscilloscope is normal. When program is ready to install into the inside register of HX165 as well as shifting out,but why the data can’t be read out?
The SN74HC165 PDF: www.kynix.com/uploadfiles/pdf8798/SN74HC165D.pdf
My program is as following:
void HC_74165Init(void){
        GPIO_InitTypeDef GPIO_InitStructure;
        RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOC|RCC_APB2Periph_GPIOD, ENABLE);
                                                      //HC165 CLK   //HC165 SH
        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12|GPIO_Pin_11; 
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;        
    GPIO_Init(GPIOD, &GPIO_InitStructure);        
        
        
        
                                                //HC-SO
    GPIO_InitStructure.GPIO_Pin =GPIO_Pin_8; 
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode =GPIO_Mode_IPD; ; //GPIO_Mode_IPU;        
    GPIO_Init(GPIOA, &GPIO_InitStructure);                
}

u8 Read_HC165(void)
{
        u8 i;
        u8 Byte=0;
        u8 Data=0;
        SHLD_165=0;//The external port data into internal registers
        delay_nus(100);
        SHLD_165=1; //ready to shift
        delay_nus(100);
        CLK_165=1;
        for(i=0;i<8;i++)
        {
                        
                
                Byte<<=1;        
                Data=GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_8);
                        printf("%X ",Data);
                Byte|=Data;
                CLK_165=0;
                delay_nus(5000);
                CLK_165=1;
                
        }
        
        return Byte;
        
}



Image Insert:

89452 bytes

Image Insert:

7585 bytes

Image Insert:

8337 bytes



You should ask help on the Kynix forum.
Go to Top of Page
Reply #2

anniel

2532 Posts

Posted - 07/15/2017 :  19:59:47  Show Profile  Reply with Quote
quote:
Originally posted by supervizeur

quote:
Originally posted by fanda

Hello~all
I would like to ask some questions about debugging SN74HC165.
The program is so easy and there are many examples in the internet. I have debuged it two days after board-making. I don’t know why it still cannot read data out and always keep 0xFF. The wave which I detect it by oscilloscope is normal. When program is ready to install into the inside register of HX165 as well as shifting out,but why the data can’t be read out?
The SN74HC165 PDF: www.kynix.com/uploadfiles/pdf8798/SN74HC165D.pdf
My program is as following:
void HC_74165Init(void){
        GPIO_InitTypeDef GPIO_InitStructure;
        RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOC|RCC_APB2Periph_GPIOD, ENABLE);
                                                      //HC165 CLK   //HC165 SH
        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12|GPIO_Pin_11; 
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;        
    GPIO_Init(GPIOD, &GPIO_InitStructure);        
        
        
        
                                                //HC-SO
    GPIO_InitStructure.GPIO_Pin =GPIO_Pin_8; 
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode =GPIO_Mode_IPD; ; //GPIO_Mode_IPU;        
    GPIO_Init(GPIOA, &GPIO_InitStructure);                
}

u8 Read_HC165(void)
{
        u8 i;
        u8 Byte=0;
        u8 Data=0;
        SHLD_165=0;//The external port data into internal registers
        delay_nus(100);
        SHLD_165=1; //ready to shift
        delay_nus(100);
        CLK_165=1;
        for(i=0;i<8;i++)
        {
                        
                
                Byte<<=1;        
                Data=GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_8);
                        printf("%X ",Data);
                Byte|=Data;
                CLK_165=0;
                delay_nus(5000);
                CLK_165=1;
                
        }
        
        return Byte;
        
}



Image Insert:

89452 bytes

Image Insert:

7585 bytes

Image Insert:

8337 bytes



You should ask help on the Kynix forum.



+1 and good luck!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
MCUmall EPROM BIOS Chip Burner Forum © Copyright 2003 - 2009 Mcumall Electronics Inc. Go To Top Of Page
Generated in 0.16 sec. Snitz Forums 2000