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 Sat Sep 21, 2019 6:14 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Mon Jun 24, 2019 8:10 pm 
Offline

Joined: Mon Nov 20, 2017 7:40 pm
Posts: 16
Hello.

Does anyone have any examples how to use devices from this library?
Especially how to use 24C512?


Top
   
PostPosted: Sat Jun 29, 2019 8:45 am 
Offline

Joined: Wed Nov 23, 2016 2:33 pm
Posts: 72
Hi Pawel,

sure I know this… :D

The eeprom works assyncron call it like this:

Code:
   IF SysSem.SysSemEnter(hSem:=PARAM_DATA.DATA_EEPROM.SEMAPHORE) = SysSem.Errors.ERR_OK THEN
      IF PARAM_DATA.DATA_EEPROM.FB_NO_IN = 0 THEN
         PARAM_DATA.DATA_EEPROM.FB_NO_IN := PARAMETER_NO;
         PARAM_DATA.DATA_EEPROM.WRITE_VALUE := TRUE;
         PARAM_DATA.DATA_EEPROM.VALUE_IN.LWORD_T := PARAM.LWORD_T;
         PARAM_DATA.DATA_EEPROM.ADDRESS_VALUE := GET_PAGE_ADRESS_EEPROM(DATA:= PARAM_DATA);
      END_IF   
   END_IF
   SysSem.SysSemLeave(hSem:=PARAM_DATA.DATA_EEPROM.SEMAPHORE);


try to use the device as no multiplex in device config.

Code:
PARAM_DATA.DATA_EEPROM.FB_NO_IN = 0 THEN
shows that the EEPROM is read to recive new command.

FB_NO_IN can be any UNIQUE number on your PLC this number shows the write or reciving FB that data for this FB is avalible. I create thos Nums by call
Quote:
DB_IN_OUT^.FB_NO_AUTO := DB_IN_OUT^.FB_NO_AUTO + 1;


in each FB
and reset them in on FB like:
Code:
DB_IN_OUT.FB_NO_AUTO := 0;//reset FB number


Code:
IF DATA_EEPROM.FB_NO_OUT = PARAMETER_NO THEN
   //got my request back


shows that data from eeprom is avalible.

then you can receive the data like this:

Code:
IF DATA_EEPROM.FB_NO_OUT = PARAMETER_NO THEN
   //got my request back   

   //get value
   VALUE_FROM_EEPROM.LWORD_T := DATA_EEPROM.VALUE_OUT.LWORD_T;

   
   DATA_EEPROM.FB_NO_OUT := 0;//delete response
   LOAD_VALUE_FROM_EEPROM := FALSE;//delete request

END_IF



I think I have to make a god example too.

BR Stefan


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 7 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