circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

Issue 144 July 2002
Driving the NKK Smartswitch

Part 1: Configuration and Software


by Aubrey Kagan
Sure, the NKK Smartswitch looks like a cool device, but how can you actually use it? Aubrey found the answer with a little help from a Cypress Microsystems PSoC microcomputer. In this article, Aubrey describes the interface to drive the Smartswitch.

Start Hareware Interface Module Implementation Sources & PDF

The NKK Smartswitch is a single-pole, normally open switch with an LCD screen that serves as its activator. I have often looked at the advertisement for the Smartswitch and thought about how cool it would be to use it. But where and how can the Smartswitch be used? In this series of articles, I’ll explain my answer to those questions.

The switch head of the Smartswitch consists of a 24 × 36 pixel LCD and some rudimentary driver electronics that drive one row at a time. Control signals are required to shift out the pixel state for each row, latch the pixel states, and synchronize the first line. In addition, the display has a backlight that can be configured as red, green, or yellow. I have tried to make the display interface pixel addressable to allow for the mixture of graphics and text to be placed anywhere on the screen.

Obviously, a microcomputer is needed to drive the display. I wrote the software so that the user interface is through a series of RAM locations. This allows display access to an external hardware interface such as a serial or parallel driver (based on the microcomputer’s capabilities) in a stand-alone application or a concurrent task resident on the microcomputer.

At this time, I am unaware of any published projects that use a Cypress PSoC microcomputer. However, I’m sure this will change in the near future as more users begin to appreciate the advantages of the PSoC. The versatility of its I/O configuration, the low cost of its development tools, and the price and performance of its peripherals make it an extremely attractive option. In addition, the PSoC is available in DIP packages, which is great for low-volume applications and debugging. And that’s a plus for aging baby boomers who have difficulty seeing the pins on SMD devices, let alone connecting an oscilloscope probe to one.

The LCD

The LCD is controlled row by row with a 40-bit shift register. The first four bits shifted out are invisible, but they must be included in the shifting process. Each pixel has been allocated a number so that the software implementation can address a specific location. You can see this allocation in Table 1. The firmware display driver creates a memory map where each pixel maps to a unique bit in RAM. As you’ll see, the map is continuously output to the display by the drivers.

Table 1—The numbering of the pixels is arbitrary. Pixels 0, 40, 80, etc. are the first bits shifted out for each row.

In order to economize on RAM, the memory map is implemented as a 24 × 5 unsigned character array (cMatrix [24][5] in the software). Obviously, the first index is the row number and the second refers to the column number. Each bit in a byte is allocated to a pixel as shown in Table 2.

Table 2—In RAM to pixel mapping, for example, the most significant bit of cMatrix[1][0] will map to pixel 79 and the least significant bit of cMatrix[0][2] will map to pixel 16.

The design of the Smartswitch allows for multiple switches by linking the 40-bit shift registers. Because of the processor’s RAM limitations, I have left room for only one switch and one controller. I believe the road map for the PSoC includes devices with up to 1 KB of RAM, so it may be possible someday to expand the application. At any rate, the PSoC’s low cost may allow for a multiprocessor solution because the switch itself is around $50.

Currently, PSoC Designer does nothing to enhance this. It allows for one configuration and then it’s up to you to create alternatives to overlay these functions. Cypress has decided that this feature is a competitive advantage, so they have a new version of their PSoC Designer in the wings that will simplify this process.

Cypress produces three kinds of documentation. The first is the standard datasheet, which at first glance is somewhat bewildering because of the variety of configuration options. When you select a module in the user interface, a datasheet for the module appears on the screen. In addition to samples of the code, the datasheet reading includes all the relevant registers and I/O points. As your product is configured, the PSoC Designer creates a third datasheet specifically for that particular arrangement so you have complete documentation of your product.

All of this is available in an 8- to 64-pin package for about $5. A full development environment that includes C costs less than $300. And you’d think they were paying me to say this, but unfortunately they’re not.