Visual Foxpro Serial Communications

Posted on

I am having trouble reading information collected from a scale connected to COM1: (Windows XP Professional). There is no problem writing data (the fputs statement works fine).

But the fread do loop sits and waits. And waits, virtually tying up all resources on my computer and never populating the cScaleweight variable.

If I remove the do loop and just try to read one byte using only the fread(nHandle,1) statement, I get a timeout error. Microsoft Picture It Photo Premium 10 By Wcpo. How does one read serial data directly coming in the COM port without having to purchase an add-on library?

* Open Connection to scale nHandle = fopen('com1:9600,n,8,1',2) =fflush(nHandle) * Send Command nRet = fputs(nHandle,'GIVE_WEIGHT') =fclose(nHandle) * Read Result nHandle = fopen('com1:9600,n,8,1',0) cScaleValue = ' do while true cRead = fread(nHandle,1) if cread = chr(13) exit else cScaleValue = cScaleValue + cRead endif enddo =fclose(nHandle) Thanks Ron.

Serial communication - Visit our Forum to discuss: [Serial communication] and [Serial,communication] home: signup: forum: archives: search: google. Jump Start: Reading For Kindergartners there. Visual FoxPro. Vfp Serial Port Toolkit Software Store. Windows Std Serial Comm Lib for FoxPro Serial communication component Visual FoxPro library for serial port communications.

Visual Foxpro Serial CommunicationsVisual Foxpro Serial Communications