The number of modules that a microcontroller can control depends on
- instruction execution time of the microcontroller,
- other tasks that the microcontroller has to perform,
- hardware design, and
- software program.
Example of calculation for how many switches can be driven by a microcontroller:
- Given: microcontroller with
- average instruction execution time of 2us.
- 34% of time to perform other tasks.
- LP-to-LP of 1ms.
- Calculate how many modules can be controlled by this microcontroller.
- Formula for time to refresh one line: (1ms) x (.66) = .66ms = 330 instructions
The data has to be addressed, retrieved, and shifted. The time for each of these tasks depends on hardware and software design. The fastest addressing scheme is to have the buffer of the picture data on the RAM as show below

This scheme has the higher byte of the data pointer holding the module line number and the lower byte of the last module (same number for all the lines). Once the data pointer is loaded, a byte of the data is retrieved and shifted, and the lower byte of the data pointer decrements; another byte of the data is retrieved and shifted and so forth until the lower byte of the data pointer equals zero.
Shifting the data with the microcontroller pins for many modules is very time consuming. In this example we assume the data is written via the microcontroller parallel bus to a device such as the 3-shift register method described above or via serial port (8-bit mode). The shift speed of data must be such that the microcontroller does not wait to write the shift data.
This method takes 3 instructions per byte of data (Load the byte, write the byte to the shift register, and decrement the data pointer.). If the interrupt overhead takes 15 instructions, this microcontroller can control 21 modules: