I'm trying to turn on/off a output or switch a relay etc by controlling the RTS or DTR pin of my RS232 signal. I've created a script in C that switches my DTR or RTS flag on/off but I'm not getting any difference in my output on my serial port to terminal adapter(see image below):
The structure of my RS232 is as follows:
As the image describes, the RTS signal is on pin 8, when I flag this to "on" and i measure between pin 1(ground) and pin 8(RTS) im getting 3V. When I switch it back to off it remains staying at 3V, so nothing changed when I'm toggling DTR or RTS.
Does anyone know what I'm doing wrong?
UPDATE
I've tried the code below(I think it matches @Vincent Achard's answer). This does not work, when I measure between pin 1(ground) and pin 6(5v output) this remains 5V while running the script. Also when I measure between pin 1(ground) and ping 8(RTS) this remains 2.8V while running the script. Does anyone see any mistakes in this code?
Thanks in advance!


