单片机论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 147|回复: 1
收起左侧

FX1S1N2N学习板底层源码 PLC源码下载

[复制链接]
ocean1970920 发表于 2018-2-1 10:36 | 显示全部楼层 |阅读模式
这是FX2N PLC源码
0.png

单片机源程序如下:
  1. /******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
  2. * File Name          : main.c
  3. * Author             : MCD Application Team
  4. * Version            : V2.0.3
  5. * Date               : 09/22/2008
  6. * Description        : Main program body
  7. ********************************************************************************
  8. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  9. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
  10. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
  11. * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
  12. * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
  13. * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  14. *******************************************************************************/

  15. /* Includes ------------------------------------------------------------------*/
  16. #include <absacc.h>
  17. #include <math.h>
  18. #include "stm32f10x_lib.h"
  19. #include "stm32f10x_usart.h"
  20. #include "platform_config.h"
  21. #include "RTC_Time.h"


  22. //PC1<-->ERR
  23. //PC2<-->COMM
  24. //PC3<-->RUN

  25. //PB10<-->UART3_TX
  26. //PB11<-->UART3_RX

  27. //PA4<-->DAC_OUT1
  28. //PA5<-->DAC_OUT2

  29. //ADC1_6<-->PA6
  30. //ADC1_7<-->PA7
  31. //ADC1_8<-->PB0
  32. //ADC1_9<-->PB1

  33. #define XX00        (GPIOA->IDR &GPIO_Pin_0)//PA0
  34. #define XX01        (GPIOA->IDR &GPIO_Pin_1)//PA1
  35. #define XX02        (GPIOC->IDR &GPIO_Pin_5)//PC5
  36. #define XX03        (GPIOC->IDR &GPIO_Pin_6)//PC6
  37. #define XX04        (GPIOC->IDR &GPIO_Pin_7)//PC7
  38. #define XX05        (GPIOC->IDR &GPIO_Pin_4)//PC4
  39. #define XX06        (GPIOA->IDR &GPIO_Pin_14)//PA14
  40. #define XX07        (GPIOA->IDR &GPIO_Pin_13)//PA13
  41. #define XX10        (GPIOA->IDR &GPIO_Pin_11)//PA11
  42. #define XX11        (GPIOA->IDR &GPIO_Pin_8)//PA8
  43. #define XX12        (GPIOC->IDR &GPIO_Pin_9)//PC9
  44. #define XX13        (GPIOD->IDR &GPIO_Pin_15)//PD15
  45. #define XX14        (GPIOD->IDR &GPIO_Pin_14)//PD14
  46. #define XX15        (GPIOD->IDR &GPIO_Pin_13)//PD13
  47. #define XX16        (GPIOD->IDR &GPIO_Pin_12)//PD12
  48. #define XX17        (GPIOD->IDR &GPIO_Pin_11)//PD11
  49. #define XX20        (GPIOD->IDR &GPIO_Pin_10//PD10
  50. #define XX21        (GPIOD->IDR &GPIO_Pin_9)//PD9
  51. #define XX22        (GPIOD->IDR &GPIO_Pin_8)//PD8
  52. #define XX23        (GPIOB->IDR &GPIO_Pin_15)//PB15
  53. #define XX24        (GPIOB->IDR &GPIO_Pin_14)//PB14
  54. #define XX25        (GPIOB->IDR &GPIO_Pin_13)//PB13
  55. #define XX26        (GPIOE->IDR &GPIO_Pin_15)//PE15
  56. #define XX27        (GPIOE->IDR &GPIO_Pin_10)//PE10
  57. #define XX30        (GPIOE->IDR &GPIO_Pin_14)//PE14
  58. #define XX31        (GPIOE->IDR &GPIO_Pin_11)//PE11
  59. #define XX32        (GPIOE->IDR &GPIO_Pin_13)//PE13
  60. #define XX33        (GPIOE->IDR &GPIO_Pin_12)//PE12

  61. #define XX34        (GPIOB->IDR &GPIO_Pin_12)//PB12<-->RUN_SW
  62. #define XX35        (GPIOE->IDR &GPIO_Pin_7)//PE7<-->POWER DETECT

  63. //YY00<-->PA2
  64. //YY01<-->PC8
  65. //YY02<-->PA15
  66. //YY03<-->PC10
  67. //YY04<-->PC11
  68. //YY05<-->PC12
  69. //YY06<-->PD0
  70. //YY07<-->PD1
  71. //YY10<-->PD3
  72. //YY11<-->PD4
  73. //YY12<-->PD5
  74. //YY13<-->PD6
  75. //YY14<-->PD7
  76. //YY15<-->PB3
  77. //YY16<-->PB4
  78. //YY17<-->PB5
  79. //YY20<-->PB6
  80. //YY21<-->PB7
  81. //YY22<-->PE1
  82. //YY23<-->PE2
  83. //YY24<-->PE3
  84. //YY25<-->PE4
  85. //YY26<-->PE5
  86. //YY27<-->PE6


  87. #define YY00        {\
  88.         if (ytemp[0] == 0)\
  89.         {\
  90.         GPIOA->BSRR = GPIO_Pin_2;\
  91.         y[0] = 0;\
  92.         }\
  93.         else\
  94.         {\
  95.         GPIOA->BRR = GPIO_Pin_2;\
  96.         y[0] = 1;\
  97.         }\
  98. };
  99. #define YY01        {\
  100.         if (ytemp[1] == 0)\
  101.         {\
  102.                 GPIOC->BSRR = GPIO_Pin_8;\
  103.                 y[1] = 0;\
  104.         }\
  105.         else\
  106.         {\
  107.                 GPIOC->BRR = GPIO_Pin_8;\
  108.                 y[1] = 1;\
  109.         }\
  110. };
  111. #define YY02        {\
  112.         if (ytemp[2] == 0)\
  113.         {\
  114.                 GPIOA->BSRR = GPIO_Pin_15;\
  115.                 y[2] = 0;\
  116.         }\
  117.         else\
  118.         {\
  119.                 GPIOA->BRR = GPIO_Pin_15;\
  120.                 y[2] = 1;\
  121.         }\
  122. };

  123. #define YY03        {\
  124.         if (ytemp[3] == 0)\
  125.         {\
  126.                 GPIOC->BSRR = GPIO_Pin_10;\
  127.                 y[3] = 0;\
  128.         }\
  129.         else\
  130.         {\
  131.                 GPIOC->BRR = GPIO_Pin_10;\
  132.                 y[3] = 1;\
  133.         }\
  134. };
  135. #define YY04        {\
  136.         if (ytemp[4] == 0)\
  137.         {\
  138.                 GPIOC->BSRR = GPIO_Pin_11;\
  139. ……………………

  140. …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码

所有资料51hei提供下载:
FX1S1N2N学习板底层源码.rar.rar (2.47 MB, 下载次数: 5)
回复

使用道具 举报

anqimei 发表于 2018-2-9 07:00 | 显示全部楼层
这个有没有高速计数
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|单片机论坛

Powered by 单片机教程网

快速回复 返回顶部 返回列表