CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Mon Nov 18, 2019 4:53 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Mar 08, 2019 4:49 pm 
Offline

Joined: Thu Mar 07, 2019 5:28 pm
Posts: 2
CoDeSys v2.3 on an IFM CR0403 basic controller

Still very new to codesys so bear with me. I'm trying to assign an initial value to an array of bytes. I've tried a few things but i'm clearly missing something. Ultimately, i want to bring in the 8 byte data field of a CAN message and apply a bit mask with a second array to isolate the information i'm looking for. Whenever I try to assign the initial value of the array i get an error upon building that says "Erroneous initial value". I've tried typing out the individual bits, assigning in hex values using 16#FF, and just the decimal translation of the binary or hex value i need. Nothing works.

Help please!
Pat


VAR
RX65265: ARRAY [1..8] OF BYTE := [8 (11111111)];
MASK: ARRAY [1..8] OF BYTE;
PBHEX: ARRAY [1..8] OF BYTE;
END_VAR
____________________________________________________

(* RX65265 := [16#D6, 16#5F, 6 (16#FF)]; *)
(* MASK := [16#0C, 7 (16#FF)]; *)

PBHEX := RX65265 AND MASK


Top
   
PostPosted: Fri Mar 08, 2019 7:38 pm 
Offline
Frequent User
Frequent User

Joined: Tue Dec 03, 2013 11:52 pm
Posts: 122
Have you tried:
Code:
    RX65265: ARRAY [1..8] OF BYTE := [8(2#11111111)];

*Not sure how the space is handled between the "8 (" so I removed it.*

Ultimately this should work also:
Code:
    RX65265: ARRAY [1..8] OF BYTE := [16#D6, 16#5F, 6 (16#FF)];


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 2 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited