four load cell with hx711

I’m writing a program to read 4 cell and send the output to a plc. The problem is that when I try to read 1 or 2 cell it works but when I try to use more arduino seems to crash (I can’t print anything with Serial.print() even in the setup). I’m using a Mega and I controlled how much SRAM is available when using 2 cell and is more than 7000 and it never change much.

here is the code for RAM usage

int freeRam () 
  extern int __heap_start, *__brkval; 
  int v; 
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); 

The sketch attached works with this but if i remove the last two commented lines and set nc=4 it stops working.

HX711 celle[nc]={

cella_carico_1.0.ino (3.87 KB)