Jump to content

Search the Community

Showing results for tags 'tm1638'.



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.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests


Sparkfun


Github

Found 2 results

  1. shluzzzoid

    ds1394 RTC + led driver tm1638

    Hello! This is my project Real Time Clock. The project used RTC module ds1394, temperature sensor ds18b20 and driver 7-segment display tm1638. msp430g2553 MCU integrates devices with two hardware ports SPI (USART1, USART2). Clock Functions:- Showing the time, date, day of the week; - Set the alarm; - Shows the temperature of the sensor ds18b20; - Control the brightness of the indicator. Video: Russian description Source code Video: My project site Project includes: - DS1394 msp430 launchpad interface - ds18b20 maxim + msp430 launchpad - Library for TM1638 to MSP430 PS: my son was born! Now I do not know whether the time to continue the projects. I hope that I can find the time to do a good description of the projects. PPS: Sorry for my english...
  2. 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
×