New! Video of device in use (better quality coming!)
![]() |
This shows the unit mounted behind a custom milled stainless steel
sheet. The switches are LED illuminated and controlled by the backlight PWM driver, so change illumination in step with the LCD backlight. The four left hand switches are configured as momentary and the four right hand ones as ramp on/off. These are great for controlling ordinary lights and the RGB uplighters. |
Whilst serial is possible, the development platform chosen was the Modtronix SBC68EC (or SBC65EC), currently around £40 (now £52 with the weak pound Jan 2009) and good value for an embedded Ethernet controller. This is an updated version of the older SBC45EC based version.
With the update and the additional pins, xAP 1.3 was added with the extended UID scheme. In addition, PWM control of contrast and brightness added, the latter also controllable via BSC.
The code is written in MPLAB C18 and an ICD2 was used for the programming as well as the boot loader for later revision boards.
The display is a 4x20 LCD using the KS0066 (HD44870 compatible) chip, used in 8 data line mode. Currently this is not configurable for other displays.
The software implements a specific class (message.display) as well as, optionally, supporting untargetted xAP-OSD.display class messages. The backlight supports BSC level and state commands.
A 5 layer (was 3 in the older version) queue is built in and this is a FIFO mechanism, with some additional features - messages with a higher priority are displayed first, even if a message of lower priority is current and a sticky message (Priority 0) is supported which is always the lowest priority. This feature was first introduced to allow a constant display alongside each button/switch.
The board on top is the Modtronix prototyping board with a transistor for the PWM backlight switching and an RC low pass for the contrast PWM. A PCB could be developed but would cost 3 to 4 times more in low volumes.

If there are five items in the queue and a higher priority message arrives, this can 'bump' a lower one off the queue.
Here's a video of it in use.
The board is configured through the serial port - IP address, netmask, gateway, instance, UID ( in the 1.3 format FF.wwxxyyzz:0000) and support for untargetted message are all setup here.
On power up the current configuration is displayed

The switches are connected to RF0-7 and GND. It is recommended that a pull up resistor (say 10K) is used between the RF0-7 port and +5V. The LED's are tied to +5V and each then has an individual 100R to the PWM transistor's collector.
Each switch is setup at configuration time and can be one of:
| On/Off | Will signal state=on when closed and state=off when open. Ideal for sensor inputs. |
| Ramp (Raise/Lower) | Will send state=toggle when closed or opened. After c.500mS will
start to increase the level value and send state=on until it reaches 253
when it will decrease the level. Reports the level in the xAPBSC.Event
after 11 units of change, c every 210mS. This is ideal for dimmers and the operation was designed to be user friendly - if the lights are off then a single press will bring them on. If on and you press and hold they will go off for 500mS and then come on in increasing brightness. If off press and hold then they will come on immediately and then after 500mS increase in brightness. If on then a single press will turn them off. The only way to get a decreasing brightness is to go through maximum. |
| Toggle (momentary) | This toggles the state when closed. Ideal for light switches. |
To configure each type use a binary pattern - for example:
RF4 is for light dimming, RF5,6,7 are On/Off for menu control.
Set On/Off to 11100000
Set Ramp to 00010000
Set toggle to 00000000
These switch configuration details are retained in the EEPROM and displayed at startup on the terminal screen.
The screenshot below shows switch 7 (RF6) held down and using the BSC Mapper in xAP Floorplan the values are sent to xAP DMX512 dimmer. (Old version, xAP 1.2)

LCD graphic display - 126x64 (for SBC65EC/SBC68EC only)
The additional public schema are
class = message.display
display.text
{
Line1="Text to display"
--- mandatory
Line2="Text to display"
--- mandatory
Line3="Text to display"
---optional
Line4="Text to display"
--- optional
Duration="Duration to display in seconds"
--- mandatory
Priority="High|Medium|Low" | "0-9"
--- optional, default is Medium(5)
}
If Priority is 0 then the message has lowest display priority but will remain on
screen.
A priority 0 message cannot be 'bumped' off the queue.
BacklightThe backlight is node 0x0063, 99 decimal. And reports as mm-wave.lcdswitch.instance:backlight
Sending a state=off will turn off the backlight and state=on, on.
Sending a level=xx% or yy/255 will vary the brightness, although this
is not linear due to the LED characteristics.
To program the board you'll need the Modtronix boot loader
1) Remove power from the SBC board and start the Bootloader. Find the .hex
file and set to update the EEPROM.
2) Hit the Connect button on. Apply power to the SBC board. One connected
download the Firmware.
3) Use a terminal (57600-n-8-1) to bring up the config screen (you have three
seconds from power up to hit the key!)
4) On config pages, make any modification and save (Option 8). For example, make
a change on the "xAP Setup" page and select option 8 and then option 8 again to
save .
After selecting the save/update option, the EEPROM will be written with new
configuration data. It will now work after power up again, and the configured
values will be loaded. If downloading a new firmware update then you can untick
the update EEPROM boax and your settings will be saved.
Download soon.
About 3 times a week I get asked for a copy of the source code. Sorry but at present the code is not available and you don't need it to get the device working.
If you have a board running with the Modtronix stack and a development environment and can make changes and load code onto the board then I'm willing to help point you in the right direction to get xAP up and running.
This is not suitable as a first development project for someone without experience of the PIC18F range, C code and TCP/IP, though you only need soldering skills to get the project working as described on this page.