Mocca; hal file with button command

More
27 Jun 2011 20:23 #10905 by michel45
Hello,
I want to order the light of my machine directly from the mocca screen. How to link a button (button8 for example) with the light output. In
The party program that should go with Lazarus. The name is "moc.button.8"?

My file hal
.....
# Eclairage (pin 25 OUT)
setp hm2_5i22.0.gpio.025.is_output TRUE
net eclairage-on <= iocontrol.0.moc.button.8 ?????
net eclairage-on => hm2_5i22.0.gpio.025.out
......

For now nothing works :( , but I do not despair :unsure:
thank you to him who gives me an idea.
Michel

Please Log in or Create an account to join the conversation.

More
27 Jun 2011 21:54 #10907 by andypugh
If you comment out the new lines, then start mocca, then, in a terminal window type:
halcmd show pin
That should give you a list of all the pins, hopefully giving the full correct name of the mocca button pin.

(put the output on pastebin.org perhaps)

Please Log in or Create an account to join the conversation.

More
28 Jun 2011 08:19 #10916 by michel45
hello,
here I have put under:
pastebin.com/p5bDGdqF
title : mocca pinout

thank
Michel

Please Log in or Create an account to join the conversation.

More
28 Jun 2011 09:23 - 28 Jun 2011 09:24 #10917 by andypugh
michel45 wrote:

.....
# Eclairage (pin 25 OUT)
setp hm2_5i22.0.gpio.025.is_output TRUE
net eclairage-on <= iocontrol.0.moc.button.8 ?????
net eclairage-on => hm2_5i22.0.gpio.025.out
......


Your pin listing shows that there is no pin called iocontrol.0.moc.buttton.8, your code needs to be:
# Eclairage  (pin 25 OUT) 
setp hm2_5i22.0.gpio.025.is_output TRUE
net eclairage-on  moc.button.8  => hm2_5i22.0.gpio.025.out

I am not sure if the mocca buttons latch, if you find that the light is on only when the button is being pressed, then I can show you how to add some more HAL components to make it work properly.
Last edit: 28 Jun 2011 09:24 by andypugh.

Please Log in or Create an account to join the conversation.

More
28 Jun 2011 12:47 #10923 by michel45
Hello,
thank you for your help
I tried this solution but "moc.button.8" is not recognized.:(
Michel

hal file
======
......
# Arrosage (pin 24 OUT)
setp hm2_5i22.0.gpio.024.is_output TRUE
net coolant-flood iocontrol.0.coolant-flood hm2_5i22.0.gpio.024.out

# Eclairage (pin 25 OUT)
setp hm2_5i22.0.gpio.025.is_output TRUE
net eclairage-on moc.button.8 => hm2_5i22.0.gpio.025.out
......

return
=====
mipretec-desktop:~$ emc
This script only needs to be run once per shell session.
EMC2 - 2.4.5
Machine configuration directory is '/home/mipretec/Documents/emc2-dev-rtai/configs/sim'
Machine configuration file is 'mipretec-c104.ini'
Starting EMC2...
CNC1.hal:158: Pin 'moc.button.8' does not exist
Shutting down and cleaning up EMC2...
Cleanup done
EMC terminated with an error. You can find more information in the log:
/home/mipretec/emc_debug.txt
and
/home/mipretec/emc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal

Please Log in or Create an account to join the conversation.

More
28 Jun 2011 13:17 #10925 by andypugh
michel45 wrote:

Hello,
thank you for your help
I tried this solution but "moc.button.8" is not recognized.:(


I have never used Mocca, but my guess would be that the buttons don't exist until the GUI is loaded.

Move the button 8 "net" statement line to the custom_postgui.hal file.

Please Log in or Create an account to join the conversation.

More
28 Jun 2011 16:06 #10927 by michel45
Hello,
Thank you Andy, why I did not think!
That was the problem.
Michel

Please Log in or Create an account to join the conversation.

Time to create page: 0.137 seconds
Powered by Kunena Forum