资源简介
通过modbus控制A6伺服,A6伺服的modbus手册里面有一处错误,该案例已经更改。
代码片段和文件信息
#include “led.h“
#include “delay.h“
#include “sys.h“
#include “lcd.h“
#include “encode.h“
extern uint8_t USART1_RX_BUF[64];
extern uint8_t USART1_RX_CNT;
//extern uint8_t flagframe = 0;
uint8_t USART_RX_STA = 0;
uint8_t USART_RX_BUF[64];
uint16_t handHeldCtrCnt = 0;
//bit0:sendDataFlag 0x00 bit1~bit4:gage1 displacement data bit5~bit8: gage2 strain data bit9 bit10: adc data(pressure data)bit11:0x0Abit12:0x0D
uint8_t HHdata[13];
uint16_t count;
uint16_t GAGECnt = 0;
uint16_t GAGECnt_meta = 0;
uint8_t SRV_ON[8] = {0x01 0x05 0x00 0x60 0xFF 0x00 0x8C 0x24};
uint8_t SRV_OFF[8] = {0x01 0x05 0x00 0x60 0x00 0x00 0xCD 0xD4};
uint8_t Block_velocity0[8] = {0x01 0x06 0x46 0x00 0x04 0x00 0x9E 0x42};
uint8_t Block_accelaration0[8] = {0x01 0x06 0x46 0x10 0x01 0x00 0x9C 0xD7 };
uint8_t Block_decelaration0[8] = {0x01 0x06 0x46 0x20 0x01 0x00 0x9C 0xD8 };
uint8_t Block0_CMD[13] = {0x01 0x10 0x48 0x00 0x00 0x02 0x04 0x00 0x00 0x03 0x00 0xA5 0xE8};
uint8_t Block0_data[13] = {0x01 0x10 0x48 0x02 0x00 0x02 0x04 0x00 0x00 0x00 0x00 0x24 0x75};
uint8_t S_STOP_ON[8] = {0x01 0x05 0x01 0x24 0xFF 0x00 0xCD 0xCD};
uint8_t S_STOP_OFF[8] = {0x01 0x05 0x01 0x24 0x00 0x00 0x8C 0x3D};
uint8_t Block_NO[8] = {0x01 0x06 0x44 0x14 0x00 0x00 0xDD 0x3E };
uint8_t Block_Start[8] = {0x01 0x05 0x01 0x20 0xFF 0x00 0x8C 0x0C};
uint8_t Block_OFF[8] = {0x01 0x05 0x01 0x20 0x00 0x00 0xCD 0xFC};
uint8_t Block1_cmd_data[17] = {0x01 0x10 0x48 0x08 0x00 0x04 0x08 0x00 0x00 0x03 0x00 0x00 0x00 0x00 0x00 0xB6 0x1E};
uint8_t Block0_cmd_data[17] = {0x01 0x10 0x48 0x00 0x00 0x04 0x08 0x00 0x00 0x03 0x00 0x00 0x00 0x00 0x00 0x57 0xC1};
uint8_t Block0_cmd_data_R[17] = {0x01 0x10 0x48 0x00 0x00 0x04 0x08 0x04 0x00 0x03 0x00 0x00 0x00 0x00 0x00 0x56 0x32};
int main(void)
{
uint16_t adcx;
uint8_t cmd_buf[4] = {0x030x000x030x00};
uint8_t cmd_data[4] = {0x000x000x000x00};
uint8_t cmd_count_cmd[4] = {0x030x000x070x00};
uint8_t cmd_count_data[4] = {0x270x100x000x00};
uint8_t condition_cmd[4] = {0x000x330x0A0x60};
uint8_t condition_data[4] = {0x270x100x000x00};
uint8_t decelaration_cmd[4] = {0x000x000x050x00};
uint8_t decelaration_data[4] = {0x000x000x000x00};
delay_init(); //延时函数初始化
USART3_Initialise(115200);
USART1_Initialise(9600);
RS485_switchinit();
Adc_Init();
TIM_Init();//定时器编码器接口初始化
// UART_PutStrRS485(SRV_ON8);
// UART_PutStrRS485(Block_NO8);
MODH_Send06H(SLAVE_ADDRREG_Block_NO 0);
delay_ms(10);
//UART_PutStrRS485(Block_velocity08);
MODH_Send06H(SLAVE_ADDRREG_Block_velocity0 0x0400);
delay_ms(10);
//UART_PutStrRS485(Block_accelaration08);
MODH_Send06H(SLAVE_ADDRREG_
相关资源
- 整理的ModbusProtocol SDK开发包
- delphi编写的modbus测试源码
- modbus通讯,用DELPHI编写
- FreeModbus_Slave+STM32F407+USART2代码亲测可
- SA68D21DL全双工无线数传报警模块及其
- 人民电器电表modbus rtu通信协议解析
- f325d3e33b7d07dc41239c923d3feba6.rar
- ModBus-RTU协议C封装
- 51单片机编写的标准modbus协议通信模版
- STM32F103移植FreeModbus实现modbus主机.zi
- 台达PLC44个程序
- Modbus—TCP协议
- 致远OA破解版 A6企业版破解授权不替换
- 单片机modbus例程解析
- RS485串口调试工具
- 06-GA6-B_AT指令集_V3.0.3.pdf
- a87367f4a675f35a12528fbaf99f3130.zip
- GA6 gprs模块 51单片机 程序
- vega56 超频配置文件
- MODBUS--ASCii实现的主要代码
- QJ71MT91.pdf
- modbus模拟器.rar
- stm32 modbus 协议程序
- 5naca63418yijie40000.casfluent二维翼型仿真
- 完整的STM32F407_MODBUS通信工程代码。
- MSP430F5529移植modbus
- 台达A2伺服MODBUS通讯调试工具
- stm32实现modbus主机从机功能通信
- 安卓组态软件MODBUS.rar
- 总结——调试STM32F103ZET6外围传感器
评论
共有 条评论