First steps with 6i25+7i77 : how to read a home switch ?

More
20 Nov 2018 14:10 - 20 Nov 2018 14:12 #121054 by JC10
Hello,

I am starting with LinuxCNC and MESA boards.

Reading various posts on the forum, I managed to connect all and supply the field power with 24v DC.

I started with what andypugh showed in this topic : forum.linuxcnc.org/9-installing-linuxcnc...nuxcnc-configuration


Open a terminal window and type:
sudo dmesg -c
halrun
loadrt hostmot2
loadrt hm2_pci
show pin *5i25*
exit
dmesg

The "show pin" displays all the HAL pins created by the firmware on the card.


I am able to see all my I/O from the 7i77 :
user@LINUXCNC:~/Downloads/5i25/configs/hostmot2$ halrun
halcmd: loadrt hostmot2
halcmd: loadrt hm2_pci
halcmd: show pin *7i77*
Component Pins:
Owner   Type  Dir     	Value  Name
 	5  bit   OUT     	FALSE  hm2_5i25.0.7i77.0.0.input-00
 	5  bit   OUT     	FALSE  hm2_5i25.0.7i77.0.0.input-00-not
...
 	5  bit   OUT     	FALSE  hm2_5i25.0.7i77.0.0.input-31
 	5  bit   OUT     	FALSE  hm2_5i25.0.7i77.0.0.input-31-not
 	5  bit   IN      	FALSE  hm2_5i25.0.7i77.0.0.output-00
....
 	5  bit   IN      	FALSE  hm2_5i25.0.7i77.0.0.output-15

 	5  bit   IN      	FALSE  hm2_5i25.0.7i77.0.1.analogena
 	5  float IN          	0  hm2_5i25.0.7i77.0.1.analogout0
....
 	5  float IN          	0  hm2_5i25.0.7i77.0.1.analogout5
 	5  bit   IN      	FALSE  hm2_5i25.0.7i77.0.1.spinena

Using again andypugh suggestion from this topic : forum.linuxcnc.org/38-general-linuxcnc-q...-done-init-mesa-6i25

Just type this at the terminal:
halrun
loadrt hostmot2
loadrt hm2_pci
(Nothing happens with the card without being attached to a real-time thread)
loadrt thtreads
addf hm2_5i25.0.read thread1
addf hm2_5i25.0.write thread1
start
show pin
(I am guessing the next pin name, but it will appear in the list created by the command above, and you can use tab-completion to do most of the typing)
setp hm2_5i25.0.led.cr0 1
Should turn an LED on
setp hm2_5i25.0.led.cr0 0
Should turn it off


I played with the two leds first.

Now I would like to read a home limit switch. I read from the 7i77 manual that I have to wire my switch to power field and to an input terminal of the 7i77, I am ready to do this.

Keeping andypugh hal instructions here above, is "addf hm2_5i25.0.read thread1 " suitable to read such a home limit switch input in case of a 7i77 ?

My plan is to observe from Halscope the changing state when toggling the switch.

Thank you for help.

My machine rebuilt can be seen at : here
Last edit: 20 Nov 2018 14:12 by JC10. Reason: Typo

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

More
20 Nov 2018 15:09 - 20 Nov 2018 15:09 #121062 by andypugh
Yes, you need to load the driver and add the read function to a thread.

To monitor the output you might like to try:
loadusr halmeter

(you can repeat this command to open as many halmeters as you need).

To test outputs (which need the write function added to a thread) you can either use "setp" as you did with the LEDs or
loadusr sim_pin hm2_5i25.0.gpio.00-out
linuxcnc.org/docs/2.7/html/man/man1/sim_pin.1.html
Last edit: 20 Nov 2018 15:09 by andypugh.

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

More
20 Nov 2018 20:57 #121087 by JC10
Thank you Andy it worked like a charm.

Here the short shooting link : Here

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

Moderators: PCWjmelson
Time to create page: 0.178 seconds
Powered by Kunena Forum