Author Topic: serial port access  (Read 3442 times)

Offline Gary

  • Dr. Type
  • ****
  • Posts: 313
    • View Profile
serial port access
« 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

MrTAToad

  • Guest
Re: serial port access
« Reply #1 on: 2010-Apr-12 »
Not as such, but you could code your own :)

MrTAToad

  • Guest
Re: serial port access
« Reply #2 on: 2010-Apr-13 »
Yes, forgot about that - should be in the Showroom!

Offline Gary

  • Dr. Type
  • ****
  • Posts: 313
    • View Profile
Re: serial port access
« Reply #3 on: 2010-Apr-14 »
Thanks for the info, been through the showroom but cant see it, is it still available?

Cheers
Gary

MrTAToad

  • Guest
Re: serial port access
« Reply #4 on: 2010-Apr-15 »
Try this - Gernot hasn't tested it though

[attachment deleted by admin]

Offline Gary

  • Dr. Type
  • ****
  • Posts: 313
    • View Profile
Re: serial port access
« Reply #5 on: 2010-Apr-15 »
Thanks

I will give it a go over the weekend

Offline Gary

  • Dr. Type
  • ****
  • Posts: 313
    • View Profile
Re: serial port access
« Reply #6 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

MrTAToad

  • Guest
Re: serial port access
« Reply #7 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...

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1781
    • View Profile
    • Homepage
Re: serial port access
« Reply #8 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...

MrTAToad

  • Guest
Re: serial port access
« Reply #9 on: 2011-Mar-21 »
So reading & writing should be okay...

Offline Gary

  • Dr. Type
  • ****
  • Posts: 313
    • View Profile
Re: serial port access
« Reply #10 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)

Offline Gary

  • Dr. Type
  • ****
  • Posts: 313
    • View Profile
Re: serial port access
« Reply #11 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