The problem is that the switching of the pins is too slow from the managed code.
I saw there is ParallelPort class in GHI.Premium.Hardware, but I couldnât find any in GHI.OSHW.Hardware.
Is there any faster way for this (by using libraries and managed code) ?
Because the register write looks up the register address in a managed struct, it is quite slow. Meanwhile, OutputPort.Write is very fast; it calls a native function immediately that looks up the address at the HAL level (written in C++), and sets the pin state. If youâre coming from Arduino, youâre probably used to huge performance differences between register writes and the GPIO API. Not the case here. (Of course if you wrote directly to the register in C, the function would execute faster than the GPIO API).
Youâre missing the point though. The real slowdown comes from the managed execution environment looking up all those method calls and chugging through them⌠If youâre trying to speed up your program with direct register writes and != for loops, youâre going to end up with a nasty-looking program thatâs not measurably faster. Use interops! Or RLP! Thatâs what itâs there for.