Skip to content

STRING writing problems on PLC #424

@nikyred1978

Description

@nikyred1978

I have a problem,
I have to write this string:('001;+293.50;+58.00;+150.00;+000.01;+003.14;+000.01;08;080;01;') on a DB32 in offset 0 format STRING[65], but when I run the code it transfers me this string:('1;+293.50;+58.00;+150.00;+000.01;+003.14;+000.01;' ), then it removes the first 2 zeros and also removes the last part of the string .

This is code, below:

`import snap7
from snap7.util import *
import time

plc = snap7.client.Client()

try:
plc.connect('128.0.0.1', 0, 1)
except snap7.snap7exceptions.Snap7Exception as e:
print("Error PLC:", e)
exit()

data_str = '001;+293.50;+58.00;+150.00;+000.01;+003.14;+000.01;08;080;01;'

try:
plc.db_write(34, 0, data_str)
except snap7.snap7exceptions.Snap7Exception as e:
print('Error DB32:', e)

plc.disconnect()

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions