  | 
				VFP 愛用者社區 本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.   
				 | 
			 
		 
		 
	
		| 上一篇主題 :: 下一篇主題   | 
	 
	
	
		| 發表人 | 
		內容 | 
	 
	
		K.W. Mok
 
 
  註冊時間: 2012-08-09 文章: 1 來自: Hong Kong
  第 1 樓
  | 
		
			
				 發表於: 星期四 八月 09, 2012 3:18 pm    文章主題: Foxpro read data from RS232 | 
				     | 
			 
			
				
  | 
			 
			
				| 要用 foxpro 從電腦的 com1 取電子磅的數據 | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		bx1166
 
 
  註冊時間: 2011-12-06 文章: 273
 
  第 2 樓
  | 
		
			
				 發表於: 星期六 八月 11, 2012 9:12 am    文章主題:  | 
				     | 
			 
			
				
  | 
			 
			
				> Run mode com1 2400,E,7,1
 
> comhandle=fopen('com1',12)
 
> if comhandle<0
 
> wait 'no open com1' window nowait
 
> return
 
> endif
 
> store '0' to cominput1
 
> cominput1=fgets(comhandle)
 
>
 
> any idea and solution ? Please Help
 
 
Albert,
 
 
Is Foxpro 2.6a the windows version? Foxpro 2.6 came in two flavors - The DOS version and the Windows version. Which is this?
 
 
If it is the Windows version, then this will apply:
 
 
p1.3-522 in the Language reference for Foxpro 2.6 for DOS and Windows -
 
 
In the Parameters section for FOPEN() in the Language Reference for FoxPro for MS-DOS and Windows 'Ports cannot be opened with low-level file functions in FoxPro for Windows'.
 
 
If you are in FoxPro for DOS, try opening the port in the buffered scheme:
 
 
comhandle=fopen('com1',2)
 
 
In the same vein, try upping the baud rate. I assume you are trying to communicate via a serial cable and not modems.
 
 
If the other machine is running Unix, or some variation thereof, you need to change to a seven bit word, with no stop-bit.
 
 
Also, to send to the port, use FPUTS(), not FGETS().
 
 
有個廟 叫 Google 先去拜一拜 ! | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		 | 
	 
 
  
  	 
	    
  	   | 
 	
您 無法 在這個版面發表文章 您 無法 在這個版面回覆文章 您 無法 在這個版面編輯文章 您 無法 在這個版面刪除文章 您 無法 在這個版面進行投票 您 無法 在這個版面附加檔案 您 無法 在這個版面下載檔案
  | 
   
  
		 |