comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Serial Port access
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Serial Port access [message #23669] Mon, 05 February 2001 08:24 Go to next message
Richard Tyc is currently offline  Richard Tyc
Messages: 69
Registered: June 1999
Member
Anybody have any libraries, DLL's, , CALL_EXTERNAL code examples which
provides an IDL application with the ability to read the serial port on
Windows NT machines (Intel). I am trying to get my IDL app to link to a
fiberoptic thermometer via RS232 to read data continuously.

Just don't want to reinvent the wheel. Not to mention, I have never written
code to access the serial port on a NT box.

BTW, I am referring to the standard COM1/COM2 port on the motherboard not
external PCI/ISA interface cards.

Thanks

Rich
Re: Serial Port access [message #23676 is a reply to message #23669] Mon, 12 February 2001 06:16 Go to previous message
ngls is currently offline  ngls
Messages: 10
Registered: November 2000
Junior Member
Apologies for replying to my own post but...

I just connected my Palm to my com port (uses it for sync'ing) and
managed to read 20 bytes - admittedly I coudn't tell if what I was
reading was garbage but I got something out with the following code:

PRO test_com_read

OPENR, u, "COM1:", /GET_LUN

txt = BYTARR(20) ;Only read in 20 bytes

READU, u, txt

HELP, FSTAT(U), /str ;Show debug info

FREE_LUN, u ;Close and free lun

PRINT, STRING(txt) :Display what was read in as a string

PRINT, "Done"

END



ngls@bigfoot.com (Justin) wrote in
<9046820ABltbyltbmltbouts@155.198.199.181>:

>
> Hmmm - well I don't have anything attached on my com ports, but I've
> managed to write to my printer port (LPT1:) with the following code and
> get a page out of the printer.
>
> As for using READU, you'll probably have to create a small string to
> start with so IDL knows when to stop reading (as in the online help
> example).
>
> Hope this helps,
>
> Justin
>
> IDL> print, !version
> { x86 Win32 Windows 5.3.1 Feb 23 2000}
>
>
> PRO test_print
>
> OPENW, u, "LPT1:", /GET_LUN
>
> ;Create some text, followed by form feed
> txt = "Testing from IDL" + (STRING(12B))[0]
>
> WRITEU, u, txt
>
> FLUSH, u
>
> HELP, FSTAT(u), /str ;Show debug info
>
> FREE_LUN, u ;Close and free lun
>
> PRINT, "Done"
>
> END
>
>
> Richard_Tyc@sbrc.umanitoba.ca (Richard Tyc) wrote in
> <95pns1$fiu$1@canopus.cc.umanitoba.ca>:
>
>> Thanks....
>>
>> 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
>>
>> Rich
>>
>
Re: Serial Port access [message #23677 is a reply to message #23669] Mon, 12 February 2001 04:58 Go to previous message
ngls is currently offline  ngls
Messages: 10
Registered: November 2000
Junior Member
Hmmm - well I don't have anything attached on my com ports, but I've
managed to write to my printer port (LPT1:) with the following code and get
a page out of the printer.

As for using READU, you'll probably have to create a small string to start
with so IDL knows when to stop reading (as in the online help example).

Hope this helps,

Justin

IDL> print, !version
{ x86 Win32 Windows 5.3.1 Feb 23 2000}


PRO test_print

OPENW, u, "LPT1:", /GET_LUN

;Create some text, followed by form feed
txt = "Testing from IDL" + (STRING(12B))[0]

WRITEU, u, txt

FLUSH, u

HELP, FSTAT(u), /str ;Show debug info

FREE_LUN, u ;Close and free lun

PRINT, "Done"

END


Richard_Tyc@sbrc.umanitoba.ca (Richard Tyc) wrote in
<95pns1$fiu$1@canopus.cc.umanitoba.ca>:

> Thanks....
>
> 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
>
> Rich
>
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Hi, My Name is David. And I'm a Lurker
Next Topic: speed comparison of IDL, numPy, Matlab

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:49:19 PDT 2025

Total time taken to generate the page: 0.00429 seconds