Digital output reading and writing to led component
07 Oct 2021 08:57 #222433
by Leintz2
Digital output reading and writing to led component was created by Leintz2
Hi !
How to read mesa 7i76e digital output and turn on led in pyvcp?
so...I have ou digital output (hm2_7i76.0.7i76.0.0.output-02)...i want to read it an write its signal to pyvcp.led
Any ideas about the correct syntax?
Regards!
How to read mesa 7i76e digital output and turn on led in pyvcp?
so...I have ou digital output (hm2_7i76.0.7i76.0.0.output-02)...i want to read it an write its signal to pyvcp.led
Any ideas about the correct syntax?
Regards!
Please Log in or Create an account to join the conversation.
07 Oct 2021 09:43 #222437
by MaHa
Replied by MaHa on topic Digital output reading and writing to led component
Example, in the vcp postgui.hal:
in .xml
net led-on-off pyvcp.ledonoff hm2_7i76.0.7i76.0.0.output-02
in .xml
<hbox>
<label text=""/>
<led><halpin>"ledonoff"</halpin><on_color>"Red3"</on_color><off_color>"gray86"</off_color><size>10</size></led>
<label><text>" Digital out"</text></label>
</hbox>
Please Log in or Create an account to join the conversation.
07 Oct 2021 11:06 #222447
by Leintz2
Replied by Leintz2 on topic Digital output reading and writing to led component
so...my version
custom_postgui.hal
net led_beaconred1 pyvcp.led_beaconred hm2_7i76e.0.7i76.0.0.output-02
pyvcp-panel.xml
<hbox>
<led>
<halpin>"led_beaconred"</halpin>
<size>18</size>
<on_color>"red"</on_color>
<off_color>"gray"</off_color>
</led>
<label>
<text>"Beacon RED (M111/M112)"</text>
<font>("Helvetica",10)</font>
</label>
</hbox>
I'm using M111 and M112 MDi commands to operate with this digital output...after adding those lines in custom_postgui.hal it disables M111 command in MDI mode and led on pyvcp panel does not react...
what is wrong?
custom_postgui.hal
net led_beaconred1 pyvcp.led_beaconred hm2_7i76e.0.7i76.0.0.output-02
pyvcp-panel.xml
<hbox>
<led>
<halpin>"led_beaconred"</halpin>
<size>18</size>
<on_color>"red"</on_color>
<off_color>"gray"</off_color>
</led>
<label>
<text>"Beacon RED (M111/M112)"</text>
<font>("Helvetica",10)</font>
</label>
</hbox>
I'm using M111 and M112 MDi commands to operate with this digital output...after adding those lines in custom_postgui.hal it disables M111 command in MDI mode and led on pyvcp panel does not react...
what is wrong?
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
07 Oct 2021 16:46 #222469
by Todd Zuercher
Replied by Todd Zuercher on topic Digital output reading and writing to led component
What do your M111 and M112 files look like?
Please Log in or Create an account to join the conversation.
08 Oct 2021 05:00 #222519
by Leintz2
Replied by Leintz2 on topic Digital output reading and writing to led component
M111 file:
#!/bin/bash
# beacon Red ON
halcmd setp hm2_7i76e.0.7i76.0.0.output-02 true
exit 0
M112 file:
#!/bin/bash
# beacon Red Off
halcmd setp hm2_7i76e.0.7i76.0.0.output-02 false
exit 0
#!/bin/bash
# beacon Red ON
halcmd setp hm2_7i76e.0.7i76.0.0.output-02 true
exit 0
M112 file:
#!/bin/bash
# beacon Red Off
halcmd setp hm2_7i76e.0.7i76.0.0.output-02 false
exit 0
Please Log in or Create an account to join the conversation.
08 Oct 2021 05:31 #222521
by MaHa
Replied by MaHa on topic Digital output reading and writing to led component
Can you try this in custom_postgui.hal
net led_beaconred1 hm2_7i76e.0.7i76.0.0.output-02
net led_beaconred1 pyvcp.led_beaconred
Please Log in or Create an account to join the conversation.
08 Oct 2021 06:14 #222523
by Leintz2
Replied by Leintz2 on topic Digital output reading and writing to led component
so ...no good result..hal_meter show me: led_beaconred1 FALSE all the time..and digital output DO-02 (commands -M111/M112) do not respond any more
Please Log in or Create an account to join the conversation.
08 Oct 2021 11:22 #222542
by Leintz2
Replied by Leintz2 on topic Digital output reading and writing to led component
ok...if I put lines to M111 file
#!/bin/bash
# vilkur Red ON
halcmd setp hm2_7i76e.0.7i76.0.0.output-02 true
halcmd net led_beaconred1 hm2_7i76e.0.7i76.0.0.output-02
halcmd net led_beaconred1 pyvcp.led_beaconred
exit 0
it will turn on led (pyvcp panel)
but I cant turn it off with M112 command
M112 file:
#!/bin/bash
# vilkur Red OFF
halcmd setp hm2_7i76e.0.7i76.0.0.output-02 false
halcmd net led_beaconred1 hm2_7i76e.0.7i76.0.0.output-02
halcmd net led_beaconred1 pyvcp.led_beaconred
exit 0
#!/bin/bash
# vilkur Red ON
halcmd setp hm2_7i76e.0.7i76.0.0.output-02 true
halcmd net led_beaconred1 hm2_7i76e.0.7i76.0.0.output-02
halcmd net led_beaconred1 pyvcp.led_beaconred
exit 0
it will turn on led (pyvcp panel)
but I cant turn it off with M112 command
M112 file:
#!/bin/bash
# vilkur Red OFF
halcmd setp hm2_7i76e.0.7i76.0.0.output-02 false
halcmd net led_beaconred1 hm2_7i76e.0.7i76.0.0.output-02
halcmd net led_beaconred1 pyvcp.led_beaconred
exit 0
Please Log in or Create an account to join the conversation.
08 Oct 2021 11:40 #222543
by Leintz2
Replied by Leintz2 on topic Digital output reading and writing to led component
so just hacking in different way:
add 2 lines to:
M111 file
halcmd setp pyvcp.led_beaconred true
M112 file
halcmd setp pyvcp.led_beaconred false
now it works
add 2 lines to:
M111 file
halcmd setp pyvcp.led_beaconred true
M112 file
halcmd setp pyvcp.led_beaconred false
now it works
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
08 Oct 2021 13:56 - 08 Oct 2021 14:00 #222551
by Todd Zuercher
Replied by Todd Zuercher on topic Digital output reading and writing to led component
The reason it didn't work before was because it is not possible to setp the value of a hal pin when it is connected to a signal. So when you created the hal line "net led_beaconred1 pyvcp.led_beaconred hm2_7i76e.0.7i76.0.0.output-02" linking both pins to the signal "led_beaconred1" it broke your custom M-codes.
As long as that signal isn't connected to a hal ouput pin you could have made it work by simply changing your M-code to use a sets command to set the signal true or false. (Keeping the "net led_beaconred1 pyvcp.led_beaconred hm2_7i76e.0.7i76.0.0.output-02" line of hal code.)[/code]
As long as that signal isn't connected to a hal ouput pin you could have made it work by simply changing your M-code to use a sets command to set the signal true or false. (Keeping the "net led_beaconred1 pyvcp.led_beaconred hm2_7i76e.0.7i76.0.0.output-02" line of hal code.)
M111 file:
#!/bin/bash
# beacon Red ON
halcmd sets led_beaconred true
exit 0
and
[code]M112 file:
#!/bin/bash
# beacon Red Off
halcmd sets led_beaconred false
exit 0
Last edit: 08 Oct 2021 14:00 by Todd Zuercher.
Please Log in or Create an account to join the conversation.
Time to create page: 0.090 seconds