serial port access

Previous topic - Next topic

Gary

Does GLBasic allow any read and writes to an RS232 port? All I can see is stuff for TCP and sockets but nothing for basic RS232 send and receive

Thanks
Gary

MrTAToad

Not as such, but you could code your own :)

MrTAToad

Yes, forgot about that - should be in the Showroom!

Gary

Thanks for the info, been through the showroom but cant see it, is it still available?

Cheers
Gary

MrTAToad

Try this - Gernot hasn't tested it though

[attachment deleted by admin]

Gary

Thanks

I will give it a go over the weekend

Gary

Finally got round to needing to use this add on (not bad, just under a year :( ) and have a problem.

Is it possible to set a port up to be able to both read and write to the same port? Looking at the example code it appears that you have to set it up to send data, close the port, reopen it for recieve and then read the port. When I try this I am missing data being returned after I have sent it.

Appreciate any tips anyone has

Gary

MrTAToad

I believe serial port access is one-way only.  For reading & writing at the same time, you need parallel port access...

Moru

Serial port is normally accessible for both read and write (full duplex), it has two datalines. Parallel port has 8 datalines, one-way only, have to change state to read or write if I don't remember very wrong now...

MrTAToad

So reading & writing should be okay...

Gary

Dont have the actual code example here as I'm on my phone but in the code above you have to specify if you are receiving or transmitting data and it seems you have to open and close the port to change state unless I'm missing something simple (which i probably am)

Gary

Stupid me, I thought the code

Code (glbasic) Select
IF COM_Open(0, port, FALSE, TRUE) = FALSE THEN Error("open COM4 for writing failed")


which needs the FALSE changing to TRUE to put it in read mode then took it out of write mode which of course it doesnt.

thanks for the help