Try adding (Smalltalk garbageCollect) after the #close.

Now a question of my own for the list.  Why does it seem common to do three #garbageCollects in a row.

cheers -ben


Sven Van Caekenberghe wrote:
Dario,

On 17 Feb 2014, at 12:55, Dario Trussardi <dario.trussa...@tiscali.it> wrote:

  
Thanks Sven,

    
You should #close the port when you are done, else it remains in use, I would guess.
      
Of course,  i used :


	| srl | 
	srl := SerialPort new.
	srl openPort: 'COM1'.

	srl nextPutAll: #[ 27 66 2 2 ] .
			
	srl close.

But after the first time, when submit the same code the system answer:

		Error: Cannot open 'COM1'

I don't unterstand because.
    
Me neither. I have no experience working with serial ports (but I know some people on the list do), let alone on Windows, but from looking at the code #close should be enough.

  
I note what the sometimes 	SerialPort allInstances 	  answer instance  after   the 	close method.

Perhaps remain occupied some resources?
    
They are still there because they are not yet garbage collected. If they are properly closed (check the printString in the inspector), the external resource should have been released.

Sorry, but I can't help you any further.

Sven

  
Ciao,

	Dario

    
Also, why do you #close before you start, seems strange to me ?

On 17 Feb 2014, at 12:05, Dario Trussardi <dario.trussa...@tiscali.it> wrote:

      
Ciao,


        
Hi,

I'm also interested by an answer to that question. So far, what I have as status is: you need a plugin to handle communications with the serial port (either for direct RS232 or USB-to-Serial) and compiling the serial port plugin with the Pharo VM makes it unstable.
          
I dont know " compiling " plugin  area.   ( i work with Windows 7 )

        
The solution we used was: to compile the serial plugin for the squeak VM and work in Squeak (4.3) instead of Pharo.
          
	Can you explain more detail about it?


	My test is :


	I download the   Pharo 2.0 #20628		and i    use the SerialPort 	 class.

	The first time i   do the code:

			| srl |
	
			srl := SerialPort new.
			srl close.

			srl openPort: 'COM1'.

			srl nextPutAll: #[ 27 66 2 2 ] .

	The RS232 device work fine.

	After the first time, when submit the same code the system answer:

		Error: Cannot open 'COM1'

	A this time i need to restart the Pharo environment.


	Any considerations,  suggestions ?


	Thanks,

		Dario
	

        
Thierry

Le 16/02/2014 16:28, Dario Trussardi a écrit :
          
Hi,


	i work with: 		Pharo1.Latest update: #14445		( or   with:	Pharo2.0 Latest update: #20628 ).


	I'm interested to manage communications with  USB 	 or 	RS232    device.


	I can find package  which support this protocol?

	Thank for any considerations ?

		Dario


	


            
-- 
Thierry Goubier
CEA list
Laboratoire des Fondations des Systèmes Temps Réel Embarqués
91191 Gif sur Yvette Cedex
France
Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95

          
        
      
    


  

Reply via email to