Jump to content

Marco G

Members
  • Content Count

    54
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Marco G

  • Rank
    Advanced Member
  1. Hey, no problem. i'm going to trie to create some MB's where the alarms can be stored into and then read those using readoperands like with the datatable.
  2. I know that they are pretty much the same, but i want to implement a function to check for alarms in a existing vb.net project, and therefore i cant directly copy-paste
  3. Hey, I can't seem to get it copied to .net. I will keep working at it but the example is quite big, so converting it al to .net costs quite some time.. Is it also possible to save the alarms to a datatable? because i think it is possible to read a unitronics datatable in .net.
  4. Thanks, just downloaded the Lite version, it can't be opened in vb 2010 express but wil try opening it with my version of Studio 2013. I found some code somewhere else, but that version of card explorer lite has been written in C. Also, i couldn't find the dll in there, which is included in the .net version(SdcardExplorer.lite.dll)
  5. Yeey, that part works. Just curious btw, is there a .net version of the SD card Explorer example?
  6. Hey, The example posted above is a C# example isn't it? I was wondering if there's also a .net example somewhere.
  7. Edit: Whoohoo, got it; at least for inserting 1 row at the time, now i will figure out how to insert multiple rows. I do already have some ideas of how to do that.
  8. Hmm, i cleared the MI needed(in my case i want to use MI150) but i still get the error. The datatable should be completely empty, it says 0 at all the INT columns and the string column is blank so i should have 250 empty rows in the datatable.
  9. Ah right. Thought so. Thanks, i will ask a collegue about the MI part.
  10. Hey, Thanks. I think there a error though. Dim rw() As ReadWriteRequest = New ReadWriteRequest((1) - 1) {} Dim Read As WriteOperands = New ReadOperands() rw(0) = Read With Read It says writeoperand AND readoperand so that gives a error. When i change the readoperand to writeoperand i get the ComDriveException "Values cannot be Null in a Write Operands request" And if i switch it all to read: "'index' must be non-negative and less than the number of rows in table. I checked the fields, removed fields and tested some things but the fields do have a value(default value = 0, but it also doesnt work if i enter a value like 24) I suspect that the error comes from the PLC. I havn't figured out how to program the plc to make it store the newest empty row in a MI, i think i will ask a collegue for help. Parameternaam: index "
  11. Ah right. That makes sense. Sorry, completely new to using operands and PLC's in general, just fresh out of college(well not even, learning a second degree in Business IT on the side)
  12. Hey, I adjusted the code(see below) Right now, it compiles without error but it gives the error: "The number of Operands to read cannot be less than 1" on rw(0) = New ReadOperands plc.ReadWrite(rw) The complete code: Dim rw() As ReadWriteRequest = New ReadWriteRequest((1) - 1) {} rw(0) = New ReadOperands plc.ReadWrite(rw) Dim startRowIndex = Convert.ToInt16(CType(CType(rw(0), ReadOperands).ResponseValues, Object())(0)) table.Rows(startRowIndex).Cells(3).Fields(0).Value = DateTimePicker1.Text 'datum en tijd table.Rows(startRowIndex).Cells(2).Fields(0).Value = lblvoerbaknr.Text table.Rows(startRowIndex).Cells(0).Fields(0).Value = lblVoerzend.Text table.Rows(startRowIndex).Cells(1).Fields(0).Value = lblzendgewicht.Text ' Now you increment startRowIndex by the number of rows you intend to write (in this example, only 1 row): startRowIndex = (startRowIndex + 1) ' Now you write the table (You can also use Update, which will only update the cells that you have altered) table.Write() ' or table.Update() ' Now we need to update the value of MI100 in the PLC. '30-1-15 ANDERS dan bron! aangepast naar .net en code lichtelijk veranderd! Broncode: Dim Write As WriteOperands = New WriteOperands() rw(0) = Write With Write .NumberOfOperands = 1 .OperandType = OperandTypes.MI .StartAddress = 100 .NumberOfOperands = 1 .Values = New Object() {startRowIndex} End With plc.ReadWrite(rw)
  13. Aah, so i do have to do something with read and writeoperands. I read about it in the PLC .net documentation but thought it was for writing directly to the application. Thanks. I will convert it to .net and see if it works.
  14. Okay... and how can i do that? I thought i already got the pc part working and just needed to change some things in the ladder to make it working like i wanted. Row 0 doesnt have to be renewed, all it has to do is add a extra entry to the plc datatable every time i send 1(or multiple) rows to the plc.
  15. Hello, If i understand you correctly, i have to keep the pc software the same ( table.rows(0).cells(0).fields(0)) and write the ladder in such a way that when it sees that i want to add a entry to the table, it automatically writes it to a new line? Cool. thought it was just me because i couldn't find a solution in vb.net.
×
×
  • Create New...