芯片解密|单片机解密|IC解密|芯片破解|芯片复制| PCB抄板|软件开发

飞芯科技-芯片解密|单片机解密|IC解密|芯片破解|芯片复制| PCB抄板|软件开发

IC解密LPC1788的多路数据采集系统下位机

IC解密单片机源程序如下:

  1. #include "../LPC177x_8x/LPC177x_8x.h"
  2. #include "../LPC177x_8x/type.h"
  3. #include "../ADC/adc.h"
  4. #define BEEPON            (LPC_GPIO3->CLR = 1ul << 30)                  /* 蜂鸣器工作                   */
  5. #define BEEPOFF           (LPC_GPIO3->SET = 1ul << 30)                  /* 蜂鸣器不工作                 */
  6. #if ADC_DEBUG
  7. #include "../UART/uart.h"
  8. #endif

  9. extern volatile uint32_t ADCValue[ADC_NUM];
  10. extern volatile uint32_t ADCIntDone;

  11. #if ADC_DEBUG
  12. extern volatile uint32_t UART0Count;
  13. extern volatile uint8_t UART0Buffer[BUFSIZE];
  14. #endif


  15. #if ADC_DEBUG
  16. /*********************************************************************************************************
  17. ** 函数名称 :ConvertDigital
  18. ** 函数功能 :Convert Digital to ASCII
  19. ** 输入参数 : 字符
  20. ** 返回值   : ASCII字符
  21. *********************************************************************************************************/
  22. static uint8_t ConvertDigital ( uint8_t digit )
  23. {
  24.     static uint8_t hex[] = "0123456789ABCDEF";
  25.     return hex[digit & 0xf];
  26. }
  27. #endif

  28. /*********************************************************************************************************
  29. ** 函数名称:myDelay
  30. ** 函数描述:软件延时
  31. ** 输入参数:ulTime    延时大小
  32. ** 返回值  :无
  33. *********************************************************************************************************/
  34. //uint8_t tdata[5]={0x00,0x00,0x00,0x00,0x00};
  35. uint8_t buf[7];
  36. uint8_t sbuf,check;
  37. void myDelay (uint32_t ulTime)
  38. {
  39.     uint32_t i = 0;

  40.     while (ulTime--)
  41.                 {
  42.         for (i = 0; i < 20000; i++);
  43.     }
  44. }
  45. void usDelay (uint32_t ulTime)
  46. {
  47.     uint32_t i = 0;
  48.     while (ulTime--)
  49.                 {
  50.         for (i = 0; i < 20; i++);
  51.     }
  52. }
  53. void DHT11_Rst(void)          
  54. {                 
  55.         LPC_GPIO3->DIR |= 1<<25;        //SET OUTPUT
  56.   LPC_GPIO3->CLR = 1ul << 25 ;         //拉低DQ
  57.   myDelay(20);            //拉低至少18ms
  58.   LPC_GPIO3->SET = 1ul << 25;        //DQ=1
  59.         usDelay(30);             //主机拉高20~40us
  60. }
  61. //等待DHT11的回应
  62. //返回1:未检测到DHT11的存在
  63. //返回0:存在
  64. uint8_t DHT11_Check(void)           
  65. {   
  66.         uint8_t retry=0;
  67.         LPC_GPIO3->DIR &= ~(1 << 25);    //SET INPUT         
  68.   while (!(LPC_GPIO3->PIN & 1 << 25)&&retry<100)//DHT11会拉低40~80us
  69.         {
  70.                 retry++;
  71.                 usDelay(1);
  72.         }
  73.         if(retry>=100)
  74.                 return 1;
  75.         else retry=0;
  76.   while ((LPC_GPIO3->PIN & 1 << 25)&&retry<100)//DHT11拉低后会再次拉高40~80us
  77.         {
  78.                 retry++;
  79.                 usDelay(1);
  80.         }
  81.         if(retry>=100)
  82.                 return 1;            
  83.         return 0;
  84. }



联系方式

地址:石家庄市新华区民族路77号华强广场D座2009
电话:0311-88816616/87087811
手机:13315190088
传真:0311-67901001
联系人:张工
网址:www.feixindz.com
邮箱:feixindz@163.com
微信:xinpianjiemi
QQ:527263666/568069805

在线客服
热线电话

企业微信