issues with cio dio24h board

More
10 Aug 2011 23:33 #12389 by patburden
I am trying to find some info on how to get my EMC2 software to comunicate through a cio dio 24h board.
As I understand it I have to write or modify a driver for Ubuntu and even then It will not work properly with HAL.
I found an adapter cable online that wil fit the db37 port on my servo board and will connect directly to my db25 parallel port on the back of my computer.
My question is
Has anyone tried one of these Adapter cables? And if so did they have any luck?

Any info or links would be helpful.

THANKS!
Attachments:

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

More
11 Aug 2011 00:36 #12392 by andypugh
Need more info.

Do you have a link to a spec of the board you want to use?
What is it, what does it do?

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

More
11 Aug 2011 01:35 #12395 by btvpimill
Is this the board? If so, it looks like an ISA card from the picture.
www.piclist.com/techref/microchip/debouncebeeptoggleK8HL.htm

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

More
11 Aug 2011 02:05 #12396 by patburden
Thanks for the help.
Here is a link to the DIO CIO 24H Board I am hoping to by pass.

mccdaq.bentech-taiwan.com/mcc/manual/cio-dio24h.pdf

It is connected to the "386 RELAY BOARD" via a DB37 cable
below is a diagram of the "386 Relay Board"
I haven't been able to find anything on this Relay Board online. YET!
I am still looking.
Attachments:

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

More
11 Aug 2011 02:13 #12397 by patburden
No sir
here is a pictre of the board i hope to by pass.
I hope to connect to the parallel port to my 386 relay board
Attachments:

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

More
11 Aug 2011 02:57 #12398 by btvpimill
Not wanting to be the bearer of bad news, but I think you have some pretty significent hardware to be able to omit the interface card. I hope to be wrong and corrected, but here goes.

first issue is this: from the parallel port you can only get 12 outputs when using it without any interface card attached. so you will need to decide which of the other 12 functions on your relay board you are not going to use.

next problem, the signals from the port are only TTL (I think) at best. So you will need to be VERY sure the load needed to drive the stuff on the card you are connecting it to.

third issue: seeing as there is poewr connections in the cable listed in the manual, I am guessing the card you want to use gets power from the interface card you want to bypass. The parallel port has no power connections.

Having said all this, if you can live with the first issue, and the second issue is a non-issue. assuming you can provide the power to the card, this can be very easy from EMC's point of view. Just set it up with a HAL config file to define the output pins as you need them.

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

More
11 Aug 2011 10:25 #12400 by andypugh
I think it probably makes sense to keep the board.

Having read the info here:
www.mccdaq.com/registermaps/RegMapCIO-DIO24-Series.pdf

It seems very likely that minor changes to the driver written in this thread:
www.linuxcnc.org/component/option,com_ku...imit,6/limitstart,0/
will allow HAL to control your existing hardware.

In fact, I have a feeling that that driver will drive your card completely unmodified.

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

More
11 Aug 2011 10:38 #12401 by andypugh
Actually, I don't think that thread has the latest version of the driver.

Here it is
component pcl720 """Driver for the Advantech PCL 720 card.""";
description """This driver supports the Advantech PCL720 ISA card. It might
work with the PCI version too, but this is untested.
 It creates hal pins corresonding to the digital inputs and outputs, but does
not support the the counters/timers.""";

pin in bit pin-##-out[32] "Output pins";
pin out bit pin-##-in[32] "Input pins";
pin out bit pin-##-in-not[32] "Inverted version of each input pin";
param rw unsigned reset-time = 5000 """The time in nanoseconds after the write function
has run to reset the pins for which the "reset" parameter is set.""";
param rw bit pin-##-reset[32] """specifies if the pin should be reset by the "reset"
function""";
param rw bit pin-##-out-invert[32] "Set to true to invert the sense of the output pin";

pin out  unsigned wait_clocks;

function read nofp "Reads each of the digital inputs and updates the HAL pins";
function write nofp "Writes the values of the output HAL pins to the digital IO";
function reset nofp """Waits for the length of time specified by the
\fBbreset-time\fP parameter and resets any pins for which the \fBreset\fP
parameter has been set. This can be used to allow step generators to make a step
every thread rather than every other thread. This function must be added to the
thread after the "write" function.
 Do not use this function if you do not wish to reset any pins.
 the stepgen \fBstep-space\fP parameter should be set to 0 to make use of this
function.""";

variable unsigned base_addr;

variable unsigned out; // write data
variable unsigned inv; // Invert masks
variable unsigned res; // Reset mask

variable u64 write_time;

option count_function yes;
option extra_setup yes;

modparam dummy ioaddr """Base address of card. Separate each card base address
with a comma but no space to load more than one card. eg
loadrt pcl720 ioaddr=0x200,0x200. use 0xNNN to define addresses in Hex""";

license "GPL";
author "Andy Pugh";
;;

#include <asm/io.h>
#define MAX_CHAN 8

static int ioaddr[MAX_CHAN] = {-1, -1, -1, -1, -1, -1, -1, -1};
RTAPI_MP_ARRAY_INT(ioaddr, MAX_CHAN, "Base addresses")

FUNCTION(read){
    unsigned R;
    int i;
    R =   inb(base_addr)
        + (inb(base_addr + 1) << 8)
        + (inb(base_addr + 2) << 16)
        + (inb(base_addr + 3) << 24);

    for (i = 0;i <= 31;i++){
        pin_in(i) = R & (1 << i);
        pin_in_not(i) = ~pin_in(i);
    }
}

FUNCTION(write){
    int i;
    unsigned char b;
    out = 0;
    inv = 0;
    for (i = 0;i <= 31 ;i++){
        out |= pin_out(i) << i;
        inv |= pin_out_invert(i) << i;
    }

    out ^= inv;

    b = (out & 0xff);
    outb(b, base_addr);
    b = (out & 0xff00) >> 8;
    outb(b, base_addr + 1);
    b = (out & 0xff0000) >> 16;
    outb(b, base_addr + 2);
    b = (out & 0xff000000) >> 24;
    outb(b, base_addr + 3);

    write_time = rtapi_get_time();
}

FUNCTION(reset){
    long long deadline;
    int i;
    unsigned tmp;
    unsigned char b;

    res= 0;
    for (i = 0;i <= 31  ;i++){
        res |= pin_reset(i) << i;
    }

    if (res == 0) {return;} // no pins with reset set

    tmp = (out ^ inv) & (~res);
    if (tmp == out) {return;} // nothing to reset

    if(reset_time > period/4) reset_time = period/4;

    //compensate for any time elapsed since the write
    rtapi_delay(reset_time - (rtapi_get_time() - write_time));

    b = (tmp & 0xff);
    outb(b, base_addr);
    b = (tmp & 0xff00) >> 8;
    outb(b, base_addr + 1);
    b = (tmp & 0xff0000) >> 16;
    outb(b, base_addr + 2);
    b = (tmp & 0xff000000) >> 24;
    outb(b, base_addr + 3);

    out = tmp;
}


EXTRA_SETUP(){

    if (ioaddr[extra_arg] > 0) {
        base_addr = ioaddr[extra_arg];
        rtapi_print("Loading Advantech pcl720 driver at base addr %X\n", base_addr);
        return 0;
    }
    return -EINVAL;
}


int get_count(void){
    int i;
    for (i=0; ioaddr[i] > 0 && i < MAX_CHAN; i++){}
    return i;
}

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

More
11 Aug 2011 11:38 #12405 by patburden
Thanks For the help!!!!
This info Really boosted my confidence that my old mill will live again.
I will give it a try and report back.
I know there are several people out there with these old
ROBOTOOL CVM1 mills with no software, who will be interested.

THANKS AGAIN!!

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

More
17 Aug 2011 22:05 #12554 by patburden
Evidently I am doing something wrong.
when I typed sudo comp --install pcl720.c
I got this

make -C /usr/src/linux-headers-2.6.24-16-rtai SUBDIRS=`pwd` CC=gcc V=0 -o /Module.symvers modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.24-16-rtai'
CC [M] /tmp/tmpi3_kWp/pcl720.o
/tmp/tmpi3_kWp/pcl720.c:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pcl720’
/tmp/tmpi3_kWp/pcl720.c:2:15: warning: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:2: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before string constant
/tmp/tmpi3_kWp/pcl720.c:2: error: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:5:39: warning: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:5: error: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:7: error: stray ‘##’ in program
/tmp/tmpi3_kWp/pcl720.c:8: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘out’
/tmp/tmpi3_kWp/pcl720.c:8: error: stray ‘##’ in program
/tmp/tmpi3_kWp/pcl720.c:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘out’
/tmp/tmpi3_kWp/pcl720.c:9: error: stray ‘##’ in program
/tmp/tmpi3_kWp/pcl720.c:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rw’
/tmp/tmpi3_kWp/pcl720.c:10:39: warning: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:10: error: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:11:68: warning: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:11: error: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:12: error: stray ‘##’ in program
/tmp/tmpi3_kWp/pcl720.c:12:84: warning: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:12: error: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:13:11: warning: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:13: error: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:14: error: stray ‘##’ in program
/tmp/tmpi3_kWp/pcl720.c:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘out’
/tmp/tmpi3_kWp/pcl720.c:18: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘read’
/tmp/tmpi3_kWp/pcl720.c:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘write’
/tmp/tmpi3_kWp/pcl720.c:20: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘reset’
/tmp/tmpi3_kWp/pcl720.c:20:23: warning: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:20: error: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:21: error: stray ‘\’ in program
/tmp/tmpi3_kWp/pcl720.c:21: error: stray ‘\’ in program
/tmp/tmpi3_kWp/pcl720.c:21: error: stray ‘\’ in program
/tmp/tmpi3_kWp/pcl720.c:21: error: stray ‘\’ in program
/tmp/tmpi3_kWp/pcl720.c:26: error: stray ‘\’ in program
/tmp/tmpi3_kWp/pcl720.c:26: error: stray ‘\’ in program
/tmp/tmpi3_kWp/pcl720.c:27:12: warning: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:27: error: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:31: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘unsigned’
/tmp/tmpi3_kWp/pcl720.c:32: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘unsigned’
/tmp/tmpi3_kWp/pcl720.c:33: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘unsigned’
/tmp/tmpi3_kWp/pcl720.c:35: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘u64’
/tmp/tmpi3_kWp/pcl720.c:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘count_function’
/tmp/tmpi3_kWp/pcl720.c:38: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘extra_setup’
/tmp/tmpi3_kWp/pcl720.c:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘dummy’
/tmp/tmpi3_kWp/pcl720.c:40:25: warning: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:40: error: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:42:28: error: hexadecimal floating constants require an exponent
/tmp/tmpi3_kWp/pcl720.c:42:39: error: invalid suffix "xNNN" on integer constant
/tmp/tmpi3_kWp/pcl720.c:42:73: warning: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:42: error: missing terminating " character
/tmp/tmpi3_kWp/pcl720.c:45: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before string constant
/tmp/tmpi3_kWp/pcl720.c:52: error: expected ‘)’ before numeric constant
/tmp/tmpi3_kWp/pcl720.c:68: warning: return type defaults to ‘int’
/tmp/tmpi3_kWp/pcl720.c:68: warning: function declaration isn’t a prototype
/tmp/tmpi3_kWp/pcl720.c: In function ‘FUNCTION’:
/tmp/tmpi3_kWp/pcl720.c:71: error: ‘out’ undeclared (first use in this function)
/tmp/tmpi3_kWp/pcl720.c:71: error: (Each undeclared identifier is reported only once
/tmp/tmpi3_kWp/pcl720.c:71: error: for each function it appears in.)
/tmp/tmpi3_kWp/pcl720.c:72: error: ‘inv’ undeclared (first use in this function)
/tmp/tmpi3_kWp/pcl720.c:74: error: implicit declaration of function ‘pin_out’
/tmp/tmpi3_kWp/pcl720.c:75: error: implicit declaration of function ‘pin_out_invert’
/tmp/tmpi3_kWp/pcl720.c:81: error: ‘base_addr’ undeclared (first use in this function)
/tmp/tmpi3_kWp/pcl720.c:89: error: ‘write_time’ undeclared (first use in this function)
/tmp/tmpi3_kWp/pcl720.c:89: error: implicit declaration of function ‘rtapi_get_time’
/tmp/tmpi3_kWp/pcl720.c: At top level:
/tmp/tmpi3_kWp/pcl720.c:92: warning: return type defaults to ‘int’
/tmp/tmpi3_kWp/pcl720.c:92: warning: function declaration isn’t a prototype
/tmp/tmpi3_kWp/pcl720.c:92: error: redefinition of ‘FUNCTION’
/tmp/tmpi3_kWp/pcl720.c:68: error: previous definition of ‘FUNCTION’ was here
/tmp/tmpi3_kWp/pcl720.c: In function ‘FUNCTION’:
/tmp/tmpi3_kWp/pcl720.c:98: error: ‘res’ undeclared (first use in this function)
/tmp/tmpi3_kWp/pcl720.c:100: error: implicit declaration of function ‘pin_reset’
/tmp/tmpi3_kWp/pcl720.c:103: warning: ‘return’ with no value, in function returning non-void
/tmp/tmpi3_kWp/pcl720.c:105: error: ‘out’ undeclared (first use in this function)
/tmp/tmpi3_kWp/pcl720.c:105: error: ‘inv’ undeclared (first use in this function)
/tmp/tmpi3_kWp/pcl720.c:106: warning: ‘return’ with no value, in function returning non-void
/tmp/tmpi3_kWp/pcl720.c:108: error: ‘reset_time’ undeclared (first use in this function)
/tmp/tmpi3_kWp/pcl720.c:108: error: ‘period’ undeclared (first use in this function)
/tmp/tmpi3_kWp/pcl720.c:111: error: implicit declaration of function ‘rtapi_delay’
/tmp/tmpi3_kWp/pcl720.c:111: error: ‘write_time’ undeclared (first use in this function)
/tmp/tmpi3_kWp/pcl720.c:114: error: ‘base_addr’ undeclared (first use in this function)
/tmp/tmpi3_kWp/pcl720.c:93: warning: unused variable ‘deadline’
/tmp/tmpi3_kWp/pcl720.c: At top level:
/tmp/tmpi3_kWp/pcl720.c:126: warning: return type defaults to ‘int’
/tmp/tmpi3_kWp/pcl720.c:126: warning: function declaration isn’t a prototype
/tmp/tmpi3_kWp/pcl720.c: In function ‘EXTRA_SETUP’:
/tmp/tmpi3_kWp/pcl720.c:128: error: ‘extra_arg’ undeclared (first use in this function)
/tmp/tmpi3_kWp/pcl720.c:129: error: ‘base_addr’ undeclared (first use in this function)
/tmp/tmpi3_kWp/pcl720.c:130: error: implicit declaration of function ‘rtapi_print’
make[2]: *** [/tmp/tmpi3_kWp/pcl720.o] Error 1
make[1]: *** [_module_/tmp/tmpi3_kWp] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.24-16-rtai'
make: *** [modules] Error 2

My question is
Where can I find out "where to and how I should copy this driver"
and also "Where can I find Info on how to "Create" a Hal file

I am completely new to linux and am slowly learning
THANKS

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

Moderators: PCWjmelson
Time to create page: 0.092 seconds
Powered by Kunena Forum