In SX Microcontrollers, SX/B Compiler and SX-Key Tool, g_daubach wrote: Hi Chris and Peter, I fully agree with Peter that arranging the LEDs in a multiplexed matrix is the less component-intensive method. I'm using a similar arrangement in one of my commercial applications, driving a matrix of 8 by 8 LEDs with good success. Nevertheless, I have some concerns about the "minimum solution" Peter has recommended: As the LEDs are multiplexed, an LED that shell be "on" is not actually "on" all the time. It is only on when the port "sinking" bit, or the row line is low. To avoid a visible "flicker", the scanning must be fast enough, say at least 100 Hz, i.e. each LED will be driven every 10 ms. Driving the matrix at higher scan rates only increases the switching losses but not the quality of the display as our eyes are not capable of noticing faster on/off sequences. Assuming a 100 Hz scan rate, each LED that shall be "on" will be turned on every 10 ms for 2.5 ms, as there are four row lines that are periodically pulled low within the 10 ms period. IOW, an "on" LED will be pulsed at a duty-cycle of 25%. A standard LED requires about 10 mA forward current for an acceptable brightness. As the LEDs are driven at 25% duty cycle, the peak current should be 40 mA for an average of 10 mA. Depending on the LED type you are using, a lower average current may be fine enough, especially because pulsed LEDs seem to be brighter at lower average currents, compared to non-multiplexed LEDs. Let's assume that an average current of 5 mA would be enough, so the peak current would be 40 mA for each LED. The SX28 data sheet specifies the maximum current to be sourced or sinked by an output pin at 45mA, and the maximum current out of the Vss pin, and into the Vdd pin at 130 mA each. If we assume the absolute worst case, i.e. all LEDs in the matrix shall be "on", this means that the average current to be sourced by each of the column-driving pins is 5 mA * 4 = 20 mA. This is below the maximum for an output pin, but as eight pins need to source this current, the required current into the Vdd pin would be 8 * 20 mA = 160 mA, This is 30 mA above the absolute maximum ratings. The same is true for the four row-driving pins. Each of them would have to sink an average of 5 mA * 8 = 40 mA. So the total average current these four pins sink out to the Vss pin must also be 160 mA (4 * 40 mA). Besides the current into the Vdd pin, or out of the Vss pin for the LEDs, the SX needs do draw additional current to operate, depending on the clock frequency used, etc. When you can make sure that your application never needs to turn "on" more LEDs that can be driven by the SX within its maximum ratings, it is fine to use the layout, Peter had suggested. You also may use "extra bright" LEDs that require less current, allowing you to increase the value of the eight current-limiting resistors. The schematic I have attached shows an LED matrix similar to what Peter has suggested with additional driver transistors for the row and column lines with resistors between the bases and the port pins (about 10 kOhm each). With these transistors installed, you take away from the SX the "burden" of directly driving the LEDs. In order to activate a matrix row, one of the RB3...0 lines must be high with all other lines low. To turn an LED "on" in a row, the assigned RC port pin must be set to low. When your application does not drive the SX to its limits, you may discard the transistors with their base resistors, and drive the row and column lines directly from the SX. In this case, to select a row, drive the assigned RB pin low, and drive all RC pins high for the LEDs to be turned "on" in that row. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=162118#m162189 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)