How do i use the NOT component ?

More
26 Dec 2020 13:58 #193230 by Markyd
I am trying to invert xdir (and Y and Z) using NOT. I have to use NOT as invert isn't available in the GPIO_PI_HAL component. Problem is I don't know what I'm doing, the instructions don't seem to have many example and searching NOT finds plenty but not related to NOT. I've included below my best guess with some comments as to what I think is happening;

#load the component
loadrt not

#start an instance of not ??
#not.0 is already used in the sample HAL file that I've started with (for a probe that i'm not using)
addf not.1 servo-thread

#create a signal called notxdir for the purposes of inverting stepgen.0.dir. Not really sure i need to do this?
net notxdir stepgen.0.dir not.1.in

#then create the xdir signal taking the output of not.1 and send it to pin-24 ???
net xdir not.1.out hal_pi_gpio.pin-24-out

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

More
More
26 Dec 2020 16:19 #193239 by Markyd
That thread seems to conclude by using 'invert' which doesn't work with GPIO_PI_HAL.

setp parport.0.pin-08-out-invert true
net xenable => parport.0.pin-08-out

Using NOT gets a mention but the syntax doesn't look correct (???? there's not net or addf on the second line) and i don't think anyone pursued it.

net xenable => not.0.in
not.0.out => parport.0.pin-08-out

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

More
26 Dec 2020 16:24 #193240 by Aciera
Maybe best to post your hal file.

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

More
26 Dec 2020 16:31 #193241 by Markyd
I think i just made it work

addf not.1 servo-thread
net xenable not.1.in
net x-not-enable not.1.out => hal_pi_gpio.pin-29-out
The following user(s) said Thank You: tommylight

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

More
26 Dec 2020 17:36 #193242 by tommylight
Nice, you were on the right path, but i was to busy to test it. Sorry.
Glad it works..
Thinking a bit it was about RPI right?
The following user(s) said Thank You: Markyd

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

More
26 Dec 2020 18:37 #193246 by Markyd
yes, RPI4 using the GPIO. Of course the X and Y didn't actually need reversing after all that. I was pressing left on the keyboard and the table moved right, but I now think that is correct (cutting tool moves left relative to work piece) ?

I needed to reverse the enable pin and the Z axis anyway, so nothing lost.

I'll switch from the GPIO to a MESA 7i96 at some point soon, just want to make some chips before spending more money.

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

More
27 Dec 2020 03:26 #193262 by Aciera
Yes, by convention direction is that of tool motion relative to work piece.
The following user(s) said Thank You: Markyd

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

More
27 Dec 2020 11:44 #193290 by snowgoer540
Correct me if I'm wrong, but to invert an axis direction, cant you just change the step_scale and add a negative sign?

example:
STEP_SCALE = 5000

to
STEP_SCALE = -5000

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

More
29 Dec 2020 16:16 #193432 by Todd Zuercher
One thing you need to be aware of and possibly be careful with when using a hal component like "not" is that the order your hal components are addf-ed to the threads determines the order which they are processed. If your components are processed in a bad order it can add a thread cycle or two delay in response to an input or output.
The following user(s) said Thank You: snowgoer540

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

Time to create page: 0.131 seconds
Powered by Kunena Forum