Home › Forum › Programmazione IEC 61131 (LogicLab) › Send an ascii string that reports a digital input status
- Questo topic ha 5 risposte, 2 partecipanti ed è stato aggiornato l'ultima volta 11 anni, 7 mesi fa da Sergio Bertana.
-
AutorePost
-
Settembre 26, 2012 alle 12:58 pm #35281KostasPartecipante
I’m trying to write a simple program that sends the status of digital inputs out to the serial line. My need is to manage 48 digital inputs using 3 PCB124*000 modules connected to a SlimLine CPU module.
The request is to send a string, out to the serial port (9600, n, 8, 1), every time one of the inputs changes its state. The string must contains the status of all the inputs. As example the strings can be like these:
*010000000000000000000000000000000000000000000000# //Digital inp01 is On
*010000001000000000000000000000000000000000000000# //Digital inp01 and 08 are On
*000000000000000000000000000000000000000000000000# //All digital inputs are OffCan someone help me ?
Settembre 26, 2012 alle 1:12 pm #37407Sergio BertanaAmministratore del forumI’ve create a simple program for you, this program acquire the digital inputs from the PCB124*000 modules. The acquired status is compared with the saved one and when one or more of the inputs change its status, a message is sent out from the serial line.
The program is documented so it’s simple to follow its flow, anyway if you are in trouble you can post the requests in the forum. Here the program printout and the complete source code.
Settembre 28, 2012 alle 8:46 am #37412KostasPartecipanteThank you for the program! Unfortunately I can’t load it in the SlimLine. When I try to download on it I get the error:
Processor setting error: current project ‘ARM9’, target device”.
Comm setting error: current project ‘ELS20’, target device”.Do you have any suggestions on how to overcome this problem?
Settembre 28, 2012 alle 9:06 am #37413Sergio BertanaAmministratore del forumThe cause of the error is that you are connected to the SlimLine thru the serial line, and probably you have not the correct cable or the proper serial settings.About the cable you must use our CBL054*000 adapter with the CLB057**00 extension cable, if you don’t have you can do them by yourself (Refer to drawing).On LogicLab you must define as serial settings 115200, e, 8, 1 and the modbus node must be 1. The COM port you define, is the COM used on the PC regardless the COM port number of the SlimLine (Refer to picture).Please note that if you don’t have the SD Card inserted you not have the space to contain the program source code, so you must disable the Source code download tick otherwise a warning message will appear and the program is not downloaded on the SlimLine. warning T8209: No room for source file on the target.
Attention! The program treated in this topics uses the SlimLine COM0 serial port to send out the digital inputs status, so to connect LogicLab, the serial line COM1 must be used.
Ottobre 3, 2012 alle 8:30 am #37423KostasPartecipanteI tried to access the code of SetSMode and VBitTest but they seem to be encrypted. Could you please provide the password or the code ?
Ottobre 3, 2012 alle 8:34 am #37424Sergio BertanaAmministratore del forumAll the Functions and FBs we provide as a standard libraries are crypted, this prevent user to modify them. For some of them we don’t release the source code, but many of them are really very simple and there is no problem in to release the source code.
Understanding the source code is a good way to enter deeply in the SlimLine programming tecniques, here the SetSMode and VBitTest printout, unfortunately all the comments are in Italian.
-
AutorePost
- Devi essere connesso per rispondere a questo topic.