CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Thu Oct 19, 2017 9:01 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Jan 10, 2017 8:47 am 
Offline

Joined: Thu Nov 17, 2016 8:21 am
Posts: 9
Hi all,

I'm using the Wago 750-880 with the 750-650 to communicate over RS232. I'm using the serial_interface_01.lib (http://www.wago.com/wagoweb/documentati ... 10901e.htm). With this library I am able to receive data, but not sending data. This is the code I have so far:

Code:
VAR
   COM2       : SERIAL_INTERFACE;
   xOpenPort2   : BOOL := TRUE;
   xInitPort2      : BOOL;
   xSendActive2   : BOOL;
   SendString2   : STRING := 'Msg from COM2';
   ReceiveBuffer2   : typRing_Buffer;
   index : INT;
END_VAR


Code:
index := index+1;
IF index = 1000 THEN
   xSendActive2 := TRUE;
END_IF
IF index = 2000 THEN
   xSendActive2 := FALSE;
   index := 0;
END_IF


COM2(   bCOM_PORT_NR   := 2,
   (*   cbBAUDRATE      := wBaudRate,
      cbsBYTESIZE      := bDataBits,
      cpPARITY         := bParity,
      csSTOPBITS      := STOPBITS_1,
      cfFLOW_CONTROL   := bFlowControl,*)
      utRECEIVE_BUFFER    := ReceiveBuffer2,
      ptSEND_BUFFER   := ADR(SendString2),
      xINIT         := xInitPort2,
           xOPEN_COM_PORT    := xOpenPort2,
      iBYTES_TO_SEND   := LEN(SendString2) +1,
      xSTART_SEND      := xSendActive2 );


Data should be sent when xSTART_SEND is TRUE? The function block does not reset this value to FALSE.


Top
   
PostPosted: Wed Jan 11, 2017 11:50 am 
Offline

Joined: Thu Nov 17, 2016 8:21 am
Posts: 9
Apparently, the module has flow control enabled.... So it works now.


Top
   
PostPosted: Thu Jan 12, 2017 12:46 pm 
Offline
Frequent User
Frequent User

Joined: Thu Jun 14, 2007 9:49 am
Posts: 978
if this counter is used as a type of counter then better use a task, you can time it.
and check if buffer empty before putting data in to buffer.

_________________
shooter@home.nl
computer shooter
paul deelen
jacob van wassenaerstraat 29
NL 5224 GG 's-Hertogenbosch
skype shooter paul.deelen
phone +31736139136


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

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 1 guest


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