save error on l25
This commit is contained in:
@@ -1,25 +1,28 @@
|
|||||||
#include "modbus-tcp.h"
|
#include "modbus-tcp.h"
|
||||||
|
|
||||||
#include <tcp.h>
|
#include <tcp.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
char tcp_buffer[1024];
|
char tcp_buffer[1024];
|
||||||
|
|
||||||
#define MAX_REG 25
|
#define MAX_REG 100
|
||||||
|
|
||||||
uint16_t registers[MAX_REG];
|
uint16_t registers[MAX_REG];
|
||||||
|
|
||||||
static err_t modbus_incomming_data(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err){
|
static err_t modbus_incomming_data(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err){
|
||||||
u16_t len;
|
int i;
|
||||||
|
int len;
|
||||||
|
char pc;
|
||||||
|
|
||||||
if (p != NULL){
|
if (p != NULL){
|
||||||
printf("data not null\n");
|
printf("data not null\n");
|
||||||
//here im going to procces the modbusdata
|
//here im going to procces the modbusdata
|
||||||
len = p->tot_len;
|
tcp_recved( pcb, p->tot_len );
|
||||||
|
pc = (char)p->payload;
|
||||||
|
len =p->tot_len;
|
||||||
|
|
||||||
//putting the bufer in the register array
|
//putting the bufer in the register array
|
||||||
for(int i=0; i<len; i++ ) {
|
for( i=0; i<len; i++ ) {
|
||||||
registers[i] = p->payload[i];//getting the error "void value not ignored as it ought to be" on this line
|
registers[i] = pc[i];//getting the error "void value not ignored as it ought to be" on this line
|
||||||
}
|
}
|
||||||
|
|
||||||
if(registers[7] == 0x10){// Check if it's a Modbus Write Multiple Registers request (0x10)
|
if(registers[7] == 0x10){// Check if it's a Modbus Write Multiple Registers request (0x10)
|
||||||
|
|||||||
Reference in New Issue
Block a user