资源简介
Read Input Register (0x04)
Read Holding Registers (0x03)
Write Single Register (0x06)
Write Multiple Registers (0x10)
Read/Write Multiple Registers (0x17)
Read Coils (0x01)
Write Single Coil (0x05)
Write Multiple Coils (0x0F)
Read Discrete Inputs (0x02)
Report Slave ID (0x11)
代码片段和文件信息
/*
* FreeModbus Libary: ARM7 Demo Application
* Copyright (C) 2006 Christian Walter
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not write to the Free Software
* Foundation Inc. 51 Franklin St Fifth Floor Boston MA 02110-1301 USA
*
* File: $Id$
*/
/* ----------------------- System includes ----------------------------------*/
#include “assert.h“
/* ----------------------- Platform includes --------------------------------*/
#include “support/AT91SAM7X256.h“
#include “support/lib_AT91SAM7X256.h“
#include “FreeRTOS.h“
#include “task.h“
#include “queue.h“
/* ----------------------- Modbus includes ----------------------------------*/
#include “mb.h“
/* ----------------------- Defines ------------------------------------------*/
#define REG_HOLDING_START 0x1000
#define REG_HOLDING_NREGS 130
#define REG_INPUT_START 0x1000
#define REG_INPUT_NREGS 4
/* ----------------------- Static variables ---------------------------------*/
static USHORT usRegHoldingStart = REG_HOLDING_START;
static USHORT usRegHoldingBuf[REG_HOLDING_NREGS];
static USHORT usRegInputStart = REG_INPUT_START;
static USHORT usRegInputBuf[REG_INPUT_NREGS];
/* ----------------------- Static functions ---------------------------------*/
STATIC void vModbusTask( void *pvParameters );
STATIC void vSetupHardware( void );
/* ----------------------- Start implementation -----------------------------*/
int
main( void )
{
vSetupHardware( );
( void )xTaskCreate( vModbusTask NULL configMINIMAL_STACK_SIZE NULL
tskIDLE_PRIORITY NULL );
vTaskStartScheduler( );
return 0;
}
static void
vModbusTask( void *pvParameters )
{
int i;
/* Select either ASCII or RTU Mode. */
( void )eMBInit( MB_RTU 0x0A 0 38400 MB_PAR_EVEN );
/* Initialize the holding register values before starting the
* Modbus stack
*/
for( i = 0; i < REG_HOLDING_NREGS; i++ )
{
usRegHoldingBuf[i] = ( unsigned short )i;
}
/* Initialize the input register values before starting the
* Modbus stack
*/
for( i = 0; i < REG_INPUT_NREGS; i++ )
{
usRegInputBuf[i] = ( unsigned short )i;
}
/* Enable the Modbus Protocol Stack. */
( void )eMBEnable( );
for( ;; )
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-03-10 15:31 freemodbus-v1.6\
文件 1436 2018-09-14 04:03 freemodbus-v1.6\bsd.txt
文件 14628 2018-09-14 04:03 freemodbus-v1.6\Changelog.txt
目录 0 2019-03-10 15:30 freemodbus-v1.6\demo\
目录 0 2019-03-10 15:30 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\
文件 5634 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\demo.c
文件 8756 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\demo.hzp
文件 12695 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\demo.hzs
目录 0 2019-03-10 15:30 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\
文件 13219 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\croutine.c
目录 0 2019-03-10 15:30 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\include\
文件 26826 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\include\croutine.h
文件 4984 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\include\FreeRTOS.h
文件 11470 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\include\list.h
文件 2988 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\include\portable.h
文件 2979 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\include\portable.h.bak
文件 2209 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\include\projdefs.h
文件 16551 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\include\queue.h
文件 10062 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\include\semphr.h
文件 31687 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\include\task.h
文件 7614 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\list.c
目录 0 2019-03-10 15:30 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\portable\
目录 0 2019-03-10 15:30 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\portable\GCC\
目录 0 2019-03-10 15:30 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\portable\GCC\ARM7_AT91SAM7S\
文件 7975 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\portable\GCC\ARM7_AT91SAM7S\port.c
文件 8771 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\portable\GCC\ARM7_AT91SAM7S\portISR.c
文件 13238 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\portable\GCC\ARM7_AT91SAM7S\portmacro.h
目录 0 2019-03-10 15:30 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\portable\MemMang\
文件 4589 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\portable\MemMang\heap_1.c
文件 9068 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\portable\MemMang\heap_2.c
文件 2547 2018-09-14 04:03 freemodbus-v1.6\demo\AT91SAM7X_ROWLEY\FreeRTOS\portable\MemMang\heap_3.c
............此处省略1301个文件信息
相关资源
- 基于STM32F103的modbus从机keil实际可用工
- COMPUTATIONAL COMPLEXITY A Modern Approach
- 2019 Multilevel Modeling using R.pdf
- outlook duplicate items remover
- 4450844imooc-security-study.rar
- 串口通信Demo
- ZBar二维码扫描Demo
- 汉王ESP370U驱动及DEMO
- modbus poll 9.4.0 & modbus slave7.3.0.rar
- Routing Flow and Capacity Design in Communicat
- 横向ListView的完整实现 包含基于横向
- 基于OpenCV的二维码检测识别基础demo
- Probability and Statistics Morris H. Degroot第四
- openssl1.1.1RSA、ECC、SM2身份认证Demo及文
- 基于ROS的机械臂运动控制
- 使用PSpice Model Editor建模
- 可以插入视频、音乐的.htaDEMO用来哄女
- 神经形态认知计算 Neuromorphic Cognitiv
- (25)PandaRunDemo(熊猫快跑).zip
- STM32+RC522--demo.rar
- Thermo-calc中文版说明书
- modbus-主机-msp430F5移植源码与调试工具
- modern coding theory
- Dejavu Sans Mono系列字体包编程专用
- 基于科大讯飞语音识别demo离线
- 数据分析+精益创业。Lean Analytics Use
- KCFdemo实现目标选取,跟踪
- QuartusII12.0安装与使用指南
- 基于Quartus的简单逻辑cpu
- nodejs+mongoose简单关联+增删改查
评论
共有 条评论