libfins icon indicating copy to clipboard operation
libfins copied to clipboard

I need example code to write data to DM and EM.

Open greenbaypayment opened this issue 4 years ago • 1 comments

I know if we are going to write data to CIO register, must describe like finslib_memory_area_write_uint16(sys, "CIO100.0", addr, num) . But if we are going to write data to DM or EM, how can we describe memory name ? "D0.0" or "E0.0" -> Such describe was occurred error by me. If you would provide example code, I will be happy. Look forward to hear from you soon Thanks

greenbaypayment avatar Oct 05 '20 09:10 greenbaypayment

You can't write a single bit with the finslib_memory_area_write_uint16() function, only full words. D0.0 and E0.0 represent single bits.

The encoding of an address to the binary representation of a memory area in the FINS message is done through the fins_area[] array in the file src/fins_search.c. You can check this file to see which memory area prefixes are recognized for the different PLC modes.

lammertb avatar Oct 05 '20 10:10 lammertb