baobao

Dear thiagoralves,

I am a novice of OpenPLC, and I have learned that OpenPLC can drive Arduino or other types of boards through modbus protocol, but there is no TI-OMAPL138 board to be used in our laboratory, so I want to add an TI-OMAPL138 board to the support type of OpenPLC.

I have been reading the source code for some time and have been looking for information in this BBS for a long time. Here is what I know now:

1. The operation of the hardware in the main function in the /Webserver/core directory is mainly divided into three parts:
    a.initializeHardware,
    b.updateBuffersIn,
    c.updateCustomOut,
and the three functions are all in a file which is in the Hardware_layers directory.

2. I found some scripts in the process of reading the source code files, such as Change_hardware_layer. Sh, the file appears to be based on user selection in the Hardware options, to replace the actual operation of the program are referenced hardware_layes.
The CPP, but appeared such statements in the file,
"
   echo win > ../scripts/openplc_platform
  echo blank > ../scripts/openplc_driver
"
I can't find openplc_platform and openplc_driver where these two files will be used.

3. I found a pages.py file in the Webserver directory, which seems to output the HTML/CSS/JAVAScript string through the python language, thus setting up the localhost web interface.In the hardware section, however, I found only the hardware_head and hardware_tail sections, and the subject section in the middle appears to be generated dynamically by calling CodeMirror. FromTextArea (custom_layer_code,options).However, I have not found such file named "custom_layer_code" .

In conclusion:

So can I add a board for OMAPL138 in the following steps?

1. Write a similar l138.cpp by imitating the raspberrypi.cpp file in hardware_layers directory

2. Modify the change_hardware_layer. sh file.Replace the l138.cpp I created with hardware_layes.cpp

3. Modify pages.py to generate an option of L138 board in the localhost page

 

The above is what I have learned and the question I would like to ask you. I hope you can help me correct it in your spare time. Thank you sincerely!

Quote 0 0
thiagoralves
Hi baobao,

You right on most things, except on #3. Instead of modifying pages.py, you need to modify webserver/ webserver.py which contains the pages dynamically generated. More specifically, take a look at webserver.py:1273. The custom_layer_code textarea is a online code editing feature that allows the user to enhance the current driver by adding its own code.
Quote 0 0