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

Re: Serial Port access



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
>>
>