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

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

OTP单片机实现电位计控制PWM程序芯片解密

单片机源程序如下:

  1. 芯片解密#include <12F509.h>
  2. 芯片解密#fuses INTRC,NOWDT,NOPROTECT, NOMCLR
  3. 芯片解密#use delay(clock=4000000)
  4. #define GP0 PIN_B0
  5. #define GP1 PIN_B1
  6. #define GP2 PIN_B2
  7. #define GP3 PIN_B3
  8. #define GP4 PIN_B4
  9. #define GP5 PIN_B5

  10. #define set_options(value)   {#ASM         \
  11.                               MOVLW  value \
  12.                               OPTION       \
  13.                               #ENDASM}

  14. #define UART_TX_HI() output_high(GP2)
  15. #define UART_TX_LO() output_low(GP2)
  16. #define BitTime 40

  17. void GP5_In()
  18. {
  19.         output_low (GP5);
  20.         set_tris_b(0xfa);

  21. }

  22. void GP5_Out()
  23. {

  24.         set_tris_b(0xda);
  25.         output_high (GP5);
  26. }

  27. unsigned char duty;
  28. unsigned char i;

  29. void cycle_backward (void)
  30. {
  31.    output_low (GP2);
  32.    delay_us (70);
  33.    output_high (GP2);
  34.    delay_us (70);
  35. }

  36. void Get_Pos()
  37. {

  38.         set_tris_b(0xfa); //GP5 input
  39.         while(input(GP5) == 0)
  40.         {
  41.                 duty++;
  42.         }
  43.         set_tris_b(0xda); //GP5 output
  44. }

  45. void GetAdc()
  46. {
  47.         duty = 0;
  48.         output_high(GP4);    //Activate Pullup
  49.        
  50.         while(input(GP5) == 0)
  51.         {
  52.                 duty++;
  53.                 if(duty==255)
  54.                 {
  55.                         output_low(GP4);
  56.                         return;
  57.                 }
  58.         }
  59.         output_low(GP4);   // No pullup
  60. }

  61. void UART_Transmit(unsigned char DataValue)
  62. {
  63.        
  64.         /* Basic Logic
  65.        
  66.         TX pin is usually high. A high to low bit is the starting bit and
  67.         a low to high bit is the ending bit. No parity bit. No flow control.
  68.         BitCount is the number of bits to transmit. Data is transmitted LSB first.
  69.         */
  70.         // Send Start Bit
  71.         UART_TX_LO();
  72.         delay_us(BitTime);   //delay_us(33); //
  73.         for ( i = 0; i < 8; i++ )
  74.         {
  75.         // Set Data pin according to the DataValue
  76.                 if( ((DataValue>>i)&0x1) == 0x1 ) // If Bit is high
  77.                 {
  78.                         UART_TX_HI();
  79.                 }
  80.                 else // If Bit is low
  81.                 {
  82.                         UART_TX_LO();
  83.                 }
  84.                 delay_us(BitTime);  //delay_us(33); //
  85.         }
  86.         // Send Stop Bit
  87.         UART_TX_HI();
  88.         delay_us(BitTime);  //delay_us(33); //
  89. }



联系方式

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

在线客服
热线电话

企业微信