<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Can bus  issue</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c4b26c9603/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c4b26c9603/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/c4b26c9603/</id><updated>2020-02-27T14:22:16.212000Z</updated><subtitle>Recent posts to Can bus  issue</subtitle><entry><title>Can bus  issue</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c4b26c9603/?limit=25#b203" rel="alternate"/><published>2020-02-27T14:22:16.212000Z</published><updated>2020-02-27T14:22:16.212000Z</updated><author><name>KMor77</name><uri>https://forge.codesys.com/u/kmor77/</uri></author><id>https://forge.codesys.comcc2a1a39836e8e43579f5c4412e781c69f576e50</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I have the CANopen manager set to "Enable Sync Producing" with a cycle period of 50 ms. Looks like I'm going to have to figure out how to go to a lower level to read the PDOs and/or find a diagnostic tool for the bus.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can bus  issue</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c4b26c9603/?limit=25#0f9c" rel="alternate"/><published>2020-02-27T14:22:15.024000Z</published><updated>2020-02-27T14:22:15.024000Z</updated><author><name>hence.persson</name><uri>https://forge.codesys.com/u/hence-persson/</uri></author><id>https://forge.codesys.comf8fa0d90cb20493508c50befcdaceb7085ded47d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Maybe the IO needs a sync signal to update the IOs and the CanOpen Master is not configured to send the sync telegram?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can bus  issue</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c4b26c9603/?limit=25#e297" rel="alternate"/><published>2020-02-27T14:22:14.612000Z</published><updated>2020-02-27T14:22:14.612000Z</updated><author><name>KMor77</name><uri>https://forge.codesys.com/u/kmor77/</uri></author><id>https://forge.codesys.com16109d9dff2a91e039d02ca680d3f3cc499be343</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks - Yes I have all of that set up already so I thought the Main task would cycle every Interval Time (100ms in this case) - There's something subtle I'm missing but I won't get back to try anything until this afternoon.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can bus  issue</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c4b26c9603/?limit=25#2717" rel="alternate"/><published>2020-02-27T14:22:14.203000Z</published><updated>2020-02-27T14:22:14.203000Z</updated><author><name>alwoso</name><uri>https://forge.codesys.com/u/alwoso/</uri></author><id>https://forge.codesys.com70b24127b792873c272cc9906f213b32033dd2e4</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Okay, that might be the problem!&lt;/p&gt;
&lt;p&gt;In your project, you should see a "Task configuration". Double click the Task below that and you should get a window like this:&lt;/p&gt;
&lt;p&gt;If the MAIN is not in the task, add it with drag and drop or by clicking "Add Call".&lt;br/&gt;
If you don't see a Task configuration below the application, you need to add one by right-clicking on Application and select "add object" and then "Task configuration".&lt;/p&gt;
&lt;p&gt;Codesys is a task-based system. If you want your MAIN program to be called cyclical, you have to place it in a cyclic task. That's different to a PLC like Siemens, where you have an OB1, that is called by the system all the time.&lt;/p&gt;
&lt;p&gt;Hope that helps... Good luck!&lt;/p&gt;
&lt;p&gt;Alfred&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: bild4.png" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4479"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: bild5.png" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4480"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can bus  issue</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c4b26c9603/?limit=25#9208" rel="alternate"/><published>2020-02-27T14:22:12.948000Z</published><updated>2020-02-27T14:22:12.948000Z</updated><author><name>KMor77</name><uri>https://forge.codesys.com/u/kmor77/</uri></author><id>https://forge.codesys.com531e66ae504c3603fd5f5188ac7a794dd1798dcb</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks Alfred,&lt;/p&gt;
&lt;p&gt;I'll try that today and let you know what happens.&lt;/p&gt;
&lt;p&gt;When you ask if the code is called cyclical that raises a question - My code is the main program and not called from anywhere. I thought the PLC just loops through the code Continuously.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can bus  issue</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c4b26c9603/?limit=25#45a5" rel="alternate"/><published>2020-02-27T14:22:12.450000Z</published><updated>2020-02-27T14:22:12.450000Z</updated><author><name>alwoso</name><uri>https://forge.codesys.com/u/alwoso/</uri></author><id>https://forge.codesys.com6034e049cf1f1f978fa672acdbd6cb9fdcbbb2bc</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;That's strange   &lt;/p&gt;
&lt;p&gt;If you look in online status on the devices CANOpen I/O mapping, what happens with the Input Switch_input_1 when switching ON and OFF?&lt;/p&gt;
&lt;p&gt;If nothing happens, try to remove your mapping variable and look if the status then is refreshed correctly...&lt;/p&gt;
&lt;p&gt;Another stupid question: The code is called cyclical, not blocked by any condition?&lt;/p&gt;
&lt;p&gt;Good luck&lt;/p&gt;
&lt;p&gt;Alfred&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: bild2.png" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4472"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: bild3.png" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4473"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can bus  issue</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c4b26c9603/?limit=25#8729" rel="alternate"/><published>2020-02-27T14:22:12.039000Z</published><updated>2020-02-27T14:22:12.039000Z</updated><author><name>KMor77</name><uri>https://forge.codesys.com/u/kmor77/</uri></author><id>https://forge.codesys.com5d69b2465e1f8d7668e5b53c19b4ebaf3ac24e55</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks for the response, &lt;/p&gt;
&lt;p&gt;I've tried using Main Task and Parent bus cycle setting but neither worked.&lt;/p&gt;
&lt;p&gt;The value is refreshed only once at the start of the program only.&lt;/p&gt;
&lt;p&gt;I was under the impression that the bus continuously cycles and updates the I/O values according to the cycle period set in the manager.&lt;/p&gt;
&lt;p&gt;Could it be a debugger problem?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can bus  issue</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c4b26c9603/?limit=25#fd37" rel="alternate"/><published>2020-02-27T14:22:10.832000Z</published><updated>2020-02-27T14:22:10.832000Z</updated><author><name>alwoso</name><uri>https://forge.codesys.com/u/alwoso/</uri></author><id>https://forge.codesys.com71c045e64ba08171bb8cf91d39a2ff8c26d88402</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi KMor77,&lt;/p&gt;
&lt;p&gt;in your code you have the IF-clause&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Zitat:&lt;/strong&gt;&lt;br/&gt;
IF Switch_on = TRUE AND Switch_on_L = FALSE THEN&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;As the variables are defined as BOOL, you can say&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;IF&lt;/span&gt; &lt;span class="nv"&gt;Switch_on&lt;/span&gt; &lt;span class="nv"&gt;AND&lt;/span&gt; &lt;span class="nv"&gt;NOT&lt;/span&gt; &lt;span class="nv"&gt;Switch_on_L&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;this will work too. But in general, your code looks ok. As dFx mentioned, the question is if your hardware comes in correctly. How is Switch_Input_1 refreshed on the bus? In the device-manager, on the Can-device Tab I/O Mapping you find a field "BusCycleOptions". Try here to select the task in which your program code is running.&lt;/p&gt;
&lt;p&gt;Good luck&lt;br/&gt;
Alfred&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: bild1.png" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4468"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can bus  issue</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c4b26c9603/?limit=25#c1df" rel="alternate"/><published>2020-02-27T14:22:10.426000Z</published><updated>2020-02-27T14:22:10.426000Z</updated><author><name>dFx</name><uri>https://forge.codesys.com/u/dfx/</uri></author><id>https://forge.codesys.come9f46777575c51c64ef44de189f593723d90ed8e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Is your IO value (Switch_Input1) refreshed correctly ?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can bus  issue</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c4b26c9603/?limit=25#e753" rel="alternate"/><published>2020-02-27T14:22:10.015000Z</published><updated>2020-02-27T14:22:10.015000Z</updated><author><name>KMor77</name><uri>https://forge.codesys.com/u/kmor77/</uri></author><id>https://forge.codesys.com8090e9011177e1bdaa64a173bed2d28611ee6157</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I just started programming with CodeSys. Setup is an Exor etop513 and a Seneca ZC-24DI digital input module. I copied all can settings from a project that I know is reading the bus ok. I have a switch setup into input 9 where I want to latch the off - on transition. The switch is mapped into the PDO as Switch_Input1.&lt;/p&gt;
&lt;p&gt;Here's the program:&lt;/p&gt;
&lt;p&gt;PROGRAM Main&lt;br/&gt;
VAR&lt;br/&gt;
    Enable_view: BOOL := FALSE;&lt;br/&gt;
    Switch_on: BOOL := FALSE;&lt;br/&gt;
    Switch_Count: INT := 0;&lt;br/&gt;
    Switch_on_L: BOOL := 0;&lt;br/&gt;
END_VAR&lt;/p&gt;
&lt;p&gt;Switch_on := Switch_Input1;&lt;br/&gt;
    IF Switch_on = TRUE AND Switch_on_L = FALSE THEN&lt;br/&gt;
        Switch_Count := Switch_Count + 1;&lt;br/&gt;
    END_IF&lt;br/&gt;
Switch_on_L := Switch_on;&lt;/p&gt;
&lt;p&gt;In Debug mode the switch is read correctly only once and then never changes. If I do a "Reset Warm" then the switch will be read correctly once again.&lt;/p&gt;
&lt;p&gt;Any help would be greatly appreciated!&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>