Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/30/09 17:38
Read: times


 
#172041 - Responding to: Sherif
Responding to: ???'s previous message
Sherif:

The 'HC165 will present a QH to the MCU that is a copy of the H input to the shift register very shortly after the SH/LD pin has gone low. If there is a CLK L->H edge before the MCU reads the initial QH pin then that data is lost and replaced by the internal QG data.

As someone else pointed out your code sample also has the problem in that you do a CLR of the port pin to which the 'HC165 will be sending in the serial data. This CLR places that MCU pin as a low output. You should be doing a SETB of this port pin to place it into the High Input state so that the 'HC165 can validly drive the serial data signal to the MCU.

There is a possibility that this circuit gave the appearance of working due to the problem with the MCU pin being CLRed as I mention above. In this case the 'HC165 shift register QH output would be fighting with the MCU pin and there could be a resultant long rise/fall time on the signal line as the QH tries to change to the QG value right after the first clock time. Since your code reads the serial data pin within one instruction time of the CLK edge it is possible that you read (by total luck) the previous level of the QH pin before it transitions to the QG value.

If you still have your test board for this circuit it may be a good idea to re-look at it and adjust the code a bit. If you do that then you will likely gain some good insight.

Michael Karas


List of 31 messages in thread
TopicAuthorDate
74HC165            01/01/70 00:00      
   Document your code            01/01/70 00:00      
      pen and paper            01/01/70 00:00      
         It's still illegible!            01/01/70 00:00      
            code arranged            01/01/70 00:00      
         Why not format your code?            01/01/70 00:00      
            formatted code            01/01/70 00:00      
   Indentation is very Important            01/01/70 00:00      
      "Insert Program Code" Button            01/01/70 00:00      
   what are the expectations...            01/01/70 00:00      
      and the problem is...            01/01/70 00:00      
         your code is ambiguous            01/01/70 00:00      
            succes...            01/01/70 00:00      
               Pen and paper really is a good method            01/01/70 00:00      
                  Thanks & a weird point...            01/01/70 00:00      
                     Not Weird At All            01/01/70 00:00      
                        load pulse timing            01/01/70 00:00      
                           There's a reason why it doesn't say that ...            01/01/70 00:00      
                           Load Not Triggering a Shift Cycle            01/01/70 00:00      
            Working new code part            01/01/70 00:00      
   I think this may help            01/01/70 00:00      
      Same Problem OP First Had            01/01/70 00:00      
         Responding to: Michael            01/01/70 00:00      
            look at a logic diagram of the '165            01/01/70 00:00      
            Oh dear...            01/01/70 00:00      
               To Kai            01/01/70 00:00      
                  No, it never worked!            01/01/70 00:00      
                     try it            01/01/70 00:00      
                        No, the code will destroy the chips...            01/01/70 00:00      
                           Responding to: Kai Klaas's previous message            01/01/70 00:00      
            Responding to: Sherif            01/01/70 00:00      

Back to Subject List