Closed mkaivs closed 1 year ago
Hello, John Hentges here from Software at ACCES.
The device does not support single write, but your batched write is pretty close.
apci_write32(fd, 0, //ignored 2, // BAR#; virtually all cards use BAR2 exclusively 0, // register offset see page 11 of hardware manual 0x40AAAAAA, // data: turn on all odd FET bits, and (if configured as outputs) turn off TTL bits 0-5 and bit 7 but turn on TTL bit 6. (writes to inputs are ignored) );
apci_read32(fd, 0, 2, 4, &data); // read 32 bits of data from +4->+7. MSB is TTL input/readback
Let me know if you'd like any additional details. I am here to help!
On 1/6/2023 1:33 PM, mkaivs wrote:
I want to use a PCIe-IDIO-24 Isolated Digital I/O Card https://accesio.com/product/pcie-idio-24/ to turn on / turn off switches. How do I turn on/off a single relay or multiple relays at once using a bit mask? Something like:
|// single write: void write(int fd, uint8_t relay_index, uint8_t value); write(fd, 0, 0); // turn of relay at index 0 write(fd, 0, 1); // turn on relay at index 0 // batched write: void write(int fd, uint32_t value); write(fd, xFFFFFF); // turn on all 24 relays write(fd, 0); // turn off all 24 relays write(fd, xF00007); // turn on relays at index 0-2 & 20-23, turn off relays at index 3-19 // single read: void read(int fd, uint8_t relay_index, uint8_t value); uint8_t value; read(fd, 0, &value); // value is set to 1 if relay is on, 0 if relay is off // batched read: void read(int fd, uint32_t value); uint32_t value; read(fd, &value); // value is set to 0xF if relays at index 0-3 is on |
— Reply to this email directly, view it on GitHub https://github.com/accesio/APCI/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADKDEW42DDIRPNCGNAIMHQ3WRCFTHANCNFSM6AAAAAATTPKWQI. You are receiving this because you are subscribed to this thread.Message ID: @.***>
@JHentges
Thank you so much for the explanation, I've got a much better idea of how to use the provided apcilib
library now.
I want to use a PCIe-IDIO-24 Isolated Digital I/O Card to turn on / turn off switches. How do I turn on/off a single relay or multiple relays at once using a bit mask? Something like: