ali bütün
Hello,
I am working on a project using a Raspberry Pi CM4 to communicate with an FPGA via SPI (channels 4-5-6). I use the FPGA to handle digital/analog outputs and read encoders. Essentially, I control motors by reading from and writing to specific FPGA registers.

I need to integrate the OpenPLC runtime into this workflow. Currently, I have C code to handle the communication, for example: spi_register_write(33 , 0x0000); (By writing values between 0x0000-0xFFFF to address 33, I control the digital outputs).

My question is: I need to perform ON/OFF control for 16 digital outputs directly from OpenPLC. How can I implement user-defined functions to achieve this? Is it possible to wrap my existing C function into a custom OpenPLC block or function to map these variables?
Reply 0 0
thiagoralves
 
Then you can simply create your own Function Blocks in C/C++:
Screenshot 2025-12-04 at 10.49.19 AM.png
Reply 1 0
Reply