Search Project: *:*

 
<< < 1 .. 361 362 363 364 365 .. 3690 > >> (Page 363 of 3690)

Post by briangehrke on Discussion for Generic page I/O Drivers doc (Post)
Your comments above helped out a lot but I am a bit confused on how to create the methods for IoDrvReadInputs/WriteOutputs. I added these two methods to my library and they don't seem to be called. So lets say I have my Output to Relay1. I added this to my host parameter section as with an attribute of being an output. It shows up in my IO Map channel list in my project and I map a value to Relay1. All of this works for me so far, but I am lost on how the data moves from my project to the library and how to link the data in the library. I have tried getting the pointer to this object using pParameter := IoMgrConfigGetParameter(m_pConnector, 1000 + i); and the pointer does not seem to do anything. Is there a good driver project that illustrates this method to us? I think the last two sections of preparing I/O channels is vague and needs a little more explanation. This page has been an excellent guide on how to develop drivers. Thanks for the help! BG
Last updated: 2020-01-03

Post by briangehrke on Discussion for Generic page I/O Drivers doc (Post)
I have this partially working, but I seem to be missing something. My driver copies the first Channel Output which is a BYTE, but does not copy the boolean. It looks like the channel map stops at the first byte. I have read through the xml file over and over again, it pretty much matches what you have in the Can you please explain how this line works? pParameter^.dwDriverSpecific := ADR(_MCP3008.auiValue[i]); I don't understand how the channel map number of channels increments, looking at the line of code above, it looks like the dwDriverSpecific value keeps getting overwritten by the 8 addresses of the auiValue and just the last address is in the pParameter^.dwDriverSpecific. So this is what I have: I can see the value in the first byte named Relays, but the LED value never changes. //Setup I/O area pParameter := IoMgrConfigGetParameter(m_pConnector, 1000); IF (pParameter <> 0) THEN pParameter^.dwDriverSpecific := ADR(_RelayPlate.Relays); END_IF pParameter := IoMgrConfigGetParameter(m_pConnector, 1001); IF (pParameter <> 0) THEN pParameter^.dwDriverSpecific := ADR(_RelayPlate.LED); END_IF pParameter := IoMgrConfigGetParameter(m_pConnector, 1002); IF (pParameter <> 0) THEN pParameter^.dwDriverSpecific := ADR(_RelayPlate.ppFrame); END_IF pParameter := IoMgrConfigGetParameter(m_pConnector, 1003); IF (pParameter <> 0) THEN pParameter^.dwDriverSpecific := ADR(_RelayPlate.FirmwareVersion); END_IF pParameter := IoMgrConfigGetParameter(m_pConnector, 1004); IF (pParameter <> 0) THEN pParameter^.dwDriverSpecific := ADR(_RelayPlate.HardwareVersion); END_IF XML <HostParameterSet> <Parameter ParameterId="1000" type="std:BYTE"> <Attributes channel="output" download="true" functional="false" onlineaccess="readwrite" /> <Default/> <Name name="Relays">Relays</Name> <Description name="Relays_Desc">Relays on Relay Plate</Description> </Parameter> <Parameter ParameterId="1001" type="std:BOOL"> <Attributes channel="output" download="true" functional="false" onlineaccess="readwrite" /> <Default/> <Name name="LED">Led</Name> <Description name="LED_Desc-">LED CONTROL</Description> </Parameter> <Parameter ParameterId="1002" type="std:BIT"> <Attributes channel="input" download="true" functional="false" onlineaccess="readwrite" /> <Default>0</Default> <Name name="Control_IO">Control IO Port</Name> <Description name="Control_IO_Desc-">Control IO Port</Description> </Parameter> <Parameter ParameterId="1003" type="std:BYTE"> <Attributes channel="input" download="true" functional="false" onlineaccess="readwrite" /> <Default>0</Default> <Name name="FW_Version">Firmware Version</Name> <Description name="FW_VersionDesc-">Firmware Version of Relay Plate</Description> </Parameter> <Parameter ParameterId="1004" type="std:BYTE"> <Attributes channel="input" download="true" functional="false" onlineaccess="readwrite" /> <Default>0</Default> <Name name="HW_Version">Hardware Version</Name> <Description name="HW_VersionDesc-">Hardware Version of Relay Plate</Description> </Parameter> </HostParameterSet>
Last updated: 2020-01-05

Post by briangehrke on Discussion for Generic page I/O Drivers doc (Post)
I have a question about the structures. I will start with the BIT structure. It looks Should the code read TYPE Bitfield : STRUCT Bit0 : Bit; Bit1 : Bit; Bit2 : Bit; Bit3 : Bit; END_STRUCT END_TYPE Device Description <BitfieldType basetype="std:BYTE" name="Bitfield"> <Component identifier="Bit0" type="std:BOOL"> <Default /> ....
Last updated: 2019-12-09

Post by fabiopd on Discussion for Generic page I/O Drivers doc (Post)
If I create it with this tutorial , after that can the moderator add the driver in the list?
Last updated: 2020-02-28

Post by ingo on Discussion for Generic page I/O Drivers doc (Post)
Yes, you need to use CODESYS SVN. But don't worry about the license. Whenyou use it with CODESYS Forge, you can use it w/o a license. Indeed you are right. The workflow with CODESYS SVN is not well known, yet. So a tutorial might be good.
Last updated: 2020-03-10

Post by briangehrke on Discussion for SPI page I/O Drivers doc (Post)
I am having trouble writing to the SPI bus. I have a python script I am trying to translate to codesys. SPI Master settings in codesys: Max Hz 500000 bits per word is 8 port mode is 1 Python addr = 0 cmd = 0x12 //Toggle Relay param1 = 1 //Relay 1 param2 = 0 GPIO.setmode(GPIO.BCM) RELAYbaseADDR=24 ppFRAME = 25 ppINT = 22 GPIO.setup(ppFRAME,GPIO.OUT) GPIO.output(ppFRAME,False) #Initialize FRAME signa time.sleep(.001) #let Pi-Plate reset SPI engine if necessary GPIO.setup(ppINT, GPIO.IN, pull_up_down=GPIO.PUD_UP) spi = spidev.SpiDev() spi.open(0,1) localPath=site.getsitepackages()[0] RPversion=1.1 ppCMDr(addr,cmd,param1,param2,bytes2return): global RELAYbaseADDR arg = list(range(4)) resp = [] arg[0]=addr+RELAYbaseADDR; arg[1]=cmd; arg[2]=param1; arg[3]=param2; GPIO.output(ppFRAME,True) null=spi.xfer(arg,300000,60) #null = spi.writebytes(arg) if bytes2return>0: time.sleep(.0001) for i in range(0,bytes2return): dummy=spi.xfer([00],500000,20) resp.append(dummy[0]) time.sleep(.001) GPIO.output(ppFRAME,False) time.sleep(.001) return resp def relayTOGGLE(addr,relay): VerifyADDR(addr) VerifyRELAY(relay) ppCMDr(addr,0x12,relay,0,0) Codesys (Inside Method AfterReadInputs) iAddress := 0 ppFRAME := TRUE; aby[0] := iAddress + Relay_Base_Address; aby[1] := 16#12; //Toggle Relay aby[2] := 1; aby[3] := 0; transferEXT(pabyTxBuffer:=ADR(aby) , pabyRxBuffer:=ADR(aby) , udiLen:=4 , uiDelayus:=60,udiSpeedHz := 300000); ppFRAME := FALSE; It seems to transfer with no errors, but nothing happens. If I run the code in python then everything works. I can toggle the relay on and off with the following code. import piplates.RELAYplate as RELAY import time RELAY.relayTOGGLE(0,1) Do I need to open the spi port? Is there something more that I need to do?
Last updated: 2019-12-31

Post by i-campbell on Discussion for Generic page I/O Drivers doc (Post)
The page you linked suggests using "<id>0004 ....</id>" https://forge.codesys.com/drv/io-drivers/doc/Generic/?limit=25#device-identification suggests 0004 as well https://forge.codesys.com/drv/io-drivers/doc/I2C/ suggests 0003 For a new I2C device, I can't decide.
Last updated: 2020-01-22

Post by fabiopd on Discussion for Generic page I/O Drivers doc (Post)
Hello can I create a driver for the I2C AM2315 (https://learn.adafruit.com/am2315-encased-i2c-temperature-humidity-sensor/arduino-code) ? or there are some packages to download? Thanks a lot!
Last updated: 2020-02-26

Post by aliazzz on Discussion for Generic page I/O Drivers doc (Post)
...
Last updated: 2018-10-20

Post by aliazzz on Discussion for Generic page I/O Drivers doc (Post)
Last updated: 2019-01-18

Post by fabiopd on Discussion for Generic page I/O Drivers doc (Post)
Hello Ingo I can't undestand how to merge the io-drivers-code-r13-trunk folder in my codesys project.... Have I to use SVN and install CODESYS SVN or I can do without? The process how to build a driver is not clear!
Last updated: 2020-03-09

Post by briangehrke on Discussion for Generic page I/O Drivers doc (Post)
Yes, I did locate the SPI template titled SPI_Template.devdesc.xml, I probably did not explain myself well enough based on your response. I am looking for a template to create a plug in SPI module to plug into a connector slot. I did not see a template for a SPI_Modules_V1.0.xml file. I have successfully created 8 slots, now I want to create a module to plug into one of the slots. I also would like to see how to iterate through each module and and perform an action based on the module type. For example, I have a relay card and a DAC card on a SPI bus with addresses 0 and 1 respectively. I plug the modules into my device slots. I have 8 slots available for devices. I put the device type as host parameter and use this parameter as a key to process the information. As I go through a loop in the FB, I will send data in a format to turn relays on, the change the data to send to the DAC module. The data will be formated for the module type and sent through the SPI bus. 1.) How do I create a module file? 2.) How do I iterate through each slot and read the host parameters? 3.) How do I link the inputs and outputs to the function blocks? While I am researching this, I am working on interfacing a relay module using SPI. I have this somewhat working but needs more work. BG
Last updated: 2019-12-29

Post by ingo on Discussion for SPI page I/O Drivers doc (Post)
Your code looks good. I expect, that you are missing some init code. Did you already try "strace" on your python script? I would either try strace or a python debugger to get a better understanding of the python code. In CODESYS you can't do much wrong. Except that you might have the wrong device or frequency configured in the SPI master of your project. Especially the frequency can be important, as on some raspbian versions, the highest possible frequency was not limited correctly. Therefore you need to configure it in the SPI master device in your CODESYS project. (Took me some hours once ;) ) But you don't need to open anything. This is done by the SPI master already.
Last updated: 2020-01-01

Post by i-campbell on Discussion for Generic page I/O Drivers doc (Post)
Today I learned that vendor ID 0003 is for Open Source, and vendor ID 0004 is for CODESYS Configs. Not 100% sure what Configs are, but it is clear we should be using 0003 for Forge Open Source drivers.
Last updated: 2020-01-23

Post by ingo on Discussion for SPI page I/O Drivers doc (Post)
Thanks for the report!
Last updated: 2019-11-30

Post by ingo on Discussion for Generic page I/O Drivers doc (Post)
The MCP3008 driver is doing it this way. Step 1) Implement the I/O Driver Interface. For this, the driver defines a new FB, implenting this interface: FUNCTION_BLOCK IoDrvMCP3008 EXTENDS IoDrvBase Step 2) Instantiate the driver FB in your devdesc: <RequiredLib libname="Linux SPI MCP3008" vendor="Open Source" version="1.0.0.0" identifier="deviceLib"> <FBInstance basename="$(DeviceName)" fbname="IoDrvMCP3008"> <Initialize methodName="Initialize" /> </FBInstance> </RequiredLib> Step 3) instantiate your SPI FB inside of the drivrt FB: _MCP3008: MCP3008; Step 4) Map the I/O channels to the inputs and outputs of your SPI FB //Setup I/O area FOR i:=0 TO 7 DO pParameter := IoMgrConfigGetParameter(m_pConnector, 1000 + i); IF (pParameter <> 0) THEN pParameter^.dwDriverSpecific := ADR(_MCP3008.auiValue[i]); END_IF END_FOR Step 5) Call IoMgrCopyXXX in ReadInputs / WriteOutputs FOR i:=0 TO nCount - 1 DO IF (pConnectorMapList[i].dwNumOfChannels = 0) THEN CONTINUE; END_IF FOR j:= 0 TO UDINT_TO_UINT(pConnectorMapList[i].dwNumOfChannels) - 1 DO IoMgrCopyInputLE(ADR(pConnectorMapList[i].pChannelMapList[j]), pConnectorMapList[i].pChannelMapList[j].pParameter^.dwDriverSpecific); END_FOR END_FOR
Last updated: 2020-01-03

Post by ingo on Discussion for Generic page I/O Drivers doc (Post)
Hi Fabio, no moderation necessary. Just create your own driver project by clicking on "register project" in driver neighborhood. Then describe your work in the wiki of the project, upload all code and devdescs to SVN, and you are done. To register your driver ID, just go to database and add it there.
Last updated: 2020-02-28

Post by aliazzz on Discussion for Generic page I/O Drivers doc (Post)
<attributes download="true" offlineaccess="write" functional="false" channel="input" onlineaccess="readwrite"></attributes> => Please explain these meta tags, as they are important ;-)
Last updated: 2018-09-30

Generic (version 2) discussion I/O Drivers doc (Thread)
Generic (version 2) discussion
Last updated: 2018-09-03

Driver FB (version 7) discussion I/O Drivers doc (Thread)
Driver FB (version 7) discussion
Last updated: 2019-01-06

SPI (version 3) discussion I/O Drivers doc (Thread)
SPI (version 3) discussion
Last updated: 2018-09-02

(no subject) I/O Drivers doc (Thread)
Last updated: 2020-03-12

(no subject) I/O Drivers doc (Thread)
Last updated: 2018-01-24

Home (version 12) discussion I/O Drivers database (Thread)
Home (version 12) discussion
Last updated: 2018-12-07

Home (version 19) discussion I/O Drivers database (Thread)
Home (version 19) discussion
Last updated: 2020-02-12

<< < 1 .. 361 362 363 364 365 .. 3690 > >> (Page 363 of 3690)

Showing results of 92239

Sort by relevance or date