Serial Communications

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

Serial Communications

Post by PeterHarmes »

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
User avatar
Antonio Linares
Site Admin
Posts: 42529
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 77 times
Contact:

Post by Antonio Linares »

Pete,

Please try this function, where x is your "pointer" value:

Code: Select all | Expand


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
PeterHarmes
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Post by PeterHarmes »

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
User avatar
Antonio Linares
Site Admin
Posts: 42529
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 77 times
Contact:

Post by Antonio Linares »

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
PeterHarmes
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Post by PeterHarmes »

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
User avatar
Antonio Linares
Site Admin
Posts: 42529
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 77 times
Contact:

Post by Antonio Linares »

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
PeterHarmes
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Post by PeterHarmes »

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

Post by PeterHarmes »

Ignore previous post -i found that it should be escapecommfunctions
Post Reply