74hc165 ile input coğaltma CCS C

Başlatan alfurkan1064, 02 Nisan 2021, 18:23:08

alfurkan1064

Merhabalar,
74hc165 ile pic16f887 nin inputlarını coğaltmaya calışıyorum lakin bir türlü kafama yatıramadımi ccs c nin kendi kütüphanesini kullanıyorum.

///////////////////////////////////////////////////////////////////////////
////   Library for a 74165 Expanded Input Chip                         ////
////                                                                   ////
////   Any number of these chips may be connected in series to get     ////
////   8 additional inputs per chip.  The cost is 3 I/O pins for       ////
////   any number of chips.                                            ////
////                                                                   ////
////    read_expanded_inputs(ei);  Reads the array ei from the chips   ////
////                                                                   ////
///////////////////////////////////////////////////////////////////////////
////        (C) Copyright 1996,2003 Custom Computer Services           ////
//// This source code may only be used by licensed users of the CCS C  ////
//// compiler.  This source code may only be distributed to other      ////
//// licensed users of the CCS C compiler.  No other use, reproduction ////
//// or distribution is permitted without written permission.          ////
//// Derivative programs created using this software in object code    ////
//// form are not restricted in any way.                               ////
///////////////////////////////////////////////////////////////////////////

#IFNDEF EXP_IN_ENABLE

#define EXP_IN_ENABLE   PIN_B3
#define EXP_IN_CLOCK    PIN_B4
#define EXP_IN_DI       PIN_B5
#define NUMBER_OF_74165 1

#ENDIF


void read_expanded_inputs(BYTE *ei) {
  BYTE i;

  output_high(EXP_IN_CLOCK);
  output_low(EXP_IN_ENABLE);      // Latch all inputs
  output_high(EXP_IN_ENABLE);

  for(i=1;i<=NUMBER_OF_74165*8;++i) {      // Clock in bits to the ei structure
    shift_left(ei,NUMBER_OF_74165,input(EXP_IN_DI));
    output_low(EXP_IN_CLOCK);
    output_high(EXP_IN_CLOCK);
  }
  output_low(EXP_IN_ENABLE);
}

Ana kod bloğum içindede if(button[0x00]){output_high(pin_a2);delay_ms(150);hedef_1++;}  şeklinde kullanıyorum nerde hatam var acaba .?

Saygılarımla

sifirzero

sifirzero.blogspot.com [email]sifirrzero@gmail.com[/email] iman hem nurdur hem kuvvettir

ziyaretci

Aşağıdaki koddan şunu anlıyorum; button diye bir dizi var ve bu button dizisinin 0. indeksinin değeri 0'dan büyük ise kod bloğunun içindeki işlemleri gerçekleştir. Sizde bu şekilde düşünerek mi yazdınız bu satırı?
if(button[0x00]){output_high(pin_a2);delay_ms(150);hedef_1++;}

alfurkan1064

Alıntı yapılan: sifirzero - 03 Nisan 2021, 13:35:37Kardesim örnek olurmu bilmiyorum. Bakabilirsiniz.https://www.sifirzero.com/2020/07/pic-programlama-ccs-c-74hc164-ile.html?m=1

Sitede baska örneklerde var.
Değerli yorumunuz için teşekkür ederim,ayrıca geç geri dönüş için özür diliyorum.

alfurkan1064

Alıntı yapılan: erkantr67 - 11 Nisan 2021, 09:54:02Aşağıdaki koddan şunu anlıyorum; button diye bir dizi var ve bu button dizisinin 0. indeksinin değeri 0'dan büyük ise kod bloğunun içindeki işlemleri gerçekleştir. Sizde bu şekilde düşünerek mi yazdınız bu satırı?
if(button[0x00]){output_high(pin_a2);delay_ms(150);hedef_1++;}
Değerli yorumunuz için teşekkür ederim,ayrıca geç geri dönüş için özür diliyorum.

Tam olarak hatırlamıyorum  74hc165'den butonu seçmek için yaptığım aklıma kalmış sadece, yanlışım nerede yardımcı olursanız memnun olurum saygılarımla.