Jump to content
43oh

SPI 4 digit 7 segment displays


Recommended Posts

  • Replies 38
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

OK, got mine, they are green with red colon, not sure what BLUE + RED mean (maybe that's why they ended up with the surplus guy ) In any case, thanks for finding them touch, they are awesome.   He

in answering the question of whether there are decimal LED's buried in there somewhere I can conclusively say no there are not.   I sacrificed one to the gods of tearing stuff apart and found there

I found these on eBay and bought some: http://www.ebay.com/itm/NEW-Lot-10-Oasi ... 0807998835   They are 7 segment displays with the PT6961 driver chip built in. Datasheet here: http://www.princeto

Posted Images

  • 1 month later...

I posted an Arduino compatible sketch in the first page of this thread.

viewtopic.php?f=8&t=3225&start=10#p23243

 

I tried this code on an Arduino Due, but I cannot find what is the correct pins to use on that, have been searching all over the Arduino websites, but no.

I found some pinoutguide in the forums, looks like SS is pin 53 and Mosi is pin 51, and there are also an spi header in the middle of the board, tried all of those, but no-go..

 

Energia, is that an arduino compatible IDE for the msp430 launchpad?

Link to post
Share on other sites

Sweet, got mine today, just posting a simple USCI_B example for the G2553 that echoes what RobG said for turning on all segments:


#include <msp430.h>
#include <stdint.h>

void spi_init();
uint8_t spi_transfer(uint8_t data);

int main()
{
WDTCTL = WDTPW | WDTHOLD;
DCOCTL = CALDCO_16MHZ;
BCSCTL1 = CALBC1_16MHZ;
BCSCTL2 = DIVS_2; // SMCLK = 8MHz
BCSCTL3 = LFXT1S_2; // ACLK = VLO
__delay_cycles(8000); // Wait for VLO settling
while (BCSCTL3 & LFXT1OF)
;

P1DIR |= BIT1;
P1OUT |= BIT1;
P1SEL &= ~BIT1;
P1SEL2 &= ~BIT1;
__delay_cycles(8000);

spi_init();

P1OUT &= ~BIT1;
spi_transfer(0x02); // Display mode = 6 digits, 12 segments
P1OUT |= BIT1;
P1OUT &= ~BIT1;
spi_transfer(0x40); // Data Write settings; normal, increment addr, write to display mode
P1OUT |= BIT1;
P1OUT &= ~BIT1;
spi_transfer(0x8F); // Display=ON, dimming = maximum brightness (pulse width 14/16)

P1OUT |= BIT1;

P1OUT &= ~BIT1;
spi_transfer(0xC0); spi_transfer(0xFF); // Digit 1 = All segments lit
P1OUT |= BIT1;
P1OUT &= ~BIT1;
spi_transfer(0xC2); spi_transfer(0xFF); // Digit 2 = All segments lit
P1OUT |= BIT1;
P1OUT &= ~BIT1;
spi_transfer(0xC4); spi_transfer(0xFF); // Digit 3 = All segments lit
P1OUT |= BIT1;
P1OUT &= ~BIT1;
spi_transfer(0xC6); spi_transfer(0xFF); // Digit 4 = All segments lit
P1OUT |= BIT1;

LPM4;
return 0;
}

void spi_init()
{
/* Configure ports on MSP430 device for USCI_B */
P1SEL |= BIT5 | BIT6 | BIT7;
P1SEL2 |= BIT5 | BIT6 | BIT7;

/* USCI-B specific SPI setup */
UCB0CTL1 |= UCSWRST;
UCB0CTL0 = UCCKPL | UCMST | UCMODE_0 | UCSYNC; // SPI mode 0, master
UCB0BR0 = 0x01; // SPI clocked at same speed as SMCLK
UCB0BR1 = 0x00;
UCB0CTL1 = UCSSEL_2; // Clock = SMCLK, clear UCSWRST and enables USCI_B module.
}

uint8_t spi_transfer(uint8_t data)
{
UCB0TXBUF = data;
while ( !(IFG2 & UCB0RXIFG) ) // Wait for RXIFG indicating remote byte received via SOMI

;
return UCB0RXBUF;
}

Link to post
Share on other sites
  • 6 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...