Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/po4a.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
[type: AsciiDoc_def] src/drivers/hal_gpio.adoc $lang:build/adoc/$lang/drivers/hal_gpio.adoc
[type: AsciiDoc_def] src/drivers/mb2hal.adoc $lang:build/adoc/$lang/drivers/mb2hal.adoc
[type: AsciiDoc_def] src/drivers/mitsub-vfd.adoc $lang:build/adoc/$lang/drivers/mitsub-vfd.adoc
[type: AsciiDoc_def] src/drivers/opto_ac5.adoc $lang:build/adoc/$lang/drivers/opto_ac5.adoc
[type: AsciiDoc_def] src/drivers/pico-ppmc.adoc $lang:build/adoc/$lang/drivers/pico-ppmc.adoc
[type: AsciiDoc_def] src/drivers/pmx485.adoc $lang:build/adoc/$lang/drivers/pmx485.adoc
[type: AsciiDoc_def] src/drivers/shuttle.adoc $lang:build/adoc/$lang/drivers/shuttle.adoc
Expand Down Expand Up @@ -358,6 +359,7 @@
[type: AsciiDoc_def] src/man/man9/lcd.9.adoc $lang:build/adoc/$lang/man/man9/lcd.9.adoc
[type: AsciiDoc_def] src/man/man9/lineardeltakins.9.adoc $lang:build/adoc/$lang/man/man9/lineardeltakins.9.adoc
[type: AsciiDoc_def] src/man/man9/motion.9.adoc $lang:build/adoc/$lang/man/man9/motion.9.adoc
[type: AsciiDoc_def] src/man/man9/opto_ac5.9.adoc $lang:build/adoc/$lang/man/man9/opto_ac5.9.adoc
[type: AsciiDoc_def] src/man/man9/rosekins.9.adoc $lang:build/adoc/$lang/man/man9/rosekins.9.adoc
[type: AsciiDoc_def] src/man/man9/sampler.9.adoc $lang:build/adoc/$lang/man/man9/sampler.9.adoc
[type: AsciiDoc_def] src/man/man9/setsserial.9.adoc $lang:build/adoc/$lang/man/man9/setsserial.9.adoc
Expand Down
1 change: 1 addition & 0 deletions docs/src/Submakefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ DOC_SRCS_EN := \
drivers/hal_pi_gpio.adoc \
drivers/hostmot2.adoc \
drivers/mb2hal.adoc \
drivers/opto_ac5.adoc \
drivers/pico-ppmc.adoc \
drivers/pmx485.adoc \
drivers/shuttle.adoc \
Expand Down
151 changes: 151 additions & 0 deletions docs/src/drivers/opto_ac5.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
:lang: en
:toc:

[[cha:opto-ac5]]
= Opto22 PCI-AC5 Driver

*PCI AC5 ADAPTER CARD / HAL DRIVER*

Comment thread
BsAtHome marked this conversation as resolved.
Resolved
== 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 that 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 is just
an adapter.

See the manufacturer's website for more info:

https://www.opto22.com/site/pr_details.aspx?cid=4&item=PCI-AC5

I would like to thank Opto22 for releasing info in their manual,
easing the writing of this driver!

== 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:

[source,hal]
----
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:

* 'opto-ac5.0.port0.in-00' -
They would be numbered from 00 to 11
* 'opto-ac5.0.port0.out-12' -
They would be numbered 12 to 23 port 1 would be the same.

== Pins

* 'opto-ac5.[BOARDNUMBER].port[PORTNUMBER].in-[PINNUMBER] OUT bool' -

* 'opto-ac5.[BOARDNUMBER].port[PORTNUMBER].in-[PINNUMBER]-not OUT bool' -
Connect a HAL bool signal to this pin to read an I/O point from the
card. The PINNUMBER represents the position in the relay rack. Eg.
PINNUMBER 0 is position 0 in a Opto22 relay rack and would be pin 47
on the 50 pin header connector. The -in pin is TRUE when the input
is on (the line is pulled LOW). The -not pin is always the inverse of
the -in pin.

* 'opto-ac5.[BOARDNUMBER].port[PORTNUMBER].out-[PINNUMBER] IN bool' -
Connect a HAL bool signal to this pin to write to an I/O point of the
card. The PINNUMBER represents the position in the relay rack. Eg.
PINNUMBER 23 is position 23 in a Opto22 relay rack and would be pin 1
on the 50 pin header connector. TRUE turns the output on (the line is
driven LOW).

* 'opto-ac5.[BOARDNUMBER].led[NUMBER] IN bool' -
Turns one of the 4 onboard LEDs on/off. LEDs are numbered 0 to 3.

BOARDNUMBER can be 0-3 PORTNUMBER can be 0 or 1. Port 0 is closest to
the card bracket.

== Parameters

* 'opto-ac5.[BOARDNUMBER].port[PORTNUMBER].out-[PINNUMBER]-invert RW bool' -
When TRUE, invert the meaning of the corresponding -out pin so that
TRUE turns the output off and FALSE turns it on.

== Functions

* 'opto-ac5.[BOARDNUMBER].digital-read' -
Add this to a thread to read all the input points.

* 'opto-ac5.[BOARDNUMBER].digital-write' -
Add this to a thread to write all the output points and LEDs.

== Configuring I/O Ports

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

[source,hal]
----
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.

Here's 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 (that's the outputs) then 0 twelve times (that's the
inputs). Notice the first I/O point is the lowest (rightmost) 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 as 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 and 8 ones for the 8 outputs
----
000000000000000011111111
----

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

== Pin Numbering

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.

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 Hostmot2 position 1 = connector pin
1, and the position number goes up as the connector pin number goes up.

// vim: set syntax=asciidoc:
1 change: 1 addition & 0 deletions docs/src/hal/components.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ To search in the man pages, use the UNIX tool `apropos`.
| link:../man/man9/mesa_7i65.9.html[mesa_7i65] |Mesa Electronics driver for the 7I65 eight-axis servo card. (See the man page for more information) ||
| link:../man/man9/mesa_pktgyro_test.9.html[mesa_pktgyro_test] |PktUART simple test with Microstrain 3DM-GX3-15 gyro ||
| link:../man/man9/mesa_uart.9.html[mesa_uart] |An example component demonstrating how to access the Hostmot2 UART ||
| link:../man/man9/opto_ac5.9.html[opto_ac5] |Realtime driver for opto22 PCI-AC5 cards ||
| link:../man/man9/serport.9.html[serport] |Hardware driver for the digital I/O bits of the 8250 and 16550 serial port ||
| link:../man/man9/setsserial.9.html[setsserial] |An utility for setting Smart Serial NVRAM parameters ||
| link:../man/man9/sserial.9.html[sserial] |hostmot2 - Smart Serial LinuxCNC HAL driver for the Mesa Electronics HostMot2 Smart-Serial remote cards ||
Expand Down
1 change: 1 addition & 0 deletions docs/src/index.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
<li><a href="drivers/hostmot2.html">Mesa HostMot2 Driver</a></li>
<li><a href="drivers/mb2hal.html">Modbus to HAL Driver</a></li>
<li><a href="drivers/mitsub-vfd.html">Mitsubishi VFD Driver</a></li>
<li><a href="drivers/opto_ac5.html">Opto22 PCI-AC5 Driver</a></li>
<li><a href="drivers/pico-ppmc.html">Pico Drivers</a></li>
<li><a href="drivers/pmx485.html">Powermax Modbus Driver</a></li>
<li><a href="drivers/shuttle.html">ShuttleXpress and ShuttlePRO Driver</a></li>
Expand Down
75 changes: 75 additions & 0 deletions docs/src/man/man9/opto_ac5.9.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
= opto_ac5(9)

== NAME

opto_ac5 - Realtime driver for opto22 PCI-AC5 cards

== SYNOPSIS

*loadrt opto_ac5* [**portconfig0=0x**_N_] [**portconfig1=0x**_N_]

== DESCRIPTION

These pins and parameters are created by the realtime *opto_ac5* module.
The portconfig0 and portconfig1 variables are used to configure the two
ports of each card. The first 24 bits of a 32 bit number represent the
24 i/o points of each port. The lowest (rightmost) bit would be HAL pin
0 which is header connector pin 47. Then next bit to the left would be
HAL pin 1, header connector pin 45 and so on, until bit 24 would be HAL
pin 23, header connector pin 1. "1" bits represent output points. So
channel 0..11 as inputs and 12..23 as outputs would be represented by
(in binary) 111111111111000000000000 which is 0xfff000 in hexadecimal.
That is the number you would use, e.g.

[source,hal]
----
loadrt opto_ac5 portconfig0=0xfff000
----

If no portconfig variable is specified the default configuration is 12
inputs then 12 outputs.

Up to 4 boards are supported. Boards are numbered starting at 0.

Portnumber can be 0 or 1. Port 0 is closest to the card bracket.

== PINS

**opto-ac5.**_BOARDNUMBER_**.port**_PORTNUMBER_**.in-**_PINNUMBER_ OUT bool::
+

**opto-ac5.**_BOARDNUMBER_**.port**_PORTNUMBER_**.in-**_PINNUMBER_**-not** OUT bool::
Connect a HAL bool signal to this pin to read an i/o point from the card.
The PINNUMBER represents the position in the relay rack. E.g., PINNUMBER 0 is
position 0 in a opto22 relay rack and would be pin 47 on the 50 pin header connector.
The *-in* pin is TRUE when the input is on (the line is pulled LOW). The *-not*
pin is always the inverse of the *-in* pin.
**opto-ac5.**_BOARDNUMBER_**.port**_PORTNUMBER_**.out-**_PINNUMBER_ IN bool::
Connect a HAL bool signal to this pin to write to an i/o point of the
card. The PINNUMBER represents the position in the relay rack. E.g.,
PINNUMBER 23 is position 23 in a opto22 relay rack and would be pin 1
on the 50 pin header connector. TRUE turns the output on (the line is
driven LOW).
**opto-ac5.**_BOARDNUMBER_**.led**_NUMBER_ IN bool::
Turns one of the on board LEDS on/off. LEDS are numbered 0 to 3.

== PARAMETERS

**opto-ac5.**_BOARDNUMBER_**.port**_PORTNUMBER_**.out-**_PINNUMBER_**-invert** RW bool::
When TRUE, invert the meaning of the corresponding *-out* pin so that
TRUE turns the output off and FALSE turns it on.

== FUNCTIONS

**opto-ac5.**_BOARDNUMBER_**.digital-read**::
Add this to a thread to read all the input points.
**opto-ac5.**_BOARDNUMBER_**.digital-write**::
Add this to a thread to write all the output points and LEDS.

== BUGS

All boards are loaded with the same port configurations as the first board.

== SEE ALSO

https://wiki.linuxcnc.org/cgi-bin/wiki.pl?OptoPciAc5
3 changes: 3 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,8 @@ hal_speaker-objs := hal/drivers/hal_speaker.o $(MATHSTUB)
endif
obj-$(CONFIG_HAL_GM) += hal_gm.o
hal_gm-objs := hal/drivers/hal_gm.o $(MATHSTUB)
obj-$(CONFIG_OPTO_AC5) += opto_ac5.o
opto_ac5-objs := hal/drivers/opto_ac5.o $(MATHSTUB)
obj-$(CONFIG_HAL_PPMC) += hal_ppmc.o
hal_ppmc-objs := hal/drivers/hal_ppmc.o $(MATHSTUB)

Expand Down Expand Up @@ -1403,6 +1405,7 @@ endif
../rtlib/rosekins$(MODULE_EXT): $(addprefix objects/rt,$(rosekins-objs))
../rtlib/scorbot-kins$(MODULE_EXT): $(addprefix objects/rt,$(scorbot-kins-objs))
../rtlib/hal_gm$(MODULE_EXT): $(addprefix objects/rt,$(hal_gm-objs))
../rtlib/opto_ac5$(MODULE_EXT): $(addprefix objects/rt,$(opto_ac5-objs))
../rtlib/hostmot2$(MODULE_EXT): $(addprefix objects/rt,$(hostmot2-objs))
../rtlib/hm2_test$(MODULE_EXT): $(addprefix objects/rt,$(hm2_test-objs))
../rtlib/hm2_pci$(MODULE_EXT): $(addprefix objects/rt,$(hm2_pci-objs))
Expand Down
1 change: 1 addition & 0 deletions src/Makefile.inc.in
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ CONFIG_HAL_SPEAKER=m
CONFIG_HAL_PPMC=m
CONFIG_HOSTMOT2=m
CONFIG_HAL_GM=m
CONFIG_OPTO_AC5=m
CONFIG_HAL_BB_GPIO=m
CONFIG_HAL_PI_GPIO=m
CONFIG_HAL_GPIO=m
Expand Down
Loading