芯片解密,芯片破解,IC解密,单片机解密,MCU解密,STM解密

飞芯科技提供芯片解密,芯片破解,IC解密,单片机解密,MCU解密,STM解密逆向服务

芯片复制C8051F330单片机的无线键盘程序

芯片复制单片机源程序如下:

  1. //-----------------------------------------------------------------------------
  2. // Includes
  3. //-----------------------------------------------------------------------------

  4. #include <c8051f330.h>                 // SFR declarations
  5. #include <stdio.h>
  6. #include "mytype.h"
  7. #include "config.h"

  8. static uint16 idle_timeout_time=300;//无按键按下超时,5min
  9. static uint16 idle_timeout=0;//无按键按下超时
  10. static uint8 reconn_flag=0;//重新连接标志
  11. static uint8 poweroff_flag=0;//关机标志
  12. static uint8 bat_val=0;//电池电压
  13. static uint8 adc_flag=0;//电池电压测试标志,10min
  14. static uint16 adc_timeout=0;//电压测试时间
  15. uint8 code batt[16]= {0x27,0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x05,0x04,0x17,0x10,0x0C,0x11}; //0~9,bat,min

  16. #define vcc_on        1
  17. #define vcc_off        0
  18. #define bl_on        0
  19. #define bl_off        1
  20. //-----------------------------------------------------------------------------
  21. // Global CONSTANTS
  22. //-----------------------------------------------------------------------------

  23. #define SYSTEMCLOCK      6125000           // SYSCLK frequency in Hz
  24. #define BAUDRATE         57600           // Baud rate of UART in bps

  25. #define TIMER_PRESCALER            48  // Based on Timer CKCON settings

  26. // There are SYSTEMCLOCK/TIMER_PRESCALER timer ticks per second, so
  27. // SYSCLK/TIMER_PRESCALER/1000 timer ticks per millisecond.
  28. #define TIMER_TICKS_PER_MS  SYSTEMCLOCK/TIMER_PRESCALER/1000

  29. // Note: TIMER_TICKS_PER_MS should not exceed 255 (0xFF) for the 8-bit timer

  30. #define AUX1     TIMER_TICKS_PER_MS
  31. #define AUX2     -AUX1

  32. #define TIMER0_RELOAD_HIGH       AUX2  // Reload value for Timer0 high byte

  33. //-----------------------------------------------------------------------------
  34. // Function PROTOTYPES
  35. //-----------------------------------------------------------------------------
  36. void ADC0_Init(void);
  37. void SYSCLK_Init (void);
  38. void UART0_Init (void);
  39. void PORT_Init (void);
  40. void Timer0_Init (void);
  41. void KEY_VAL(uint8 tmp);
  42. void delay_ms(uint16 ms);
  43. //-----------------------------------------------------------------------------
  44. // Global Variables
  45. //-----------------------------------------------------------------------------
  46. static uint8 tx_buf[12]= {0x0C,0x00,0xA1,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; //HID发送缓冲区
  47. static uint8 tx_count;//发送字节数,实际发送12个字节
  48. uint8 fn_flag;//Fn键按下状态
  49. #define FnDown        0x00
  50. #define FnUp        0x01

  51. //key
  52. #define LCtrl        0x14
  53. #define LShift         0x12
  54. #define LAlt        0x10
  55. #define LGui        0x07
  56. //#define RCtrl        0x??
  57. #define RShift         0x59
  58. #define RAlt        0x13
  59. //#define RGui        0x??
  60. #define Fn                0x02
  61. //fn_key,用于测试。实际使用时查表
  62. #define Home        0x5E
  63. #define End                0x2F
  64. #define PgUp        0x28
  65. #define PgDown        0x60
  66. #define Esc                0x0E
  67. #define F1                0x16
  68. #define        F3                0x26

  69. //uart缓冲区使用变量
  70. #define UART_BUFFERSIZE 32
  71. uint8 UART_Buffer[UART_BUFFERSIZE];
  72. uint8 UART_Buffer_Size = 0;
  73. uint8 UART_Input_First = 0;
  74. uint8 UART_Output_First = 0;
  75. uint8 TX_Ready =1;
  76. static uint8 Byte;



联系方式

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

在线客服
热线电话

企业微信