My code is not fast enough, i don't know why
- Duongtantai8624
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 4
24 Jul 2020 12:08 - 24 Jul 2020 12:12 #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
This is my setup, i want to stop the motor in exact position
Attachments:
Last edit: 24 Jul 2020 12:12 by Duongtantai8624.
Please Log in or Create an account to join the conversation.
- tommylight
- Online
- Moderator
Less
More
- Posts: 19200
- Thank you received: 6436
24 Jul 2020 12:46 #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
The following user(s) said Thank You: Duongtantai8624
Please Log in or Create an account to join the conversation.
- Duongtantai8624
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 4
24 Jul 2020 13:01 - 24 Jul 2020 13:02 #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.
Last edit: 24 Jul 2020 13:02 by Duongtantai8624.
Please Log in or Create an account to join the conversation.
- tommylight
- Online
- Moderator
Less
More
- Posts: 19200
- Thank you received: 6436
24 Jul 2020 13:14 #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
The following user(s) said Thank You: Duongtantai8624
Please Log in or Create an account to join the conversation.
24 Jul 2020 13:21 #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
The following user(s) said Thank You: Duongtantai8624
Please Log in or Create an account to join the conversation.
- Duongtantai8624
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 4
25 Jul 2020 09:43 - 25 Jul 2020 10:30 #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
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.
M64 P1
o100 while [#1 NE 0]
#1 = #<_hal[motion.digital-in-01]
o100 endwhile
M65 P1
Please show me what im doing wrong
Last edit: 25 Jul 2020 10:30 by Duongtantai8624.
Please Log in or Create an account to join the conversation.
25 Jul 2020 14:14 - 25 Jul 2020 14:14 #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.
Last edit: 25 Jul 2020 14:14 by PCW.
The following user(s) said Thank You: thefabricator03
Please Log in or Create an account to join the conversation.
Time to create page: 0.093 seconds