Search the Community

Showing results for tags 'Led matrix'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks

Calendars

There are no results to display.


Found 6 results

  1. This is my entry to the POTM Nov-Dec 2013. Minimalist's Clock? Multi-mode Clock? Matrix Clock? M-Clock Description to follow...
  2. Hey Guys, Exam times again, so I feel like I have a tonne of time for my projects. This is a project I started in February 2014. I found a very nice 8x8 dual colour LED display. I designed a PCB for them when I ordered them, instead of when I actually had them. I had built a PCB up with a G2542 8kb / 512b (Mem/RAM) but didn't manage to get it working. Over the last few weeks I got back into this project, and low and behold it did actually work!! I built up a new PCB because it was designed as a common cathode driver, but the displays were common anode.... (on the first board, I had bridged the common mosfets.) of course using 0402 parts. (this display need 64 of these O_O) back of PCB contains clock, half a DCDC stepup and a BMA222 accelerometer. Front & back Now I needed a case, this is my first project I decided to actually make use of a cheap chinesse laser cutter I now own. The piece with all the slits in it create a "living hinge" which creates a cool organic looking case. as opposed to a rectangle. I'm still working on improving code. Basic clock functionality is in. lastly I'll leave you with my dud designs. which while not very practical. are actually 100% useful. A failed design can teach you alot! I will be making this open source, I would like to make more in the future, which may involve buying more displays from china (if there is interest maybe even a group buy?? )
  3. I'm very interested in this Dancing traffic light, can msp430 do this? https://www.youtube.com/watch?v=SB_0vRnkeOk
  4. A quick port to Energia of the famous LedControl library for Arduino. Download: https://github.com/elpaso/ledcontrol-energia Original library: http://playground.arduino.cc/Main/LedControl Enjoy!
  5. Earlier this year I happened to be in Singapore in transit, and took the opportunity to visit Sim Lim Tower - a high-rise mall full of electronic components shops! Amazing place, and amongst other things (including super-cheap kits for the kids to build!) I picked up three 5x7 LED matrix panels for a dollar each (!!). They didn't have any part numbers that I could see, but after experimentation they turned out to be row-anode devices and once I figured out the pinout I decided to build a project out of them. As any of us who have children know, it's a daily battle to get kids to brush their teeth for long enough, and as any of us who have children also know, time spent on projects goes down better if there's a kid angle to it. So I decided to make a tooth brush timer, that will display a countdown from two minutes - interspersed with inspirational text and probably amusing patterns and other things to keep the kids entertained during their twice-daily two-minute ordeal. Poor things. Being given to doing things the hard way, I decided to design two boards - one for the LED panels, and one for the controller. I'll get to the controller board in a later post because it's quite complicated (since the board fab place makes 10 identical boards I decided to try to make it as multi-purpose as possible). The LED boards though are simpler, they just use a 4094 shift register to handle the columns (or rows, I decided to use my three matrices abutted end to end rather than side to side, giving me a display that's five LEDs high and twenty-one across. I found a nice 5x5 bitmap font on dafont.com, and decided that I had enough space for what I needed to display. Because if all the LEDs are on the 4094 will be over it's specified current limit, it drives the columns through seven PNP transistors. This meant quite a bit of routing, which is what led me to use a board fab house rather than attempt it all on veroboard. So, onto the code (I have attached the eagle files if anyone is interested). I wanted to use the USI module to drive the 4094's. Looking at the datasheet for a 4094, it clocks in it's data on a rising edge of the clock. So the USI module will need to be configured thusly (I'm running the CPU at 12Mhz). // Reset USI logic to allow configuration USICTL0 |= USISWRST; // Setup serial output for a 4094 shift register USICTL0 = USIPE6 // SDO enabled + USIPE5 // CLK enabled + USIMST // master mode + USIOE // output enable + USISWRST // leave in reset ; // clock phase = 1, interrupts enabled SICTL1 = USICKPH // phase = 1 + USIIE // interrupt enabled ; USICKCTL = USIDIV_4 // divide by 16, giving 500khz clock + USISSEL_2 // SMCLCK as clock source ; // release SPI for operation USICTL0 &= ~USISWRST; Now, the tricky part of this project is that I want to have greyscale (redscale!) on my LEDs. To do this I will have to not only row-scan the matrix, but also PWM each LED individually. And I want to do all this in the USI interrupt handler, and have a framebuffer in RAM that I can just write to at any time without having to worry about getting the LEDs to update. So first thing is the framebuffer, I'm just using one LED matrix at the moment so it's only a 5x7 array: unsigned char framebuffer[5][8]; // greyscale framebuffer So, for those unfamiliar with how to drive these types of LED matrices, here's a bullet-pointed flow-chart. Start at the first row. Clock bits into the 4094 shift register, corresponding to which LEDs in the current row are on. Because I'm using PNP transistors as high-side switches, a zero in the 4094 outputs will correspond to an LED being on. Once the bits are clocked in, set the 'strobe' input into the 4094 to high. This will latch the outputs of the 4094, causing them all to change at once to whatever you just clocked in. Now that the high-side transistors are all either on or off, according to which LED in the current row you want to be on, it's time to turn that row on using the low-side switch for that row. Of course there could be quite a bit of current flowing out through the row pin if all the LEDs in that row are on, so it's not safe to just hook it up to a GPIO pin. A FET is instead used as a low-side switch. Now the row is lit up. Move to the next row and goto 2. If we're at the last row, then instead goto 1 (which means start over). The above method, if run fast enough, will cause all the LEDs to appear illuminated in whatever pattern you desire. But it won't allow brightness control of individual LEDs. To get that we need another variable, that I'll call PWM. PWM will start at zero, and will be incremented at step 1 of the above bullet-pointed flowchart. When it reaches 16, it will be reset back to zero. So it's a rolling counter that will count up each time a frame is output to the matrix, and will roll over at 16. Using this, and the greyscale framebuffer above, we can modify the flowchart so that instead of just clocking in whichever LEDs are on into the 4094, we clock in whichever LEDs have a brightness value that is greater than the current PWM counter. Thus, when the framebuffer entry is zero for a particular LED, that LED is never illuminated because it's brightness value (zero) is never greater than the PWM value (zero to fifteen). And when the framebuffer entry is sixteen, it's always greater than the PWM counter, and thus that LED is illuminated every frame. In between values illumiate the LED for varying numbers of frames, which - if you run the whole process fast enough - will cause them to appear dimmer. The heart of this code is the following loop, which I would love some advice on how to optimise: output = 0; for(bit = 8; bit ; bit--) { output <<= 1; output |= (framebuffer[row][bit] > pwm) ? 0 : 1; // on if over pwm } This loop calculates what to output to the 4094 shift register for each row. It's quite alot of work for an interrupt handler, and it needs to be three times more work once I add the additional two LED panels. I'm sure the compiler in CCS does a good job of figuring out the loop and optimising it for me, but I should take a look at the assembly output and determine if I can do any better. Anyway, to kickstart the process, the main program calls NextRow(), and then sets up a timer and fiddles with the framebuffer at intervals. So, here's NextRow and the USI interrupt handler: unsigned char pwm = 0; unsigned char row = 0; void NextRow() { unsigned char bit; unsigned char output; // strobe low ready for next thingy P1OUT &= ~BIT3; // next row's data - work out if each pixel should be on output = 0; for(bit = 8; bit ; bit--) { output <<= 1; output |= (framebuffer[row][bit] > pwm) ? 0 : 1; // on if over pwm } USISRL = output; // 8 bits out, we'll come back to _usi once these bits have been clocked out. USICNT = 8; } #pragma vector = USI_VECTOR interrupt void _usi() { USICTL1 &= ~USIIFG; // reset interrupt flag // turn off rows P2OUT = 0; // latch data P1OUT |= BIT3; // Strobe high // turn on rows P2OUT = (1 << row); // next row row++; if (row == 5) { pwm++; pwm &= 0x0F; // loop pwm back to zero when it hits sixteen row= 0; // start at row zero again. } NextRow(); } I've left alot of stuff out here, setting up the clock module and the GPIO pins etc etc. Also there's code in the project that makes a pretty (ish) pattern, and the displays some numbers. The code and eagles files are attached, and assuming I can use the video feature of BBcode correctly, here's a video! http://www.youtube.com/watch?v=gvPZ8LyGYGY --Edit--- Well that youtube embed didn't work. Here's a link. How do you embed videos anyway? LED control.zip
  6. Hello! My library for interacting an MSP430g2553 with a TM1638 (SPI 3-wire mode) Description MSP430G2xx3 - USCI_A0 SPI Master Interface to TM1638, Read/Write command, key scanning, show digit and switch LEDs on board. TM1638 - Driver for Led's indicator, 10 segment output lines, 8 grid output lines, 8 segment/key - 3 lines scanning. Features Support for the TM1638; Support for dimming the display and LEDs; Reading simultaneous button presses Connection diagramm: Code: #include "msp430g2553.h" // MSP430 Ports Define #define LED_RED BIT0 //RED Led #define LED_GRE BIT6 //Green Led #define STROBE_TM1638 BIT5 #define DIO BIT2 #define CLK BIT4 // TM1638 Commands Define #define RED_TM1638 0x01 //RED Led #define GRE_TM1638 0x02 //Green Led #define DATA_WRITE_INCR_ADDR 0x40 //Command to switch TM1638 for automatic increment address mode #define DATA_WRITE_FIX_ADDR 0x44 //Command to switch TM1638 for fix address mode #define DATA_READ_KEY_SCAN_MODE 0x42 //Command for read key code from TM1638 #define ADDRSET 0xC0 //Command to set address 0x00 #define DISP_ON 0x8F //Command to Display ON and set (max) brightness #define DISP_OFF 0x80 //Command to Display OFF //#define MIN_VOLT 2700 //Critycal voltage of power OFF const unsigned int Num[]= //Code table of symbols { 0x3F, //0 0x06, //1 0x5B, //2 0x4F, //3 0x66, //4 0x6D, //5 0x7D, //6 0x07, //7 0x7F, //8 0x6F, //9 0x40, //Minus 0x63, //Degree 0x39, //"C" 0x00, //Blank 0x3E //"U" }; const unsigned int ERROR_DATA[] = { 0x79, // E 0x50, // r 0x50, // r 0x5C, // o 0x50, // r 0, 0, 0 }; //Function definitions void init_Ports() { P1OUT = 0x00; // P1 setup for LED & STROBE output P2OUT = 0x00; // P2 setup for output P1DIR = LED_RED + LED_GRE + STROBE_TM1638; P1SEL = BIT1 + BIT2 + BIT4; // Set secondary functions for PORT1 P1SEL2 = BIT1 + BIT2 + BIT4; // P1.1 - TXD, P1.2 - RXD P1OUT |= STROBE_TM1638; // Chip Select, Set STROBE = "1" } void init_WDT() { WDTCTL = WDTPW + WDTHOLD; //Stop watchdog } void init_SPI() { UCA0CTL0 |= UCCKPL + UCMST + UCSYNC; // 3-pin, 8-bit SPI master UCA0CTL1 |= UCSSEL_2; // SMCLK UCA0BR0 |= 0x02; // /2 UCA0BR1 = 0; // UCA0MCTL = 0; // No modulation UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine** } void SendCommand(unsigned char Command) { //Transmit Command P1OUT &= ~STROBE_TM1638; //Set STROBE = "0" _NOP(); _NOP(); P1OUT |= STROBE_TM1638; //Set STROBE = "1" _NOP(); _NOP(); P1OUT &= ~STROBE_TM1638; //Set STROBE = "0" _NOP(); UCA0TXBUF = Command; while (!(IFG2 & UCA0TXIFG)); P1OUT |= STROBE_TM1638; //Set STROBE = "1" } void SendData(unsigned int address, unsigned int data) { //Transmit Data SendCommand(DATA_WRITE_FIX_ADDR); P1OUT &= ~STROBE_TM1638; //Set STROBE = "0" UCA0TXBUF = (0xC0 | address); while (!(IFG2 & UCA0TXIFG)); UCA0TXBUF = data; while (!(IFG2 & UCA0TXIFG)); P1OUT |= STROBE_TM1638; //Set STROBE = "1" } void ShowDig(int position, int Data, int Dot) //show single digit { SendData(position << 1, Data | (Dot ? 0x80 : 0) ); } void ClearDig(unsigned int pos, unsigned int dot) { ShowDig(pos, 0x00, dot); } void ShowLed(int Number, int Color) { SendData((Number << 1)-1, Color); } void ShowLeds(int color) { unsigned int i; for (i=1; i<9; i++) { ShowLed (i, color); } } void DisplayClean() { //Clean RAM of TM1638 int i; for (i=0; i<17; i++) { SendData(i, 0x00); } } void SetupDisplay(char active, char intensity) { SendCommand (0x80 | (active ? 8 : 0) | intensity); P1OUT |= STROBE_TM1638; // Set STROBE = "1" } void init_Display() { __delay_cycles(100000); //Time to initial TM1638 DisplayClean(); //Clean display SendCommand(DISP_OFF); //Display off SendCommand(DATA_WRITE_FIX_ADDR); //Set address mode SendCommand(ADDRSET); //Set first adress } void ShowError() { unsigned int j; for (j=0; j<8; j++) { ShowDig(j, ERROR_DATA[j], 0); } } int GetKey() { unsigned int KeyData = 0; unsigned int i; P1OUT &= ~STROBE_TM1638; // Set STROBE = "0" UCA0TXBUF = DATA_READ_KEY_SCAN_MODE; while (!(IFG2 & UCA0TXIFG)); __delay_cycles(20); //wait to ready (see datasheet) UCA0TXBUF = 0xff; //Send dummy byte while (!(IFG2 & UCA0TXIFG)); //wait for buffer ready // 1'st reseiving byte = bad for (i=0; i<4; i++) { UCA0TXBUF = 0xff; while (!(IFG2 & UCA0RXIFG)); KeyData |= UCA0RXBUF << i; } P1OUT |= STROBE_TM1638; //Set STROBE = "1" return KeyData; } void main() { unsigned int j; unsigned int Keys = 0; init_WDT(); init_Ports(); init_SPI(); init_Display(); // Example program: for (j=0; j<8; j++) { //example set "01234567" on display ShowDig(j, Num[j], 0); } SetupDisplay(1, 7); // Display ON, max brightness while(1) { ShowLeds(0); //switch all LEDs off switch(GetKey()) { case 1: Keys = 1; break; case 2: Keys = 2; break; case 4: Keys = 3; break; case 8: Keys = 4; break; case 16: Keys = 5; break; case 32: Keys = 6; break; case 64: Keys = 7; break; case 128: Keys = 8; break; default: Keys = 0; break; } if (Keys) { ShowLed(Keys, GRE_TM1638);} ShowDig(7, Num[Keys], 1); } //end of example program } tm1638.rar