backpackingjp
Hi there !

My project uses the sensor of DHT20. It's i2c device.
I tried coding on PSM but many errors appered.
And the vlaue of monitoring(sensor) is "0". not changed

Please check the attachment files and tell me the solution.

thank you all 

ex.below 
PSM: Connected to PSM
PSM: Error reading from analog inputs!
PSM: Error writing to digital outputs!
PSM: Error writing to analog outputs!
PSM: Error writing to analog outputs!
Warning: Persistent Storage file not found
PSM: Error reading from digital inputs!
PSM: Error writing to digital outputs!
PSM: Error reading from digital inputs!
PSM: Error writing to digital outputs!
PSM: Error reading from digital inputs!
PSM: Error writing to digital outputs!
PSM: Too many errors!
PSM: PSM is disabled
Reply 0 0
thiagoralves
You're missing PSM prototypes (hardware_init, update_inputs and update_outputs). PSM will stop at initialization if your code does not have them. Also, it is advisable to avoid sleep functions as much as possible, except on the main PSM while loop.
Reply 0 0
backpackingjp
@thiagoralves
 Sorry to asked such a basic question.
 I fixed my code on PSM then the error messeges disappeared !

  But I have a problem yet. I continue try again.
  The value of  sensor (temparature) is "0".
  Are the settings "IW100" "WORD" incorrect?
Reply 0 0
thiagoralves
You should not use any address above 100, as those are reserved for slave devices communication.
Reply 0 0
backpackingjp
I see. And it seems to be good.
"IW*" is "16bit WORD". Then is the valule at Monitoring chaned to 16bit?
ex.    value of sensor(temp)  =  24℃  ⇒ value of monitoring = 18 ?? 

Now I writed a ladder program called " 1bit memory circuit". See below.
ladder.jpg 
The setting of Hardware is "RPI" , it works on.
I put the button(SW1) then "CR3"  is TRUE.I put the button(SW2) then "CR3" is FALSE.

ON.jpg But the setting of Hardware is "python on Linux (PS'M)" , it doesn't work .
 It seems forced by some programs.I put the button(SW1) .There is no event. (keep FALSE)

It's hard for me.
Can  you please give me any suggestions or hints? 
Reply 0 0
thiagoralves
PSM replaces the Raspberry Pi driver, which means if you want to read any GPIO at all you must include them in your PSM code as well. In other words, you need to provide the code to read %IX0.3 (and which GPIO pin it will be associated with), %IX0.4, %QX0.0, %QX0.1, %QX0.2 and any other pin you want to use.
Reply 0 0
backpackingjp
Thank you for your reply .
I noticed several mistakes on my python code . And I mistaked the wiring.
I'll try fixing them.

I appriciate  you and these great projects !
Reply 0 0
backpackingjp
My project is working at hardware switch.

Now my project isn't working at software switch with modbus.
I would like to do something about it. 

Specially
         I tried do <modbus_python.py> .
   ”GUI_SW1” was not changed.  <psm_main.py> 

Please tell me what I wrong.
Reply 0 0
backpackingjp
I added more information:

        1. Start PLC
        2. client = ModbusClient('localhost', port=502)
            client.write_coil(1024, 3)

       Then the value of Monitor was changed. ( value = 3 )
       The value of Dashboard-log was not changed. [ GUI_SW1(%MW0) = 0 ] secondャ.jpg          
Reply 0 0
thiagoralves
You are mixing things up. PSM is a driver which means that its only function is to read/write hardware and provide that information to OpenPLC buffers. Nothing more. You should not include any type of logic in your driver (things like if SW1 == 1 for example). Those things should be part of your PLC program. For that same reason, PSM cannot read or write memory locations (%MW0).
Reply 0 0
backpackingjp
I continued to fix my code (on PSM and ladder logic ).
I understood your mention . And my project goes well.

I am grateful for your support.

ladder.jpg 

And refer to these topics:
 モドバススレーブ - OpenPLCフォーラム (discussion.community)
 HMIボタンをPLCを開くに接続する方法 - OpenPLCフォーラム (discussion.community)

Reply 0 0
Reply