First Time Help

More
30 Jun 2011 15:23 #11007 by Todd Zuercher
Replied by Todd Zuercher on topic Re:First Time Help
Yes I have and I am not seeing any changes in hal when depressing switches.

But I can see volt change when probing the connectors with a meter on the machine, while depressing the same switches.

It would appear the driver isn't really connecting with the card.

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

More
30 Jun 2011 16:00 #11009 by andypugh
Replied by andypugh on topic Re:First Time Help
Todd Zuercher wrote:

t would appear the driver isn't really connecting with the card.

Well, yes. The question is "why"?

I checked that the 8-bit registers were actually being set correctly. Have you checked the outputs with a multimeter?

I couldn't check the "read" half of the driver without having the hardware. It contains a stupid copy-paste error.
FUNCTION(read){
    unsigned char R0, R1, R2, R3;
    int i;
    R0 = inb(base_addr);
    R1 = inb(base_addr + 1);
    R2 = inb(base_addr + 2);
    R3 = inb(base_addr + 3);
    for (i = 0;i <= 7;i++){
        pin_in(i) = R1 && (1 << i);
        pin_in(i+8) = R2 && (1 << i);
        pin_in(i+16) = R2 && (1 << i);
        pin_in(i+24) = R2 && (1 << i);
    }
}
Should read
FUNCTION(read){
    unsigned char R0, R1, R2, R3;
    int i;
    R0 = inb(base_addr);
    R1 = inb(base_addr + 1);
    R2 = inb(base_addr + 2);
    R3 = inb(base_addr + 3);
    for (i = 0;i <= 7;i++){
        pin_in(i) = R0 && (1 << i);
        pin_in(i+8) = R1 && (1 << i);
        pin_in(i+16) = R2 && (1 << i);
        pin_in(i+24) = R3 && (1 << i);
    }
}
However, I don't think it is the cause of the problem, as the 0x301 address is the only correct one.


You could try adding the following lines near the beginning in the pin declarations, to see if the raw byte reads are working:
pin out unsigned R0-pin;
pin out  unsigned R1-pin;
pin out unsigned  R2-pin;
pin out unsigned R3-pin;

then in the "read" function after the inb() commands
R0_pin = R0;
R1_pin = R1;
R2_pin = R2;
R3_pin = R3;

(note that there is a deliberate substitution of "-" for "_" between the pin names and the associated C variables)

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

More
30 Jun 2011 16:21 #11010 by Todd Zuercher
Replied by Todd Zuercher on topic Re:First Time Help
This error, I need to fix the comp file and rerun it?

The other suggestions. Are these things that I should put in the Hal file?

I am feeling a lot of pressure from higher up right now. The machine has been down for a month. They are pushing me to give up and buy the manufacturers upgrade for the control for $3100. (seems kind of steep for just a PC with a $1400 software package).

It just seems so tantilizinly simple to write to x address, read another. but no, nothing is ever that simple.

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

More
30 Jun 2011 17:44 #11015 by Todd Zuercher
Replied by Todd Zuercher on topic Re:First Time Help
when I try to do halrun I get this:

halrun
insmod: error inserting '/usr/realtime-2.6.32-122-rtai/modules/rtai_hal.ko': -1 File exists
halcmd:
halcmd: exit
ERROR: Module pcl720 does not exist in /proc/modules
<commandline>:0: exit value: 1
<commandline>:0: rmmod failed, returned -1
<commandline>:0: unloadrt failed
ERROR: Module hal_lib is in use by pcl720_729c93108560bb40a3698e5d113e2951
ERROR: Module rtapi is in use by pcl720_729c93108560bb40a3698e5d113e2951,hal_lib
ERROR: Module rtai_math does not exist in /proc/modules
ERROR: Module rtai_sem is in use by rtapi
ERROR: Module rtai_fifos is in use by rtapi
ERROR: Module rtai_sched is in use by rtapi,rtai_sem,rtai_fifos
ERROR: Module rtai_hal is in use by rtapi,rtai_sem,rtai_fifos,rtai_sched
digital6@digital6-desktop:~$

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

More
30 Jun 2011 17:46 #11016 by BigJohnT
Replied by BigJohnT on topic Re:First Time Help
Do halrun -U to unload an aborted hal and notice it is a capitol U.

John

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

More
30 Jun 2011 18:04 #11018 by andypugh
Replied by andypugh on topic Re:First Time Help
I have found that halrun -U almost never works…

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

More
30 Jun 2011 18:21 #11019 by Todd Zuercher
Replied by Todd Zuercher on topic Re:First Time Help
Ok I restarted the PC, ran comp, then in halrun I now get this.

digital6@digital6-desktop:~$ halrun
halcmd: loadrt pcl720 ioaddr=0x2A0
halcmd: addf pcl720.0.write base-thread
HAL: ERROR: thread 'base-thread' not found
<stdin>:2: addf failed
halcmd:

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

More
30 Jun 2011 18:29 #11020 by andypugh
Replied by andypugh on topic Re:First Time Help
loadrt threads
show thread
addf pcl720.0.write thread1
addf pcl720.read thread1
start
show funct
show pin
etc….

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

More
30 Jun 2011 19:15 #11025 by andypugh
Replied by andypugh on topic Re:First Time Help
It looks like you need to find Pidgin in the Software Centre at the bottom of Applications.
There is an online client on this website here:
www.linuxcnc.org/component/option,com_mo...emid,8/lang,english/
but be warned that you get logged out if you navigate away from the page, so open another window/tab

However, somebody else on IRC spotted a serious error in that last bit of code.
the outb() command is (value, address) and I had (address, value).

The attached file might work better.

File Attachment:

File Name: pcl720.comp
File Size:2 KB
Attachments:

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

More
30 Jun 2011 19:33 #11026 by Todd Zuercher
Replied by Todd Zuercher on topic Re:First Time Help
wo hoo! I am getting a change on the show pin readout now when I depress a limit switch.

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

Time to create page: 0.103 seconds
Powered by Kunena Forum