- Posts: 15
- Thank you received: 0
My code is not fast enough, i don't know why
- Duongtantai8624
- Topic Author
- Offline
- New Member
-
Less
More
6 years 3 months ago #175622
by Duongtantai8624
My code is not fast enough, i don't know why was created by Duongtantai8624
Hi all
My code doesn't seems to catch the event in the right time
Here's the code
My halscope when execute the code, you can see it's not turn off the P1 output immediatly when P1 input was high
This is my setup, i want to stop the motor in exact position
My code doesn't seems to catch the event in the right time
Here's the code
o100 sub
M64 P1
M66 P1 L1 Q5
#1 = #5399
o101 if [#1 NE -1]
M65 P1
o101 endif
o100 endsub
My halscope when execute the code, you can see it's not turn off the P1 output immediatly when P1 input was high
Attachment not found
This is my setup, i want to stop the motor in exact position
Attachment not found
Please Log in to join the conversation.
- tommylight
-
- Offline
- Administrator
-
Less
More
- Posts: 22010
- Thank you received: 3
6 years 3 months ago #175623
by tommylight
Replied by tommylight on topic My code is not fast enough, i don't know why
-Might be the scope that is working at 1KHz, so to slow for capturing fast stuff,
-Might be a delay or debounce used in hal,
-Might be the wrong order of execution in the servo thread
Is that for a spindle orientation?
If yes, there is already a component included with LinuxCNC just for that:
linuxcnc.org/docs/html/man/man9/orient.9.html
-Might be a delay or debounce used in hal,
-Might be the wrong order of execution in the servo thread
Is that for a spindle orientation?
If yes, there is already a component included with LinuxCNC just for that:
linuxcnc.org/docs/html/man/man9/orient.9.html
Please Log in to join the conversation.
- Duongtantai8624
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 15
- Thank you received: 0
6 years 3 months ago #175627
by Duongtantai8624
Replied by Duongtantai8624 on topic My code is not fast enough, i don't know why
This motor for spin ATC wheel, it's took about 2 second for each round.
i'll check my hal file debounce.
i'll check my hal file debounce.
Please Log in to join the conversation.
- tommylight
-
- Offline
- Administrator
-
Less
More
- Posts: 22010
- Thank you received: 3
6 years 3 months ago #175630
by tommylight
Replied by tommylight on topic My code is not fast enough, i don't know why
In that case :
linuxcnc.org/docs/html/man/man9/carousel.9.html
linuxcnc.org/docs/html/man/man9/carousel.9.html
Please Log in to join the conversation.
6 years 3 months ago #175631
by PCW
Replied by PCW on topic My code is not fast enough, i don't know why
M66 is not real time, from the Linux M code reference:
linuxcnc.org/docs/html/gcode/m-code.html#mcode:m66
For real time your stop should be implemented in hal
In LinuxCNC these inputs are not monitored in real time and thus should not be used for timing-critical applications.
linuxcnc.org/docs/html/gcode/m-code.html#mcode:m66
For real time your stop should be implemented in hal
Please Log in to join the conversation.
- Duongtantai8624
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 15
- Thank you received: 0
6 years 3 months ago #175724
by Duongtantai8624
Replied by Duongtantai8624 on topic My code is not fast enough, i don't know why
Folow your reply i try to re config my hal file ,but it wont help, i guess i was misunderstood what you mean.
So i try to read hal pin with this test code. If digital pin input 01 = true, do M64 P1
The read hal pin code is working but i dont know how to use it to catch the event. I try this test code, this code i use to turn off P1 when digital input 01 = false. When i try this code, linuxcnc got crash, i have to reboot linuxcnc.
Please show me what im doing wrong
So i try to read hal pin with this test code. If digital pin input 01 = true, do M64 P1
Code:
o100 if [#<_hal[motion.digital-in-01]> NE 0]
M64 P1
o100 endif
The read hal pin code is working but i dont know how to use it to catch the event. I try this test code, this code i use to turn off P1 when digital input 01 = false. When i try this code, linuxcnc got crash, i have to reboot linuxcnc.
Code:
M64 P1
o100 while [#1 NE 0]
#1 = #<_hal[motion.digital-in-01]
o100 endwhile
M65 P1
Please show me what im doing wrong
Please Log in to join the conversation.
6 years 3 months ago #175744
by PCW
Replied by PCW on topic My code is not fast enough, i don't know why
For real time you need to accomplish this in hal with hal components, not gcode.
You can arm/enable the hal logic with M66, but the actual real time logic must be
implemented in hal.
You can arm/enable the hal logic with M66, but the actual real time logic must be
implemented in hal.
Please Log in to join the conversation.
Time to create page: 0.879 seconds
