m83coding - 2024-04-23

Hello,

I am trying to control shift registers 74HC596 and 74HC165 via Raspberry PI with SPI interface. So far I did it with a Microcontroller and now I wanna upgrade my Projekt with Raspberry Pi and Codesys Software to be more flexible.

I tried to adapt PiFace Function Block to just send or recive a 8 bit via SPI interface of the my Raspberry Pi.

With following code (see attached screenshots)
* PLC_PRG
* PiFaceDigital
* PiFaceDigital.write8
* PiFaceDigital.read8

I have a signal at SCK and MOSI pin of the PI, so far so good.

But I really struggle with the unterstanding of the code. Is there some detailed description of each line of code? Or is there somebody in the community who can explain each line of code?

Or is there a more simple way to send / recive 8 bit via SPI?

Manuel