Comm32 Logo
Home Button  Buy Button 

Topic:   SCOMM32 and PB - 64 bit

By: OpenLinkPosted on: Jul 18 2017 at 04:44:47 PM
The control exposes the onComm event. In the PB IDE we can see it and code for it at design time. PB IDE (32 bit) embeds the 32 bit GUID in the code so for 64 bit we have to load the control dynamically. That works but we can't code for event handlers on the control. Must we write timer loops to check the commEvent property value? Any other way to do this?

By: GuestPosted on: Jul 19 2017 at 07:02:20 PM
Sorry. Never used PB. Look at this page. Not sure if the same syntax works (look nearer the bottom of that page for the syntax. Slightly different syntax in newer versions of the OCX.

Late Binding, CreateObject WithEvents

By: OpenLinkPosted on: Jul 21 2017 at 02:41:45 PM
PowerBuilder does not currently support the VB syntax illustrated. Wish it did. Life would have one fewer problem to solve

Is it possible to interact with ports via functions alone (call wait check etc...) Example?

By: GuestPosted on: Jul 24 2017 at 09:28:02 PM
I guess the event handler you want is the OnComm event.

Does power builder have timers? I mean can you set up an event to trigger, say, every 50 or 100ms? Could you simply call the Input or Read method to see if there's any incoming data?

By: GuestPosted on: Jul 25 2017 at 09:55:41 AM
Power Builder might not support the VB syntax but surely it has it's own syntax for subscribing to an event from an Ocx?

On the other hand setting up a timer to read incoming data from the port is quite a common way of doing it especially if you know that data is always coming in. But don't use the CommEvent property. That might only be accurate if you're actually getting OnComm events. If doing it in a timer I'd suggest setting the RXThreshold and TXThreashold to zero so SComm doesn't waste time trying to fire events and then, in your time, just call .Input or .Read to get any data waiting in the receive buffer (or an empty string if there is no data). Either way it's still pretty quick.

By: JamesPosted on: Aug 2 2017 at 11:37:34 AM
Timer is the solution I will use. But can you suggest how quickly the timer should events should work?

By: Gues#3Posted on: Aug 2 2017 at 11:49:53 AM
I assume you mean the timer interval. I don't want the receive buffer to overflow.

If your baud rate is 9600 then that is 9600 bits. With Stop and Start bits you're looking at max 960 bytes per second. So if your InBufferSize is bigger that 1000 then, in theory, you only need to empty the buffer once per second.

I think the size of the receive buffer has a minimum of 4k that's around 4 seconds worth of data at 9600bps.
2 seconds at 19200, 1 second at 38400 etc etc.

If you set your receive buffer at 16384 (16k) and your timer to 100 (100ms) then you should have no problems.

Of course only you can know how responsive your application needs to be.

In the timer event do not hang round. Just read all of the data, process it and exit the timer event. Don't sit in a loop calling doevents etc. That's bad coding.

Reply - add a comment to this topic.

You may enter letters, numbers and standard punctuation only. HTML and other scripts/tags will be rejected.

Topic:- SCOMM32 and PB - 64 bit

Enter the numbers.

Your name here is optional