Serial Communications

Serial Communications

Postby PeterHarmes » Mon Nov 03, 2008 5:01 pm

Hi,

In our 16bit app we used to use a function that returned a numeric handle
when we initiated a serial port - we now use init_port (xHarbour function) that returns a pointer value of the handle rather than a numeric value. We need a numeric handle for the port to use the fivewin function EnableCommNotification().
Is there any way to get the numeric handle from the pointer value?

I know this is probably a xHarbour question, I have posted this in the xHarbour forum, but havent recieved a response yet and wondered if anyone else has had a similar problem.

Thanks in advance

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Postby Antonio Linares » Mon Nov 03, 2008 8:45 pm

Pete,

Please try this function, where x is your "pointer" value:
Code: Select all  Expand view

MsgInfo( PointerValue( x ) )

...

#pragma BEGINDUMP

#include <hbapi.h>

HB_FUNC( POINTERVALUE )
{
   hb_retnl( ( long ) hb_parptr( 1 ) );
}

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby PeterHarmes » Tue Nov 04, 2008 9:19 am

Thanks Antonio,

I have tested this on my machine and it now returns a numeric handle - i havent got a device attached to my pc at the moment and wont be able to test this fully untill i get to my clients site - i did notice that the value returned is a high number when i was expecting a 0 as no device was present - is this correct?

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Postby Antonio Linares » Tue Nov 04, 2008 9:32 am

Peter,

> i did notice that the value returned is a high number when i was expecting a 0 as no device was present - is this correct?

I can't tell you for sure as we have never used init_port().

FWH comm functions work fine, so we use and recommend them :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby PeterHarmes » Thu Nov 06, 2008 12:55 pm

Thanks for the response Antonio,

I'm at my clients site next week, so i might be able to do some tests then. Is there any examples of sending and reading of strings sent to/from a serial device using FWH functions available? I'm also currently using FWH v7.12 so are there any enhancements/fixes to any of the serial routines since then i should be aware of?

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Postby Antonio Linares » Thu Nov 06, 2008 1:27 pm

Pete,

yes, please review FWH\samples\TestComm.prg, TestCom1.prg, TestCom2.prg and phone.prg

Comm functions have not been modified since your FWH build
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby PeterHarmes » Tue Nov 11, 2008 1:44 pm

Antonio,

I'm currently at a customers site and doing some tests using fivewin functions, however whenever i try to use the function escapecomm to set rts i get an unresolved external when i compile - i'm currently using FWH 7.12 and can't upgrade at the moment untill i get back in the office - is there a way of linking this function in or an alternative way of setting rts?

Thanks

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Postby PeterHarmes » Tue Nov 11, 2008 2:34 pm

Ignore previous post -i found that it should be escapecommfunctions
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 63 guests