Use data from the USB port

More
06 Jul 2021 09:19 #213836 by bierluiz
Hello,

I want to connect a datalogger to the PC which runs LinuxCNC. The connection is via USB.

Is there a way to send the data coming from the USB to the controller, making it available in HAL?
Any documentation about this? I couldn't find.

Thank you.  

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

More
06 Jul 2021 19:34 #213887 by mic
Replied by mic on topic Use data from the USB port
Hi,
USB-Connection is a very wide spec. As far as i know a general USB-Component for HAL is not available. Are there some details on the USB connection available (which Datalogger, spec of the connection)?
Probably you have to write your own component.

Here you can find some docs: linuxcnc.org/docs/html/hal/halmodule.html
 
The following user(s) said Thank You: bierluiz

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

More
06 Jul 2021 21:13 #213895 by tommylight
Pretty much everything related to serial and usb inside the LinuxCNC web site:
www.google.com/search?q=serial+usb+site%...l5DcIQ4dUDCAY&uact=5
The following user(s) said Thank You: bierluiz

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

More
06 Jul 2021 22:05 #213909 by andypugh
Replied by andypugh on topic Use data from the USB port

Is there a way to send the data coming from the USB to the controller, making it available in HAL?

 

If you create a user-space component then that can collect the USB data and make it available on HAL pins. 
You can use C or Python. Python is likely to be the easiest. 

Does the datalogger manufacturer provide any sample code? 

linuxcnc.org/docs/2.8/html/hal/halmodule.html
 
The following user(s) said Thank You: bierluiz

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

More
07 Jul 2021 22:06 - 07 Jul 2021 22:07 #213994 by bierluiz
Replied by bierluiz on topic Use data from the USB port
The datalogger is a National Instruments cDAQ-9172. It has USB-B 2.0 connection. I found the image attached on the manual, www.ni.com/pdf/manuals/371747f.pdf
Attachments:
Last edit: 07 Jul 2021 22:07 by bierluiz.

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

More
09 Jul 2021 11:40 #214078 by andypugh
Replied by andypugh on topic Use data from the USB port
NI Typically supply sample code with their cards.

Failing that, Google might help.

knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019Pf1SAE
The following user(s) said Thank You: bierluiz

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

More
15 Jul 2021 09:31 - 15 Jul 2021 09:45 #214824 by bierluiz
Replied by bierluiz on topic Use data from the USB port
I am trying to do the example (passthrough) to create userspace components, but no success.

I created a file and put in the same folder where the .ini file is.

I then added the command "loadusr passthrough" to one of the HAL files but it dispays the message "No such file or directory"

Does the file has to have a termination like ".py"?
Last edit: 15 Jul 2021 09:45 by bierluiz.

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

More
15 Jul 2021 10:05 #214831 by andypugh
Replied by andypugh on topic Use data from the USB port
Have you made the file executable?

(can you run it standalone from the command line. It will error-out without a shared memory layer to link to, this is just to check that the file is runnable)
In the same folder as the INI might not necessarily work. The docs are a bit cryptic when they say "in the $PATH", but you can probably see what that means with "echo $PATH" at the command-line.

I think that it means that the file needs to be where general executable files live.
You can try putting in in /usr/local/bin/linuxcnc (I think that folder exists) but youwill need to use sudo to do so. .
The following user(s) said Thank You: bierluiz

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

More
15 Jul 2021 10:44 #214836 by bierluiz
Replied by bierluiz on topic Use data from the USB port
Yes, I did make it executable (right click, properties, permissions, checked the box "autorize the execution of the file as a program").

I cannot run it from the terminal, it says that there is no file there.

Also, there is no "usr" or "local" folder to get to "bin". I think they have been renamed. Maybe that is the problem?

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

More
15 Jul 2021 11:02 #214838 by Aciera
Replied by Aciera on topic Use data from the USB port
what does this terminal command return?
echo $PATH

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

Time to create page: 0.157 seconds
Powered by Kunena Forum