Skip to main content

Messages

This section allows you to view all Messages made by this member. Note that you can only see Messages made in areas you currently have access to.

Messages - rajabalu

1
Bus Pirate Support / Re: Bus Pirate Manual link does not show much information
Ian a downloadable PDF file would be easier to look-up and search (from e-reader/tablet). Any plans for making such a thing available.

And you promised that you will update the site in few days ;). Also looking forward for more of your videos. My six year old is missing your smile.

Regards,
Raja Balu
2
General discussion / Re: SPI 4 digit 7 segmet displays
Aaron - I have used a 74HC595 to control multiple displays. I use the shift register to select the STB of the display we want to control. I wrote a small program using Energia to control 2 displays, but, the idea is the same to control more displays.

The hardware setup is to connect the VCC, CLK, DIN and GND terminals of the displays in parallel and use the Q0 and Q1 from the Shift register to control the STB of the displays.

This article http://http://www.arduino.cc/en/Tutorial/ShiftOut helped me a lot.

Here is a picture of the HW setup .

And a video of the display in action at http://https://plus.google.com/photos/114723575852368105195/albums/5796643611597344577?authkey=CMOflL7LpK-hPQ.

I have listed my Energia code below.
Code: [Select]
#include <SPI.h>

// P1.5 -> CLK
// P2.0 -> CS/SB - Not used here as we are using the shift register
// P1.6 -> DIN
// [0x02][0x40][0x8F][0xC0,0x3F] for bus pirate use
// [0xC0,0x00][0xC2,0x00][0xC4,0x00][0xC6,0x00]
// [0xC0,0x06][0xC2,0x5b][0xC4,0x4f][0xC6,0x66]

// P2.3 -> Data
// P2.4 -> Clock
// P2.5 -> Latch

//const int slaveSelectPin = SS;
const char DISP[16] {
  0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x77, 0x7c, 0x58, 0x5e, 0x79, 0x71};

int latchPin = P2_5;
int clockPin = P2_4;
int dataPin = P2_3;

void setup()
{
  pinMode (latchPin, OUTPUT);
  pinMode (clockPin, OUTPUT);
  pinMode (dataPin, OUTPUT);
  SPI.begin();
  SPI.setBitOrder(LSBFIRST);
  SPI.setDataMode(SPI_MODE2);
  delay(500);
}

void loop()
{
  //set display to 6x12 segments
  // First Display FE 1111 1110
  chipSelect(0XFE);
  SPI.transfer(0x02);
  chipSelect(0xFF);

  // Second Display 1111 1101
  chipSelect(0XFD);
  SPI.transfer(0x02);
  chipSelect(0xFF);
 
  //set to writing mode, auto increment address after data write
  chipSelect(0xFE);
  SPI.transfer(0x40);
  chipSelect(0xFF);

  chipSelect(0xFD);
  SPI.transfer(0x40);
  chipSelect(0xFF);
 
  //first clear 8 bytes of the display RAM
  chipSelect(0xFE);
  SPI.transfer(0xC0);
  for(int i=0; i<8; i++)
  {
    SPI.transfer(0x00);
  }
  chipSelect(0xFF);

  chipSelect(0xFD);
  SPI.transfer(0xC0);
  for(int i=0; i<8; i++)
  {
    SPI.transfer(0x00);
  }
  chipSelect(0xFF);

  //display on, max brightness
  chipSelect(0xFE);
  SPI.transfer(0x8F);
  chipSelect(0xFF);

  chipSelect(0xFD);
  SPI.transfer(0x8F);
  chipSelect(0xFF);

  //count through 0-9,a-f
  chipSelect(0xFD);
  SPI.transfer(0xC0);
  for(int i=0; i<4; i++)
  {
    SPI.transfer(DISP[i]);
    SPI.transfer(0x00);   
  }
  chipSelect(0xFF);
  delay(500);

  chipSelect(0xFE);
  SPI.transfer(0xC0);
  for(int i=4; i<8; i++)
  {
    SPI.transfer(DISP[i]);
    SPI.transfer(0x00);   
  }
  chipSelect(0xFF);
  delay(500);

}

void chipSelect(int value)
{
  digitalWrite(latchPin, LOW);
  // shift out the bits:
  shiftOut(dataPin, clockPin, MSBFIRST, value); 
  //take the latch pin high so the LEDs will light up:
  digitalWrite(latchPin, HIGH);
  // pause before next value:
  delay(500);
}

3
General discussion / Re: SPI 4 digit 7 segmet displays
While we could use the CS/STB line to control the LED display of our choice, I am thinking simple daisy chaining the first display to the second will work. We need to try connecting the DOUT of the first display to the DIN of the second display and so on.. CLK, CS/STB, VCC and GND can be connected in parallel.

I am just guessing here that daisy chaining will work but I am not sure. I will try it out tonight and let you know. Or I need to bring my LaunchPad out to try this chaining effect. Writing a small program in Energia can loop through the data we need to push out (now that we know what commands to type from our Bus Pirate experiments).

I am surprised that you have 30 of these. So the chain will be a long one I suppose. :) What do you plan on using them for?

Since they do not have the decimal point connected, I am not sure whether I could make good use of these. I got 10 of them as they were sold as one lot. I am thinking of making a small clock for my daughter and she has a Lego enclosure ready for the display now. The rest of the displays, I am planing to use them as for displaying voltage, current and for a frequency counter. For me the segments are in green but the colons are in red and so they look funny.
4
General discussion / Re: SPI 4 digit 7 segmet displays
[quote author="CheezeWiz"]... Sh1t I was literally [.] close...

What's the deal with the last part? the comma? in the syntax?

--Aaron[/quote]
Comma is to hold the STB at the same level and send the next piece of information.
5
General discussion / Re: SPI 4 digit 7 segmet displays
Aaron - The braces '[' and ']' need to be present for each command. We tried to do it all together like [0x02,0x40,0x8F,0xC0,0x3F] before. The correct call is [0x02][0x40][0x8F][0xC0,0x3F].
6
General discussion / Re: SPI 4 digit 7 segmet displays
Aaron - I figured it out

Here are the Pin mappings:
VCC- 3V3
STB - CS
CLK - CLK
DIN - MOSI
DOUT - Not connected
GND - GND

Here are the Bus Pirate commands/setup:

HiZ>m
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
x. exit(without change)

(1)>5
Set speed:
 1. 30KHz
 2. 125KHz
 3. 250KHz
 4. 1MHz

(1)>1
Clock polarity:
 1. Idle low *default
 2. Idle high

(1)>2
Output clock edge:
 1. Idle to active
 2. Active to idle *default

(2)>1
Input sample phase:
 1. Middle *default
 2. End

(1)>1
CS:
 1. CS
 2. /CS *default

(2)>2
Select output type:
 1. Open drain (H=Hi-Z, L=GND)
 2. Normal (H=3.3V, L=GND)

(1)>2
Ready
SPI>L
LSB set: LEAST sig bit first
SPI>W
POWER SUPPLIES ON
SPI>[0x02][0x40][0x8F][0xC0,0x3F]
/CS ENABLED
WRITE: 0x02
/CS DISABLED
/CS ENABLED
WRITE: 0x40
/CS DISABLED
/CS ENABLED
WRITE: 0x8F
/CS DISABLED
/CS ENABLED
WRITE: 0xC0
WRITE: 0x3F
/CS DISABLED
SPI>

You should see 0 displayed on the LED Display.

7
General discussion / Re: SPI 4 digit 7 segmet displays
Aaron - Did you try turning on the power by using the W command after entering SPI mode?

Ian - If you don't mind can you take a look at the datasheet for PT6961? I have posted just the timing diagram for your reference. Any help about SPI setup for this device is greatly appreciated.