Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Accessing Sv or ATv in a Plc thread kills it...?

Accessing Sv or ATv in a Plc thread kills it...? 3 years 10 months ago #10695

  • Bruce@Spang
  • Bruce@Spang's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 41
  • Karma: 0
I've been trying to get around an issue in Plc DataArithm blocks with strings or time values -
although accessing integer and floating point arrays (IArray500,AArray500, etc) works fine - like this:

File Attachment:

File Name: works.c
File Size: 0 KB


Trying the same sort of access to an Sv's ActualValue halts the Plc thread (even just a read access), for example:

File Attachment:

File Name: examples.c
File Size: 0 KB


The same result occurs for any access to a ATv ActualValue, read or write

Note that locally declared pwr_tTime and pwr_tString[80] storage causes no issues. But can't be used in an object...

Any clues for me, folks? What am I missing??
The administrator has disabled public write access.

Accessing Sv or ATv in a Plc thread kills it...? 3 years 10 months ago #10696

  • brunad
  • brunad's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 247
  • Thank you received: 48
  • Karma: 11
Hi Bruce,

It's obvious, but maybe add include <string.h>

Otherwise, try CArithm

/Bruno
Last Edit: 3 years 10 months ago by brunad.
The administrator has disabled public write access.
The following user(s) said Thank You: Bruce@Spang

Accessing Sv or ATv in a Plc thread kills it...? 3 years 10 months ago #10697

  • Bruce@Spang
  • Bruce@Spang's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 41
  • Karma: 0
#include <string.h> didn't change things at all - and I've tried as a test just to access a single character in a string (Sv object source).

Even simplifying down to

classdef Da2 Sv;
char *s;
s = Da2->ActualValue ;
OI1 = s[0];

...causes the Plc thread to halt. I'm guessing it's a segmentation fault issue. Is there any way in ProviewR to see what caused a Plc thread to crash??
The administrator has disabled public write access.

Accessing Sv or ATv in a Plc thread kills it...? 3 years 10 months ago #10698

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3179
  • Thank you received: 502
  • Karma: 133
Hi Bruce,

Read this

/Claes
The administrator has disabled public write access.
The following user(s) said Thank You: Bruce@Spang

Accessing Sv or ATv in a Plc thread kills it...? 3 years 10 months ago #10699

  • Bruce@Spang
  • Bruce@Spang's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 41
  • Karma: 0
:) That's the key! Thanks! All works now...
The administrator has disabled public write access.

Accessing Sv or ATv in a Plc thread kills it...? 3 years 10 months ago #10700

  • Bruce@Spang
  • Bruce@Spang's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 41
  • Karma: 0
I see that an SArray[100] does NOT use gdh_TranslateRtdbPointer() - is there some general way to tell what items need translation and what don't??

I suppose if one way crashes, do it the other way... ;)
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 7.869 seconds