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

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

芯片复制STM32F4+W5500以太网通讯+freemodbus源码

芯片复制
STM32F4+W5500以太网通讯+freemodbus

单片机源程序如下:

  1. /******************** (C) COPYRIGHT 2014 91mcu **************************
  2. 芯片复制
  3. **********************************************************************************/       
  4. #include <string.h>
  5. #include <stdio.h>
  6. #include "stm32f10x.h"

  7. #include "W5500.h"
  8. #include "device.h"
  9. #include "systick.h"
  10. #include "led.h"
  11. #include "mb.h"


  12. /* ----------------------- Holding register Defines ------------------------------------------*/

  13. #define REG_HOLDING_START 1000
  14. #define REG_HOLDING_NREGS 4

  15. /* ----------------------- Static variables ---------------------------------*/
  16. static unsigned short usRegHoldingStart = REG_HOLDING_START;
  17. static unsigned short usRegHoldingBuf[REG_HOLDING_NREGS]={0xaa,0x55,0x5599,0x5588};

  18. /* ----------------------- input register Defines ------------------------------------------*/
  19. #define REG_INPUT_START 1000
  20. #define REG_INPUT_NREGS 4

  21. /* ----------------------- Static variables ---------------------------------*/
  22. static unsigned short usRegInputStart = REG_INPUT_START;
  23. static unsigned short usRegInputBuf[REG_INPUT_NREGS]={0,0,0x5599,0x5588};

  24. /* ----------------------- coils register Defines ------------------------------------------*/
  25. #define REG_COILS_START     1000
  26. #define REG_COILS_SIZE      16

  27. /* ----------------------- Static variables ---------------------------------*/
  28. static unsigned char ucRegCoilsBuf[REG_COILS_SIZE / 8]={0xaa,0xfe};          //数量低于8个还需要验证一下,是否需要加1呢。

  29. /* ----------------------- discrete register Defines ------------------------------------------*/
  30. #define REG_DISC_START     1000
  31. #define REG_DISC_SIZE      16

  32. /* ----------------------- Static variables ---------------------------------*/
  33. static unsigned char ucRegDiscBuf[REG_DISC_SIZE / 8] = { 0x98, 0x6e };           //数量8的整数倍。


  34. void BSP_LED(void);          //LED指示线圈操作

  35. /* W5500 configuration */
  36. void W5500_Configuration()
  37. {
  38.         unsigned char array[6];

  39.         GPIO_SetBits(GPIO_W5500_RST_PORT, GPIO_W5500_RST_Pin);
  40.         Delay_ms(100);    /*delay 100ms 使用systick 1ms时基的延时*/
  41.         while((Read_1_Byte(PHYCFGR)&LINK)==0);                 /* Waiting for Ethernet Link */

  42.         Write_1_Byte(MR, RST);
  43.         Delay_ms(20);                /*delay 20ms */

  44.         /* Set Gateway IP as: 192.168.1.1 */
  45.         array[0]=192;
  46.         array[1]=168;
  47.         array[2]=1;
  48.         array[3]=1;
  49.         Write_Bytes(GAR, array, 4);

  50.         /* Set Subnet Mask as: 255.255.255.0 */
  51.         array[0]=255;
  52.         array[1]=255;
  53.         array[2]=255;
  54.         array[3]=0;
  55.         Write_Bytes(SUBR, array, 4);

  56.         /* Set MAC Address as: 0x48,0x53,0x00,0x57,0x55,0x00 */
  57.         array[0]=0x48;
  58.         array[1]=0x53;
  59.         array[2]=0x00;
  60.         array[3]=0x57;
  61.         array[4]=0x55;
  62.         array[5]=0x00;
  63.         Write_Bytes(SHAR, array, 6);

  64.         /* Set W5500 IP as: 192.168.1.128 */
  65.         array[0]=192;
  66.         array[1]=168;
  67.         array[2]=1;
  68.         array[3]=128;
  69.         Write_Bytes(SIPR, array, 4);
  70. }

  71. 芯片复制



联系方式

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

在线客服
热线电话

企业微信