Using Phidget USB Devices with PiXCL 10 (Released February 2011)

Last update: 03-July-2017

Support for Phidget USB devices is provided in PiXCL using an extension command DLL. C++ source code is provided in a Visual Studio project. The extension command names are arbitrary (though there are simple naming rules) and just about any Phidget device can be supported by adding more commands.

Like us on Facebook.

 1203 PhidgetTextLCD

The first supported device in the provided C++ DLL source code. The TextLCD includes 8 analog inputs with sensitivity 0-5Vdc, with adjustable sample rate, 8 digital inputs such as switches, and 8 digital outputs that can control relays or drive LEDs.

  Here's an example of the TextLCD and a Decaf-1 Smart Panel. Both devices are controlled by a PiXCL application.

 

 1012 Phidget Interface Kit 0/16/16

Handled the same as the digital I/O ports in the TextLCD, except it has a different ID code.

 

 1018 Phidget Interface Kit 8/8/8

Handled the same as the 8-8-8 ports in the TextLCD, except it has a different ID code. 

 

 1019 Phidget Interface Kit 8/8/8 w/6 Port Hub

Handled the same as the 8-8-8 ports in the TextLCD, except it has a different ID code. The hub ports are used to attach additional Phidget devices, or other USB devices, into a composite assembly.

 

 1055 PhidgetIR

As suggested by Phidget, a TV remote can be used as the event source, and once an extension command receives it, the event is passed back to the PiXCL application.

PiXCL 10 can control a Phidget device by sending commands to the device, such as setting switches and querying the value of an input.

PiXCL 10.1 extended support for event driven extension commands with a jump-to label which is the event handler. The extension command DLL format allows for event pre-processing within the extension command before the event is returned to PiXCL, if this is useful.

For example, a 1203 TextLCD can have all 24 I/O ports assigned to switches, analog sensors and other devices. When a switch is changed, or an analog input varies, an event is signaled to the PiXCL application.

In the PXLphidget.DLL sample code, some of the 25+ defined extension commands are

Extension Command

Description

  pgtTextLCDAnalogInputEvent  Return an analog input event with port number and value to PiXCL.
  pgtTextLCDDigitalInputEvent  Return a digital input event with port number and state to PiXCL
  pgtTextLCDDigitalOutput  Change the state of a digital output.
  pgtTextLCD  Sends two lines of text to the LCD
  pgtSetParam  Set the LCD brightness, contrast or backlight value, and cursor or blink state. Command pgtGetParam also exists.

  pgtTextLCDAnalogInputDataRate

 Sets the analog input sampling rate
  pgtInterfaceKit888Disconnect  Disconnects the InterfaceKit 8/8/8 only.
  pgtTextLCDDisconnect  Disconnects the TextLCD only.
  pgtDisconnectAll  Disconnects all attached Phidget devices.

The returned values for input ports are not limited to just the port the initiated the event. The existing sample code could easily modified to, say, return all digital states when one port raises an event.

The DLL code also includes floating simulator windows (shown below) for the TextLCD,Interface Kit 8/8/8 and Interface Kit 0/16/16 that can be used to test applications when the hardware is not present.

  

 

These windows include

  • push buttons ( = digital inputs) that display a red spot to indicate that the switch is on.
  • sliders ( = analog inputs) that display the value as the slider is moved. When the slider is released an event is passed to the PiXCL application with the new analog input value.
  • radio buttons ( = digital outputs) that change colour when the output is enabled.
  • two display panels that equate to the TextLCD 2x20 LCD.
  • A floating selector window is also provided.

The pgtTextLCD command sends text to the simulator window if the hardware is not present.

Like us on Facebook.


Copyright 2011-2019 PiXCL Automation Technologies Inc, CANADA. All Rights Reserved.