Posts: 175
Threads: 43
Joined: Jun 2004
Here's a link to a free serial port activex control. Most others are about $60. It works well with QM. I'm using it to link to a servo controller.
http://home.comcast.net/~hardandsoftware/NETCommOCX.htm
Matt B
Posts: 1,000
Threads: 253
Joined: Feb 2008
Matt,
Could you post a QM example how this works?
Thanks,
jimmy Vig
Posts: 175
Threads: 43
Joined: Jun 2004
Well, *exactly* 3 years later, I do have an example. That ActiveX control, NETCommOCX, broke when I updated to Windows 7. I lost interest for a while. I just got StrokeReader to work great with QM on Win 7 and XP this weekend. Every other solution I found was too expensive. StrokeReader is free for demo or $7 per user.
Some steps:
- Install the StrokeReader ActiveX control.
- Create a smart dialog in QM and add the control to the dialog.
- Click the COM control in the dialog.
- Click the events button.
- Then click Apply and Close. Much of the code to register and initialize the control is created for you.
- To create an event handler, under the WM_INITDIALOG case statement, type the name that QM gave the new StrokeReader control for your dialog (mine was st3), then type “.” and select CommEvent from the list. Some code, a folder, and an event handler function will be automatically generated.
- Use the StrokeReader website to help with initialization and configuration of the serial port.
- The event handler function will be called when the StrokeReader control receives data, connects, disconnects, etc. Handle the event based on the data passed to the function.
My dialog looks like this so far:
Function MultiScroll_Config_GUI
;\Dialog_Editor
typelib StrokeReaderLib {ED7AED90-6B75-406A-A856-CEFDC6E021FB} 1.76
function# hDlg message wParam lParam
if(hDlg) goto messages
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x80 0 0 53 14 "MultiScroll"
;1 Button 0x54030001 0x4 14 0 26 12 "Exit"
;3 ActiveX 0x54030000 0x0 32 2 18 10 "StrokeReaderLib.StrokeReader {7E42B8C5-73BE-4806-8904-FF4080A696EC}"
;END DIALOG
;DIALOG EDITOR: "" 0x2030307 "" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,StrokeReaderLib.StrokeReader st3
,st3._getcontrol(id(3 hDlg))
,st3._setevents("st3__DStrokeReaderEvents")
,st3.BaudRate=4800
,st3.DataBits=8
,st3.DataMode = 1 ;;1 text, 0 is binary
,st3.PARITY = 0 ;;none
,st3.STOPBITS = 0 ;;1 stop bit
,st3.Port = 6
,st3.RecvIntervalTimeout=1
,st3.RecvSizeThreshold=1
,st3.Connected = 0
,st3.Connected = 1
,
,case WM_DESTROY
,,st3.Connected = 0
,,
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,,st3.Connected = 0
ret 1
err+
,st3.Connected = 0
Matt B
Posts: 1,000
Threads: 253
Joined: Feb 2008
There is a windows 7 installer on the website given in the original post: http://home.comcast.net/~hardandsoftware/NetcommW7.zip
I did piece together from other serial port examples on the QuickMacros site and got it working on Windows 7. I still have some kinks to work out working with serial data.
-Jim
Posts: 175
Threads: 43
Joined: Jun 2004
I had no idea a newer version had been released. Thanks for that! I’ll probably stick with StrokeReader though. I had issues with NETCommOCX crashing QM if I didn’t shut down the thread prior to disconnecting the USB device. StrokeReader sends an event on disconnect, but just reconnects and resumes after the device is plugged back in.
Glad you got it working! What sort of device are you communicating with?
Matt B
Posts: 1,000
Threads: 253
Joined: Feb 2008
I'm working with a parallax propeller microcontroller connected via USB to interpret and send data in shift registers.
Essentially this setup allows me to use buttons and switches to control relays and other logic controlled devices via QuickMacros.
The parallax "SPIN" language is pretty simple and straight forward. Via the OBEX serial driver; binary, hex, and text can be sent to QuickMacros.
Real world manipulation.
-Jim
Posts: 175
Threads: 43
Joined: Jun 2004
Awesome! That is fun stuff.
I initially needed serial comms to interface with my 4 scroll wheel mouse/pad. Each wheel has a different function depending on current active window. Local volume, HTPC volume, brush size in GIMP, elevator trim in Flight X, zoom, normal scroll. It works well, but I enjoy perfecting it. I used a PIC microcontroller to read the rotary encoders and handle the serial comms. QM handles everything else.
Currently I’m using serial comms as one of many links in the chain to allow me to unlock my front door from my phone via the internet. It’s coming along.
Matt B
Posts: 1,000
Threads: 253
Joined: Feb 2008
11-21-2021, 03:53 PM
(This post was last modified: 11-21-2021, 05:12 PM by TheVig.
Edit Reason: verified to be working on current OS
)
Just wanted to put an updated link on this: http://www.hardandsoftware.net/NETCommOCX.htm
Here is an archive.org wayback machine link just in case the website ever goes down:
https://web.archive.org/web/202111211547...commW7.zip
Here is the SHA256 Hash of the file as of today: F7155D62B8CBC13F33AB46766D3BAB7582E3625492444778FCAD284C0446A854
Verified to work on Windows 11 Version 21H2 (Build 22000.318)
I'm going to do some testing with this for controlling LEDs on an ATMega32u4. I'll post an example when I get it working...maybe sooner than another 11 years! Can't believe I started working with a Parallax Propellor board I randomly bought at a local Radio Shack back in 2013. I quickly moved on to working with ATMega328p using Arduino. Now I really like the ESP32 and ATMega32u4...but my heart will always beat for QM!
-The Vig
Posts: 1,000
Threads: 253
Joined: Feb 2008
Got things working at a very basic level. One thing I don't know how to do that I would love some help with is determining which port the Arduino is assigned when plugged in. Usually it's port 3...but it changes. Another is how to better implement NetComm.InputData. Right now I just wait a second to receive the reply from the Arduino.
Function sendToArduino
NETCommOCX.NETComm x._create
BSTR SETTINGS="9600"
VARIANT d="0" ;;0 will trun on TXLED, 1 will turn off TXLED
x.CommPort=3
x.Settings=SETTINGS
x.PortOpen=TRUE
x.Output=d
1
out x.InputData
Function ArdunioINO
int x = 0;
void setup() {Serial.begin(9600);}
void loop() {
,if (Serial.available() > 0) {
,,x = Serial.readString().toInt();
,,switch (x) {
,,,case 0:Serial.print("00");delay(100);TXLED0;break;
,,,case 1:Serial.print("01");delay(100);TXLED1;break;
,,}
,}
}
///NOTE: THIS IS ARDUNIO CODE, NOT QM
|