7hc595.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "includes.h"
  2. #ifndef __7HC595_H_
  3. #define __7HC595_H_
  4. #define HC595_SCLR_PIN GPIO_Pin_5
  5. #define HC595_SCLR_PORT GPIOA
  6. #define HC595_SCK_PIN GPIO_Pin_6
  7. #define HC595_SCK_PORT GPIOA
  8. #define HC595_RCK_PIN GPIO_Pin_4
  9. #define HC595_RCK_PORT GPIOA
  10. #define HC595_DATA_PIN GPIO_Pin_7
  11. #define HC595_DATA_PORT GPIOA
  12. #define HC165_READ_PIN GPIO_Pin_1 //9
  13. #define HC165_READ_PORT GPIOA
  14. #define HC165_CP_PIN GPIO_Pin_2 //10
  15. #define HC165_CP_PORT GPIOA
  16. #define HC165_PL_PIN GPIO_Pin_3 //13
  17. #define HC165_PL_PORT GPIOA
  18. #define HC165_DATA_READ GPIO_ReadInputDataBit(GPIOA,HC165_READ_PIN) //9
  19. #define HC165_CP_HIGH HC165_CP_PORT->BSRR = HC165_CP_PIN
  20. #define HC165_CP_LOW HC165_CP_PORT->BRR = HC165_CP_PIN
  21. #define HC165_PL_HIGH HC165_PL_PORT->BSRR= HC165_PL_PIN
  22. #define HC165_PL_LOW HC165_PL_PORT->BRR= HC165_PL_PIN
  23. #define HOLDINGREG 0x03 //读取寄存器
  24. #define WRITESINGLEREG 0x06 //写寄存器
  25. #define BROADCAST 0x09 //广播
  26. #define ERROR 0XEE
  27. extern unsigned char LastRxbuffer[13];
  28. void SetRecvProcess(unsigned char *rxbuffer);
  29. void QueryRecvProcess(unsigned char *rxbuffer);
  30. void Write_74HC595(unsigned char ChipNum,unsigned char *DataBuf);
  31. unsigned char Read_74HC165(void);
  32. #endif