Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: Serial communications Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
narc
Groupie
Groupie
Avatar

Joined: November 21 2006
Location: United States
Online Status: Offline
Posts: 49
Posted: January 25 2007 at 01:03 | IP Logged Quote narc

I have a for you all

How to I open up the serial port and trigger an event (OnComm in VB, I think) so that I can parse the string that arrived when it arrived?

If not possible, what is the most processor economical way of tapping PH on the shoulder (triggering it) from an outside application? I figure I can write a simple VB app to open the comm port, then OnComm can hand the string off to PH to process.

- jason
Back to Top View narc's Profile Search for other posts by narc
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: January 25 2007 at 07:35 | IP Logged Quote TonyNo

The CallerID macro opens the com port and responds to incoming data. Take a look at that thread.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
narc
Groupie
Groupie
Avatar

Joined: November 21 2006
Location: United States
Online Status: Offline
Posts: 49
Posted: January 25 2007 at 11:27 | IP Logged Quote narc

Got it! So you do a ph_comopen and specify the macro to be called when characters are received. Then in the macro you do ph_comrecvchar() to process the characters.

Looks great. Just one problem. I see that PH only supports comm 1-5, but I have lots of USB->Serial adapters on my HA server. I need support for comm 1-15'ish. Is there a way to work around this limitation?

- jason
Back to Top View narc's Profile Search for other posts by narc
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: January 25 2007 at 12:34 | IP Logged Quote dhoward

Jason,

The ph_com??? functions support any COM port. The 1 thru 5 is the number of the COM control (I know, it's confusing). You can think of it as PowerHome has an array of 1 to 5 COM controls available for use. Each of those 5 COM controls can open whatever COM port number you like. It sounds as if the biggest problem you'll have is the current limitation of only 5 user COM controls. You can of course reuse them, but if you need more than 5 open at any one time, you'll have a problem.

I plan to fix this though with the next beta. The generic plugin interface will allow me to create a general COM port plugin (or any other user to as well) and then a user can open this plugin as many times as they need.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
narc
Groupie
Groupie
Avatar

Joined: November 21 2006
Location: United States
Online Status: Offline
Posts: 49
Posted: January 25 2007 at 15:22 | IP Logged Quote narc

Oh I see... makes sense. Com1-Com5 is a handle to an actual comm port. Ok, I can live with that.

I do look forward to the next beta because having more than 5 handles would rock.

- jason
Back to Top View narc's Profile Search for other posts by narc
 
onhiatus
Senior Member
Senior Member
Avatar

Joined: May 12 2004
Location: United States
Online Status: Offline
Posts: 279
Posted: January 29 2007 at 15:40 | IP Logged Quote onhiatus

Jason, it's also super easy to send a windows message to PH. I ended up going this route when I needed to parse a serial stream as powerhome macros can get pretty messy.

Basically you set up a trigger in powerhome and do whatever you want with the data sent. See Topic: Using windows messaging to send to PH for more info...
Back to Top View onhiatus's Profile Search for other posts by onhiatus Visit onhiatus's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum