LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org


This page is considered current as of August of 2008.
This driver is in EMC 2.3
1. The adapter card
2. The Driver

1. The adapter card

This is a card made by OPTO22 for adapting the PCI port to solid state relay racks such as their standard or G4 series.
It has 2 ports that can control up to 24 points each and has 4 on board LEDS.
The ports use 50 pin connectors the same as Mesa boards.
Any relay racks/breakout boards thats work with Mesa Cards should work with this card with the understanding
any encoder counters, pwm etc would have to be done in software- The AC5 does not have any 'smart' logic on board it just an adapter.
See the manufacturer's website for more info:
I would like to thank OPTO22 for releasing info in their manual,easing the writing of this driver!

2. The Driver

This driver is for the PCI ac5 card and will not work with the ISA ac5 card.
The HAL driver is a realtime module. It will support 4 cards as is (more cards are possible with a change in the source code).
Load the basic driver like so:

loadrt opto_ac5

This will load the driver which will search for max 4 boards.It will set i/o of each board's 2 ports to a default setting.
The default configuration is for 12 inputs then 12 outputs.
The pin name numbers correspond to the position on the relay rack. For example the pin names for the default i/o setting of port 0 would be:

They would be numbered from 00 to 11

They would be numbered 12 to 23
port 1 would be the same.

To change the default setting load the driver something like so:

loadrt opto_ac5 portconfig0=0xffff portconfig1=0xff0000

Of course changing the numbers to match the i/o you would like.
each port can be set up different (but for now any other opto PCI ac5 boards will have their ports configured the same as the first board. I will fix that if it comes up).
Heres how to figure out the number:
The configuration number represents a 32 bit long code to tell the card which i/o points are output vrs input.
The lower 24 bits are the i/o points of one port. The 2 highest bits are for 2 of the on board LEDS.
A one in any bit position makes the i/o point an output.
The two highest bits must be output for the LEDS to work.
The driver will automatically set the two highest bits for you, we won't talk about them.
The easiest way to do this is to fire up the calculator under APPLICATIONS/ACCESSORIES
Set it to scientific (click view). set it BINARY (radio button Bin)
Press 1 for every output you want and/or zero for every input.
Remember that HAL pin 00 corresponds to the rightmost bit.
24 numbers represent the 24 i/o points of one port.
So for the default setting (12 inputs then 12 outputs) you would push 1 twelve times (thats the outputs) then 0 twelve times (thats the inputs).
Notice the first i/0 point is the lowest (right most) bit. (that bit corresponds to HAL pin 00 .looks backwards)
You should have 24 digits on the screen. Now push the Hex radio button. The displayed number (fff000) is the configport number ( put a '0x' in front of it designating it a HEX number).

Another example :
to set the port for 8 outputs and 16 inputs (the same as a Mesa card).
Here is the 24 bits represented in a BINARY number.
Bit 1 is the rightmost number.


16 zeros for the 16 inputs
8 ones for the 8 outputs

Which converts to FF on the calculator so 0xff is the number to use for portconfig0 and/or portconfig1 when loading the driver.

Here's how the HAL pin numbering works:

HAL pin 00 corresponds to bit 1 (the rightmost) which represents position 0 on an opto22 relay rack.
HAL pin 01 corresponds to bit 2 (one spot to the left of the rightmost) which represents position 1 on an opto22 relay rack.
HAL pin 23 corresponds to bit 24 (the leftmost) which represents position 23 on an opto22 relay rack.

For the electrical connections:

Hal pin 00 connects to pin 47 on the 50 pin connector of each port.
Hal pin 01 connects to pin 45 on the 50 pin connector of each port.
Hal pin 23 connects to pin 1 on the 50 pin connector of each port.

Note that opto22 and Mesa use opposite numbering systems:
opto22 position 23 = connector pin 1.
and the position goes down as the connector pin number goes up
Mesa Hostmot4 position 1 = connector pin 1.
and the position number goes up as the connector pin number goes up

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited June 20, 2009 8:45 am by JeffEpler (diff)
Published under a Creative Commons License