Hello,
I'm trying to write a program that communicates via modbus with a Micno VFD. I managed to put together this one:
The program has two modes of communicating sort of saying. One of them is straight forward, and the other one uses debug mode. The thing is, when in debug mode it works flawless, but when it's not in debug mode, I can't receive anything. Here is an example of the output:
Connected to /dev/ttyUSB0! Press CTRL-C to exit.
READY.
#READY.
#DEBUG
Received command: DEBUG is ON
STATUS
Received command: STATUS
DEBUG: CMD: 0x01 0x03 0x30 0x00 0x00 0x00
DEBUG: Size of the array: 6
DEBUG: CRC: CA4A
DEBUG: Sending command: 0x01 0x03 0x30 0x00 0x00 0x00 0x4a 0xca
DEBUG: Size of the array: 8
DEBUG: Command sent: 1.3.48.0.0.0.74.202.
DEBUG: Response received: 1.3.0.32.240.
DEBUG: CRC low bytes response - crc: 32 - 32
DEBUG: CRC high bytes response - crc: 240 - 240
CRC: OK.
STATUS: Received: 0x01 0x03 0x00 0x20 0xf0
DEBUG: Size of the array: 5
READY.
#DEBUG
Received command: DEBUG is OFF
STATUS
Received comm(Ue.
#STATUS
Received commCUe.
#STATUS
Received commCREADY.
#STATUS
Received commCUe.
I'm guessing it's a problem of time delays. I tried setting this line delayMicroseconds(2917); to exactly 3.5 bytes at 9600 baud which is 3437 (I think), but whatever I try to put there it doesn't receive anything. But when I enable DEBUG, marvelously it works flawless.
I'm a little bit lost here, as I don't know what else to try to fix the DEBUG off mode to work as expected.
The manual of the Micno VFD that I'm trying to communicate with is this one:
I'm also using this interface module with my Arduino Nano:
I'm not a programmer and neither an engineer, so please go easy on me :), and thanks again for any comments.
Regards,
Gabriel