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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/28/09 11:50
Modified:
  12/28/09 11:51

Read: times


 
#171979 - Working new code part
Responding to: ???'s previous message
Modified new code according to Jan Waclawec's suggestion as follows

      cseg  AT  0000H
      jmp   codstr
.
.
.
      cseg  AT  0050H
codstr:                 ;(program code starts here)
.
.
.
      setb  QH          ;(set Port as input)
      setb  CLKINH      ;(prevent clock signal's rising edges accidently)
      clr   CLKP        ;NEWLY ADDED!!! (clear clock signal initially)
.
.
.
      mov   WAITFW,#32  ;(enough to meet all propagation time)
.
.
.
prgstr:                 ;(main program loop starts here)
.
.
.
      clr   SHLD        ;(reset SH/LD input of 74HC165 to get parallel inputs to register)
      call  WFW         ;(wait for a while for progopation time)
      setb  SHLD        ;(set SH/LD input of 74HC165 to read parallel inputs. this freezes the register)
      call  WFW         ;
      clr   CLKINH      ;(reset Clock Inhibit input of 74HC165 to enable clock input of 74HC165)
      call  WFW         ;

      mov   PLSCNT,#8   ;(rise clock for 8 times)

pr1:  mov   C,QH        ;(3)ROW CHANGED!!!(..then read the serial output)
      rlc   A           ;(4)ROW CHANGED!!!
      setb  CLK         ;(1)(set Clock input of 74HC165, rising edge of clock..)
      call  WFW         ;(2)
      clr   CLK         ;(5)
      call  WFW         ;(6)
      djnz  PLSCNT,pr1  ;(7)(8-bit completed?)
      mov   FRST8,A     ;(8)(get first 8-bit)

      mov   PLSCNT,#8   ;(same as the first part)

pr2:  mov   C,QH        ;(3)ROW CHANGED!!!
      rlc   A           ;(4)ROW CHANGED!!!
      setb  CLK         ;(1)
      call  WFW         ;(2)
      clr   CLK         ;(5)
      call  WFW         ;(6)
      djnz  PLSCNT,pr2  ;(7)
      mov   SCND8,A     ;(8)(get second 8-bit)

      setb  CLKINH      ;(disable clock input of 74HC165)
      call  WFW         ;
.
.
.
      jmp   prgstr      ;(end of main loop)
.
.
.
WFW:  djnz WAITFW,$     ;(simple code to wait for a while)
      mov  WAITFW,#32
      ret
.
.
.
        DSEG    AT  30H
FRST8:  DS      1
SCND8:  DS      1
WAITFW: DS      1
PLSCNT: DS      1
.
.
.
QH	EQU	P3.5
SHLD	EQU	P3.4
CLK	EQU	P3.3
CLKINH	EQU	P1.2
.
.
.
        end



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