- Posts: 19306
- Thank you received: 0
Pokeys_homecomp EncoderSearch / Encoder Arm Topic: Pos_Fb Following errors
7 years 10 months ago #122004
by andypugh
You can keep choosing the option and open several.
Other GUIs get it in other ways, except for Touchy where you need to open a terminal and type "halcmd loadusr halmeter" (and that works on all GUIs and none)#
It might just be that "show pin" uses up a couple of mS of CPU timeErikcnc wrote: I could try to remove 'show pin' and check if its realy that issue.
No, they are optional, for human legibility.Another thing, those arrows are they have a function? Does it make a difirents how you insert them? ( <= or => )
Halmeter (From the "Machine" menu in Axis) will show you the value of a HAL pin or parameter.About those potentiometers, i set them as analog input with the pokeys software.
I have to check how i can see values insted of I/0 dots.
You can keep choosing the option and open several.
Other GUIs get it in other ways, except for Touchy where you need to open a terminal and type "halcmd loadusr halmeter" (and that works on all GUIs and none)#
Please Log in to join the conversation.
7 years 10 months ago #122133
by Erikcnc
So i checkt if there was a value i can read.
The issue is that the pin i use (45, 46, and 47) are bit type. So, i see that they are constand TRUE.
I set these pins in Pokeys software as analog.
In linuxcnc they have to be a FLOAT type output. How can i change this?
The issue is that the pin i use (45, 46, and 47) are bit type. So, i see that they are constand TRUE.
I set these pins in Pokeys software as analog.
In linuxcnc they have to be a FLOAT type output. How can i change this?
Please Log in to join the conversation.
7 years 10 months ago #122134
by andypugh
You should see some pins called "ain"
something like pokeys.0.ain-0
They are unsigned int rather than float, to convert to float you would need to convert to float then scale them.
If I was doing it I would modify the HAL component to output scaled float.
change the line above to
And add
Then change this
to
Code:
pin out unsigned ain-# [3];
something like pokeys.0.ain-0
They are unsigned int rather than float, to convert to float you would need to convert to float then scale them.
If I was doing it I would modify the HAL component to output scaled float.
change the line above to
Code:
pin out float ain-# [3];
Code:
pin in float analog-scale-# [3];
Then change this
Code:
for(i=0;i<3;i++)ain(i)=dev->Pins[i+44].AnalogValue;
Code:
for(i=0;i<3;i++)ain(i)=(dev->Pins[i+44].AnalogValue * analog_scale(i)) /4096.0 ;
Please Log in to join the conversation.
7 years 9 months ago #124681
by Erikcnc
Hi Andy,
After some other projects i would like to give this another try.
so, i understanding that the comp file should look like this.
does this looks correct?
After some other projects i would like to give this another try.
so, i understanding that the comp file should look like this.
Code:
component pokeys "PoKeys IO driver, by Mit Zot";
option userspace yes;
pin out bit in-# [55];
pin out fload ain-# [3];
pin out bit err;
pin in unsigned devSerial;
pin out bit alive;
pin in float analog-scale-# [3];
license "GPL";
;;
#include "PoKeysLib.h"
#include <unistd.h> /* UNIX standard function definitions */
sPoKeysDevice * dev=0;
int i=0;
void user_mainloop(void)
{
while(0xb){
FOR_ALL_INSTS() {
while(dev == NULL)dev = PK_ConnectToDeviceWSerial(devSerial, 38163); //waits for usb device
alive=1;
if ((PK_DigitalIOGet(dev) == PK_OK) && (PK_AnalogIOGet(dev) == PK_OK)){ //gets IO data and checks return value
err=0;
for(i=0;i<54;i++)in(i)=!dev->Pins[i].DigitalValueGet; //just transfers values
for(i=0;i<3;i++)ain(i)=dev->Pins[i+44].AnalogValue * analog_scale(i)) /4096.0 ;
}
else{ //on connection error
PK_DisconnectDevice(dev);
dev=NULL; //tries to reconnect
err=1;
for(i=0;i<54;i++)in(i)=0;
for(i=0;i<3;i++)ain(i)=0;
}
alive=0;
usleep(40000);
}
}
exit(0);
}
does this looks correct?
Please Log in to join the conversation.
7 years 1 week ago #148549
by xaxxes
Hello.
I've modified the pokeys.comp from the first post to use the pins as outputs (for LEDs). With LinuxCNC I can set the outputs HIGH and LOW but the output on the PoKeys-board (PoKeys56U) does not work. (With the PoKey software for windows the output works fine.)
I added the follwing lines:
pin in bit out-# [55];
for(i=0;i<55;i++)dev->Pins.DigitalValueSet=out(i);
PK_DigitalIOSet(dev);
pokeys.comp
What is wrong/missing?
thanks
I've modified the pokeys.comp from the first post to use the pins as outputs (for LEDs). With LinuxCNC I can set the outputs HIGH and LOW but the output on the PoKeys-board (PoKeys56U) does not work. (With the PoKey software for windows the output works fine.)
I added the follwing lines:
pin in bit out-# [55];
for(i=0;i<55;i++)dev->Pins.DigitalValueSet=out(i);
PK_DigitalIOSet(dev);
pokeys.comp
Code:
component pokeys "PoKeys IO driver, by Mit Zot";
option userspace yes;
pin out bit in-# [55];
pin out unsigned ain-# [3];
pin out bit err;
pin in bit out-# [55];
pin in unsigned devSerial;
pin out bit alive;
license "GPL";
;;
#include "PoKeysLib.h"
#include <unistd.h> /* UNIX standard function definitions */
sPoKeysDevice * dev=0;
int i=0;
void user_mainloop(void)
{
while(0xb){
FOR_ALL_INSTS() {
while(dev == NULL)dev = PK_ConnectToDeviceWSerial(devSerial, 2000); //waits for usb device
alive=1;
if ((PK_DigitalIOGet(dev) == PK_OK) && (PK_AnalogIOGet(dev) == PK_OK)){ //gets IO data and checks return value
err=0;
for(i=0;i<54;i++)in(i)=!dev->Pins[i].DigitalValueGet; //just transfers values
for(i=0;i<54;i++)dev->Pins[i].DigitalValueSet=out(i);
PK_DigitalIOSet(dev);
for(i=0;i<3;i++)ain(i)=dev->Pins[i+44].AnalogValue;
}
else{ //on connection error
PK_DisconnectDevice(dev);
dev=NULL; //tries to reconnect
err=1;
for(i=0;i<54;i++)in(i)=0;
for(i=0;i<3;i++)ain(i)=0;
}
alive=0;
usleep(40000);
}
}
exit(0);
}
What is wrong/missing?
thanks
Please Log in to join the conversation.
7 years 3 days ago #148868
by xaxxes
Hi. I get one error. But this error i also get with the pokeys.comp from the first post
error:
Thank you
error:
Code:
In file included from ./pokeys.comp:16:0:
./PoKeysLib.h:65:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning(disable:4996)
Thank you
Please Log in to join the conversation.
6 years 6 months ago #162762
by KRAD-AT
Replied by KRAD-AT on topic Problem after compiling pokeys.comp
Hello,
I am trying to get a pokeys 57e to work as my bob.
I have set up a linux mint with a master branch of linuxcnc and i am tryling to make the component for pokeys.
I am following the instructions in the first post of this topic and it works including the halcompile.
But the next step does not work:
I have no Idea what to do next. Can anyone help me?
Thank you!
I am trying to get a pokeys 57e to work as my bob.
I have set up a linux mint with a master branch of linuxcnc and i am tryling to make the component for pokeys.
I am following the instructions in the first post of this topic and it works including the halcompile.
But the next step does not work:
Code:
gcc -Wall -Os -g -I. -I/usr/include/libusb-1.0 -I/usr/include -L/usr/lib/ -L/usr/lib/arm-linux-gnueabihf/ -lPoKeys -lusb-1.0 -I/usr/realtime-3.4-9-rtai-686-pae/include -I. -I/usr/realtime-3.4-9-rtai-686-pae/include -I/usr/include/i386-linux-gnu -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -fno-math-errno -funsafe-math-optimizations -fno-rounding-math -fno-signaling-nans -fcx-limited-range -mhard-float -DRTAI=3 -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -Wframe-larger-than=2560 -URTAPI -U__MODULE__ -DULAPI -Os -o pokeys ./pokeys.c -Wl,-rpath,/lib -L/lib -llinuxcnchal
I have no Idea what to do next. Can anyone help me?
Thank you!
Attachment not found
Please Log in to join the conversation.
Time to create page: 0.195 seconds
