GLBasic forum

Main forum => GLBasic - en => Topic started by: Gary on 2010-Apr-12

Title: serial port access
Post by: Gary on 2010-Apr-12
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
Title: Re: serial port access
Post by: MrTAToad on 2010-Apr-12
Not as such, but you could code your own :)
Title: Re: serial port access
Post by: MrTAToad on 2010-Apr-13
Yes, forgot about that - should be in the Showroom!
Title: Re: serial port access
Post by: Gary on 2010-Apr-14
Thanks for the info, been through the showroom but cant see it, is it still available?

Cheers
Gary
Title: Re: serial port access
Post by: MrTAToad on 2010-Apr-15
Try this - Gernot hasn't tested it though

[attachment deleted by admin]
Title: Re: serial port access
Post by: Gary on 2010-Apr-15
Thanks

I will give it a go over the weekend
Title: Re: serial port access
Post by: Gary on 2011-Mar-21
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
Title: Re: serial port access
Post by: MrTAToad on 2011-Mar-21
I believe serial port access is one-way only.  For reading & writing at the same time, you need parallel port access...
Title: Re: serial port access
Post by: Moru on 2011-Mar-21
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...
Title: Re: serial port access
Post by: MrTAToad on 2011-Mar-21
So reading & writing should be okay...
Title: Re: serial port access
Post by: Gary on 2011-Mar-21
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)
Title: Re: serial port access
Post by: Gary on 2011-Mar-22
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