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 Sun Jun 16, 2019 7:36 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 12 posts ] 
Author Message
PostPosted: Mon Aug 04, 2014 3:59 pm 
Offline

Joined: Thu Jul 31, 2014 7:05 pm
Posts: 18
Hello, I'm working on a project where I need 16 GPIO pins on the PI. (I'm new to CoDeSys and PLCs in general, but have good programming background and understanding of the PI.) I don't understand how to map and configure the pins under CodeSys 3.5. I'm looking at the GPIO example application and there are only 12 configurable pins in the GPIOs Configuration Tab. How do I add other pins to configure as inputs or outputs?

Next, how do these GPIO pin configurations in the GPIOs Configuration Tab map to the Channel bit under the GPIOs I/O Mapping tab? And, how do the channels/addresses map to the HMI elements?

For example I was able to assign Bit18 to variable gxOut, which I guessed somehow aligned with variable GPIOs_Instance._GPIO.axInputs[18] as defined in the HMI example. Sure enough, the light blinks when I run the simulation. It would seem there would be a link between the channel or the address to the HMI element. But, I don't understand.

Is there reference material that I missed reading? Thanks for your help.


Top
   
PostPosted: Tue Aug 05, 2014 6:01 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 3306
Hi,

we will extend the GPIO's to B+ model on next version.

you could map variables to the IO's in the mapping tap or use the instance of the IOdriver

GPIOs_Instance ist the instance of the GPIO Iodriver (which is implicite called by the system)
GPIOs_Instance._GPIO.axOutputs
GPIOs_Instance._GPIO.axInputs

You could access the mapped variables in the visualization on different ways:

This example from store use the instance, this is more because it seems the one who did the example was a kind if lazy to map the
variables, therefore he get them from the IOdriver instance.
You could also map your variable like in screenshot GPIOMappin2.jpg and access it that way.

BR
Edwin


You do not have the required permissions to view the files attached to this post.


Last edited by Edwin Schwellinger on Wed Aug 06, 2014 7:47 am, edited 3 times in total.

Top
   
PostPosted: Wed Aug 06, 2014 7:32 am 
Offline
Frequent User
Frequent User
User avatar

Joined: Fri Mar 18, 2011 4:12 pm
Posts: 266
Hi,

See also here for a mapping of GPIO numbers to the physical pins on the board:

http://www.raspberrypi-spy.co.uk/2014/0 ... nd-pinout/

http://www.raspberrypi-spy.co.uk/2012/0 ... evision-2/

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


Top
   
PostPosted: Wed Aug 06, 2014 12:44 pm 
Offline

Joined: Thu Jul 31, 2014 7:05 pm
Posts: 18
Thanks for the information. I think I understand the mappings. Thanks for the reference diagram, too.

As for the number of GPIO, the GPIO example only has 12 pins defined in the configuration tab, but the B version of the PI has 21 possible GPIOs. Some of the pins can do multiple things like SPI, serial, etc, but I would like to use 16 pins for GPIO. The B+ verson of the PI extends connector P1, as you can see in the reference you provideded. In my example, I'm working with the B version of the PI.

In the GPIO Tab the following pins are defined, with the corresponding physical pinout from the reference you provideded:

GPIO4 P1-7
GPIO17 P1-11
GPIO18 P1-12
GPIO22 P1-15
GPIO23 P1-16
GPIO24 P1-18
GPIO25 P1-22
GPIO27 P1-13
GPIO28 P5-03
GPIO29 P5-04
GPIO30 P5-05
GPIO31 P5-06

The configuration tab in CoDeSys does not have configuration options for (missing GPIOs) these GPIOs (Revision 2):

GPIO02
GPIO03
GPIO07
GPIO08
GPIO09
GPIO10
GPIO11
GPIO14
GPIO15

Since my project requires 16 GPIO's and the Configuration Tab only has 12 GPIO's defined, is there a way I can ADD configurations for the other missing GPIOs so they are available to use under CoDeSys?

Thanks for your help.


Top
   
PostPosted: Thu Aug 07, 2014 7:06 am 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 3306
Hi,

yes, this is possible.
We only provide the free GPIOs because we assume that in many cases I²c, SPI and the other options are used, so we reduced the standard IOs.
Please see attached the device description file (devdesc.xml) that contains the description and the parameters of the “GPIO” device in the device tree. Feel free to modify/customize it, but consider to give it a new ID (DeviceIdentification section) and a new name (DeviceInfo section)
Snippet from GPIOs.devdesc.xml
Code:
<Device hideInCatalogue="false">
    <DeviceIdentification>
      <Type>504</Type>
      <Id>0000 0000</Id>
      <Version>1.0.0.0</Version>
    </DeviceIdentification>
    <DeviceInfo>
      <Name name="local:ModelName">GPIOs</Name>




to distinguish it from the standard one. You need to install it in the device repository and update your device.

Please see also the attached library that interprets the configuration and executes it.

BR
Edwin


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Thu May 21, 2015 9:11 am 
Offline

Joined: Mon May 18, 2015 7:45 am
Posts: 2
Hello,

can you please give some more infos about how to modify the gpio.devdesc.xml and how to import it into CoDeSys.

I want to make a berryclip plus (http://www.raspberrypi-spy.co.uk/berryc ... tructions/) work with the Raspberry and CoDeSys.
Switch 2 (at GPIO 25), LED 2 (at GPIO 17) and LED 3 (at GPIO 22) are already working, but the others don't.

The python scripts are all working, so it is no hardware problem.

Thanks for your help.


Top
   
PostPosted: Tue Jun 16, 2015 9:07 pm 
Offline

Joined: Mon May 18, 2015 7:45 am
Posts: 2
Hello,

thanks to the 3S-Support i could get all GPIOs working.

Attached is the DevDesc.xml with all Pins.

First of all, you have to install the DevDesc.xml under "Tools" -> "Install Device..." and select the file.

Then, you have to navigate to "Tools" -> "Options...", select "Features" and click on "Predefined Feature Set" and change it to "Professional".

Now you can right-click on the Raspi in the project manager, select "update device..." and there is a new option "display all versions (for experts only)" and select the modified device description file.

Remember to map the Inputs and Outputs to plc-variables and to configure the used pins as input or as output.


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Fri Mar 18, 2016 9:58 am 
Offline
User avatar

Joined: Wed Apr 08, 2015 11:06 am
Posts: 36
Hi everyone! Anyone help me to understand GPIO structure. I talk about pull-up resistors, how configured I/O in Codesys driver, when I select port is input? For example I need use button working on ground.


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Tue May 17, 2016 8:16 am 
Offline

Joined: Fri May 13, 2016 5:25 am
Posts: 9
alexdrik wrote:
First of all, you have to install the DevDesc.xml under "Tools" -> "Install Device..." and select the file.

Then, you have to navigate to "Tools" -> "Options...", select "Features" and click on "Predefined Feature Set" and change it to "Professional".

Now you can right-click on the Raspi in the project manager, select "update device..." and there is a new option "display all versions (for experts only)" and select the modified device description file.

Remember to map the Inputs and Outputs to plc-variables and to configure the used pins as input or as output.


Hi, I don't have the "Features" option under the Tools - Options tabs! Am I missing something please?


Top
   
PostPosted: Wed May 18, 2016 7:14 am 
Offline
Frequent User
Frequent User
User avatar

Joined: Fri Mar 18, 2011 4:12 pm
Posts: 266
Hi,

in recent CODESYS versions, the "Featureset" functionality was removed, CODESYS now always behaves as "Professional". :D

HTH,
Markus

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


Top
   
PostPosted: Wed Jun 08, 2016 8:56 am 
Offline

Joined: Sun Feb 21, 2016 7:57 pm
Posts: 38
Hello! I need to set GPIO11 as input. I edit the file GPIOsBplus.devdesc.xml, in the settings this output appeared, but it's not working, can you fix it?


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Thu Jun 09, 2016 12:51 pm 
Offline

Joined: Sun Feb 21, 2016 7:57 pm
Posts: 38
artemka wrote:
Hello! I need to set GPIO11 as input. I edit the file GPIOsBplus.devdesc.xml, in the settings this output appeared, but it's not working, can you fix it?

Is it possible to implement it?


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

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 6 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