[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Serial Port access


Tried just opening 'COM1:' like your example states.

Do not see any data on a writeu get to my device. On a readu, IDL completely
hangs up and can only be killed by the task manager ??  I know the device
spits out 60 byte messages every second so it cannot be waiting for data.

I am not too confident with the concept of 'OPEN, COM1' in IDL.
Anyone else know if this is possible ??

Using IDL 5.4 on Win NT 4.0 SP5


Justin <ngls@bigfoot.com> wrote in message
> Some time ago we got two NT boxes talking to one another via the com port
> under IDL.
> This is the only code I can find (below) for writing to the com port. It
> tries to open a file named "COM1:". I've just tried it sitting here
> (nothing connected to my com port and a different machine to that on
> which it worked) and it fails - IDL complains it cannot find a file named
> "COM1:".
> That said this certainly worked at some point under NT! It may be you
> have to set up your COM ports under NT so they are recognised as part of
> the file system - I'm not sure. I can't remember what we had to do to get
> it working, but we certainly managed to do it.
> Drop me a line if you need more help (something might jog my memory).
> Also I'll check on our machines in the lab next time I'm down there -
> there may be some clues!
> Good luck!
> Justin
> pro gcs_serialout, text, port
> text = strtrim(text, 2) ;Convert first param to string type.
> if n_params(0) lt 2 then begin ;If no port given, choose COM1:.
> xport = 'COM1:'
> endif else begin ;Otherwise, choose port based on input.
> port = fix(port)
> if (port gt 2) or (port lt 1) then begin
> print, 'PORT must be 1 or 2.'
> return
> endif
> xport = 'COM' + strtrim(port, 2) +':'
> endelse
> get_lun, u
> openw, u, xport
> ;print, fstat(u) ;For debug only.
> writeu, u, text ;Raw text output.
> ;writeu, u, text + string(byte([13,10]))
> flush, u
> ;print, fstat(u) ;For debug only.
> close, u
> free_lun, u
> end