save error on l25

This commit is contained in:
Obe Van Lierde
2023-11-07 19:34:24 +01:00
parent 87117ad602
commit 5daa53ee6a

View File

@@ -1,25 +1,28 @@
#include "modbus-tcp.h"
#include <tcp.h>
#include <string.h>
char tcp_buffer[1024];
#define MAX_REG 25
#define MAX_REG 100
uint16_t registers[MAX_REG];
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){
printf("data not null\n");
//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
for(int 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
for( i=0; i<len; i++ ) {
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)