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

Home » Public Forums » archive » Serial Port
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 [message #14133] Thu, 28 January 1999 00:00 Go to next message
Bernard Puc is currently offline  Bernard Puc
Messages: 65
Registered: January 1998
Member
Is there anybody who has written any IDL code to access the serial
port on a PC or UNIX platform? I'd be interested in seeing
implementations.
Thanks.


--
Bernard Puc AETC, INC.
bpuc@va.aetc.com 1225 Jefferson Davis Highway #800
(703) 413-0500 Arlington, VA 22202
Re: Serial Port [message #14226 is a reply to message #14133] Fri, 29 January 1999 00:00 Go to previous messageGo to next message
ashmall is currently offline  ashmall
Messages: 14
Registered: October 1998
Junior Member
Apologies for following up to my article but...

If you're not reading a fixed amount of bytes from the port, to terminate the
transmission I think you have to send byte value 4, something like:

get_lun, u
openw, u, "COM1:"
text = "Hello Mum"
writeu, u, text + string(4b)
close, u
free_lun, u

Justin

In article <78s43i$pec$1@jura.cc.ic.ac.uk>, ashmall@my-dejanews.com (Justin
Ashmall) wrote:
> We've done this under NT4. We just open a file as normal with OPENR or OPENW
> (for reading or writing to the port), but in the place of the file name use
> COM1: or COM2: (not forgetting the colons). The only problem is if you try to
> read from the port and it gets no data - it either hangs or has a very long
> time out.
> If you're having trouble email me at justin@ic.ac.uk and I'll dig out the
> code for you.
>
> Justin
>
>
> In article <36B0B2B5.1C0A2FB7@va.aetc.com>, bpuc@va.aetc.com wrote:
>> Is there anybody who has written any IDL code to access the serial
>> port on a PC or UNIX platform? I'd be interested in seeing
>> implementations.
>> Thanks.
>>
>>
Re: Serial Port [message #14227 is a reply to message #14133] Fri, 29 January 1999 00:00 Go to previous messageGo to next message
ashmall is currently offline  ashmall
Messages: 14
Registered: October 1998
Junior Member
We've done this under NT4. We just open a file as normal with OPENR or OPENW
(for reading or writing to the port), but in the place of the file name use
COM1: or COM2: (not forgetting the colons). The only problem is if you try to
read from the port and it gets no data - it either hangs or has a very long
time out.
If you're having trouble email me at justin@ic.ac.uk and I'll dig out the
code for you.

Justin


In article <36B0B2B5.1C0A2FB7@va.aetc.com>, bpuc@va.aetc.com wrote:
> Is there anybody who has written any IDL code to access the serial
> port on a PC or UNIX platform? I'd be interested in seeing
> implementations.
> Thanks.
>
>
Re: serial port [message #40317 is a reply to message #14133] Tue, 03 August 2004 05:50 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
michele writes:

> the problem is that i would like this to work also on the first
> machine
> (which is my laptop with windows xp home with idl 5.6 only demo mode).
> maybe the demo mode doesn't allow to add further dlls and dlms ??

I think that is likely. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: serial port [message #40320 is a reply to message #14133] Tue, 03 August 2004 05:24 Go to previous messageGo to next message
gnarloo is currently offline  gnarloo
Messages: 14
Registered: June 2004
Junior Member
First thanks to all.. everything has been really useful

second, yes, i work on a windows machine

third

if i give as input

print, !dlm_path
the output is exactly the folder where my serial.dll and serial.dlm
are...

but if i do
help, /dlm
the serial.dll doesn't appear among the available modules...

i tried all this again on another machine (windows xp professional
with idl 6.0 full licensed)
and everything works...

the problem is that i would like this to work also on the first
machine
(which is my laptop with windows xp home with idl 5.6 only demo mode).
maybe the demo mode doesn't allow to add further dlls and dlms ??

cheers
michael
Re: serial port [message #40331 is a reply to message #14133] Mon, 02 August 2004 13:54 Go to previous messageGo to next message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
David Fanning wrote:


> You are running this on a Windows machine, right? If not,
> the C source code is so you can recompile it for your machine.

<Ed McMahon>

A long sting of compiler errors.

</Ed McMahon>


<Carnac the Magnificent>

What is the error message Michele will see when he tries to compile this
on a non-windows machine?

</Carnac the Magnificent>


;)


-Rick
Re: serial port [message #40336 is a reply to message #14133] Mon, 02 August 2004 12:58 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
michele writes:

> okay i try to explain better...
>
> i want to write a program that uses the gps and so i need to read and
> write directly from the serial port.
> on the idl web-site there is a zip file (under user-contributed site,
> section dll and dlm files) that seems to provide what i need.
>
> if you unzip the file you get 4 files:
> serial.dll and serial.dlm (to be put in a specified folder)
> a readme file that is a bit like the help page that describes 4
> functions
> and a c-language source code (it doesn't have a main).
>
> my goal is to be able to use the functions described in the text file:
> these functions are
> comm_open
> comm_read
> comm_write
> comm_close.
>
> all this stuff is achieved through dynamically linked modules, and in
> this case it means that my idl program must be coupled with some piece
> of C-language..
>
> what i did is just putting the dll and dlm files in the right folder,
> and than trying to use the functions as normal idl functions.
> but they are not recognized as functions.
> moreover i didn't use the c source file in any way... but i think i
> should use it.. if it contained a main i could try to spawn it from
> the main idl module but i can't get an executable out of it becuse it
> contains no main...

I don't know. It seemed to work for me. I downloaded the file. Extracted
the DLL and DLM files to the appropriate place in my IDL distribution.
Exited IDL. Started IDL and typed this:

IDL> DLM_LOAD, 'serial'
% Loaded DLM: SERIAL.
IDL> h=COMM_OPEN('com1')
IDL> ok = COMM_CLOSE(h)

Seems to work fine.

You are running this on a Windows machine, right? If not,
the C source code is so you can recompile it for your machine.

Cheers,

David




--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: serial port [message #40338 is a reply to message #14133] Mon, 02 August 2004 12:41 Go to previous messageGo to next message
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
michele wrote:

> okay i try to explain better...
>

Hi,

Although you know the DLM is not working, you can confirm that it is (or is not)
in you DLM path by...

HELP, /DLM

which will spit out all of the currently accessible DLMs (whether loaded or
not). If it doesn't show up in the listing produced by the call to help, then
check your DLM path to make sure it includes the place you put the serial DLM.

PRINT, !DLM_PATH

Of course, you probably know already that the serial DLM is for Windows only.

Ben

> i want to write a program that uses the gps and so i need to read and
> write directly from the serial port.
> on the idl web-site there is a zip file (under user-contributed site,
> section dll and dlm files) that seems to provide what i need.
>
> if you unzip the file you get 4 files:
> serial.dll and serial.dlm (to be put in a specified folder)
> a readme file that is a bit like the help page that describes 4
> functions
> and a c-language source code (it doesn't have a main).
>
> my goal is to be able to use the functions described in the text file:
> these functions are
> comm_open
> comm_read
> comm_write
> comm_close.
>
> all this stuff is achieved through dynamically linked modules, and in
> this case it means that my idl program must be coupled with some piece
> of C-language..
>
> what i did is just putting the dll and dlm files in the right folder,
> and than trying to use the functions as normal idl functions.
> but they are not recognized as functions.
> moreover i didn't use the c source file in any way... but i think i
> should use it.. if it contained a main i could try to spawn it from
> the main idl module but i can't get an executable out of it becuse it
> contains no main...
>
> thanks in advance
>
> michael
Re: serial port [message #40342 is a reply to message #14133] Mon, 02 August 2004 11:00 Go to previous messageGo to next message
gnarloo is currently offline  gnarloo
Messages: 14
Registered: June 2004
Junior Member
okay i try to explain better...

i want to write a program that uses the gps and so i need to read and
write directly from the serial port.
on the idl web-site there is a zip file (under user-contributed site,
section dll and dlm files) that seems to provide what i need.

if you unzip the file you get 4 files:
serial.dll and serial.dlm (to be put in a specified folder)
a readme file that is a bit like the help page that describes 4
functions
and a c-language source code (it doesn't have a main).

my goal is to be able to use the functions described in the text file:
these functions are
comm_open
comm_read
comm_write
comm_close.

all this stuff is achieved through dynamically linked modules, and in
this case it means that my idl program must be coupled with some piece
of C-language..

what i did is just putting the dll and dlm files in the right folder,
and than trying to use the functions as normal idl functions.
but they are not recognized as functions.
moreover i didn't use the c source file in any way... but i think i
should use it.. if it contained a main i could try to spawn it from
the main idl module but i can't get an executable out of it becuse it
contains no main...

thanks in advance

michael
Re: serial port [message #40345 is a reply to message #14133] Mon, 02 August 2004 07:50 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
michele writes:

> dear all...
> it's always the serial port..
> i downloaded the software from the rsi website (code contributed kind
> of thing), i placed the .dll and .dlm files in the right folders, and
> tried to use the functions as described in the readme file...
>
> the functions are not recognized as such.
>
> moreover what do i have to do with the c code source file (included in
> the downloaded archive)?
>
> could you please give me any tip to integrate the dlm in the main
> application?

It's like that Johnny Carson sketch where he used
to divine the answer to the question that was sealed
in the envelope. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Serial Port [message #41931 is a reply to message #14133] Tue, 30 November 2004 15:04 Go to previous message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
Have you tried the serial port dlm that is offered in the user contrib
section of the RSI web page?

Haje


"Patrick Dillmann" <patrick.dillmann@gmx.de> wrote in message
news:c10d9338.0411300705.7915ac22@posting.google.com...
> Hi,
>
> I have a problem if I try to read a serial port on a Win 2000 PC. If I
> only send a message to a device everything works fine. But when I use
> the following Code to get an answer IDL hangs up:
>
> val=bytarr(34)
> port='COM1:'
> get_lun, u
> openu, u, port
> text = 'DATA?'+string(13B)
> writeu, u, text
> readu,u,val
> close, u
> free_lun, u
>
> Due to the fact that this code works as expected even for getting an
> answer if I first start and close the Hyper Terminal for this port, I
> believe that I must send some port settings (e.g bits per second,..)
> before sending my code.
>
> If this is the case, how can I initialize a serial port with IDL? Are
> there other possibilities to communicate with a device via a serial
> port?
>
> Thanks,
> Patrick
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Ptr_Wrapper (Useful?)
Next Topic: Spectral Library Bundles

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

Current Time: Wed Oct 08 13:38:57 PDT 2025

Total time taken to generate the page: 0.00570 seconds