Pages: 1 [2] 3 4   Go Down
Author Topic: not understanding 7 segment multiplexing  (Read 5077 times)
0 Members and 1 Guest are viewing this topic.
Ft. Worth, Texas
Offline Offline
God Member
*****
Karma: 0
Posts: 591
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No, only 3 - SS, SCK, MOSI, and could be 32 (7 + decimal point, use as warning lights or something, : , etc)
Code:
digitalWrite(SS, LOW);
SPI.transfer (digit1); // data can come from an array even:  SPI.transfer ( displayArray[digit1data] );
SPI.transfer (digit2);
SPI.transfer (digit3);
SPI.transfer (digit4);
digitalWrite(SS, HIGH);
[code]
and in the rest of void loop you create/determine/whatever the digit data will be.
displayArray[0-9] will be the high/lows that create your display of a 0, 1, 2, ...9 or maybe letters A,b,c,C,d,E,F,g,h,i,J,L,P,U
[/code]

Me like much.

so I'd just send the segmentary binary over SPI? <goes to grab the SPI docs>

Say I had 2 displays, about 5 feet apart (opposite side of car).....I'd have 8 shifters total running on 3 wires plus power/ground? They'd all share the SCK and MOSI, each would just have a different SS pin on the mini? So I could use another Cat5 cord to connect the 'slave' display to the 'master' display? SSx4, SCK, MOSI, +12V, and GND?
« Last Edit: January 08, 2012, 03:05:27 am by magnethead794 » Logged

KF5RVR

Ft. Worth, Texas
Offline Offline
God Member
*****
Karma: 0
Posts: 591
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

read the SPI docs. So each shifter would have it's own SS pin- but I could tie the mirrored shifters together to save pins on the mini. So I'd need four SS pins along with the 2 default SCK and MOSI pins- 6 total.

Just have to read up on controlling shift registers.
Logged

KF5RVR

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27144
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, I think I follow that. Be 2 boxes, each with 4 shift registers, one talking to other?
Each display set would have 4 shift registers in series, only need 1 SS for each set. Or just 1 even if both are displaying same thing.

Re-reading, sounds like you have off-board regulator, I moved things around to have headers/holes for regulators and for the segments.
Was also thinking you'd have off board resistors for the digits as they are 12V displays.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27144
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

more tomorrow, need to get these contacts out & get to bed.  G'night.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Ft. Worth, Texas
Offline Offline
God Member
*****
Karma: 0
Posts: 591
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

more tomorrow, need to get these contacts out & get to bed.  G'night.

It's only 3:30AM there in boston...:eek:

I'll research driving shift registers. I REALLY like how this is coming out! Not sure how cascaded shift registers only need one SS, but i'll see fif I can't learn!

Be nice if the drains were all on one side, but I'll take what I can get!

A thought: I could EASILY fit the control system inside a 3"x2"x1" enclosure by affixing the shift registers directly to the display boards! So If I made a PCB (from iTead) that connected the a,b,c...f,g connections over to the shift register, then I would only need SCK, SS, MOSI
« Last Edit: January 08, 2012, 03:41:15 am by magnethead794 » Logged

KF5RVR

Ft. Worth, Texas
Offline Offline
God Member
*****
Karma: 0
Posts: 591
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Found this: http://bildr.org/2011/02/74hc595/

So it's not true SPI. It's just data manipulation by pulling digital pins high and low.

So something like this?

pull Register Clock (RCK, pin 12) LOW (freezes display)

enter for loop (number of digits){

-enter for loop (number of pins, 7 for a 7-segment){
--pull serial clock (SRCK, pin 13) LOW
--send bit to Serial In (pin 3) (which goes to serial out, pin 18, and on to the other shift registers)
--pull serial clock (SRCK, pin 13) HIGH
-}
}

push Register Clock (RCK, pin 12) HIGH (refreshes display)
Logged

KF5RVR

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27144
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, that's another way to do it. I don't why you would when you can just write a byte to a register and have the internal, built in hardware, that is designed to do just that, take care of it for you.   You mention 200mph dragster and then go back to a slow software method for outputting your data.


Code:
// something along these lines, should march digits across the 4 displays
#include <SPI.h>
byte displayArray[10] = {
B00111111, // 0.  high bit = output sinks current
B00000110, // 1.  DP-g-f-d-e-c-b-a
B01011011,  // 2.          a
B01001111,  // 3      f          b
B01100110,  // 4           g
B01101101,  // 5      e          c
B01111100,  // 6           d
B00000111, // 7
B01111111, // 8
B01100111 // 9
};
byte SS = 10;
byte digit1 = 0;
byte digit2 = 0;
byte digit3 = 0;
byte digit4 = 0;
byte x = 0;
void setup(){
pinMode (SS, OUTPUT);
SPI.begin();
}
void loop(){
for (x = 0; x<10; x=x+1){
digit1 = x;
digit2 = x+1;
if (digit2 ==10){digit2 = 0;}
digit3 = x+2;
if (digit3 == 10){digit3 = 0;}
digit4 = x+3;
if (digit4 == 10){digit4 = 0;}
digitalWrite(SS, LOW);
SPI.transfer (displayArray[digit1]);
SPI.transfer (displayArray[digit2]);
SPI.transfer (displayArray[digit3]);
SPI.transfer (displayArray[digit4]);
digitalWrite(SS, HIGH);
delay(500);
}
}
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Ft. Worth, Texas
Offline Offline
God Member
*****
Karma: 0
Posts: 591
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks crossroads.

been up all night and just started forcing myself to learn eagle.

Here's where I'm at.

http://i1105.photobucket.com/albums/h355/magnethead494/dial_board-1.jpg
« Last Edit: January 09, 2012, 08:07:25 am by magnethead794 » Logged

KF5RVR

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27144
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Moving forward by leaps & bounds - surface mount can't be far behind now ...
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Ft. Worth, Texas
Offline Offline
God Member
*****
Karma: 0
Posts: 591
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Moving forward by leaps & bounds - surface mount can't be far behind now ...

Already planning on it for this rendition. Never done it before, but I'm getting a variable temp soldering gun and hot air machine ASAP. KirAsh4 is helping me along with a cattle prod smiley-wink
Logged

KF5RVR

Ft. Worth, Texas
Offline Offline
God Member
*****
Karma: 0
Posts: 591
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The plan is to fit the 328, oscillator, 5V regulator, and shift register all on one 2"x2" board with pins 5, 6, 7, A0, A1, and A7 broken out for future use. That will be the main board.

The other 2 digits will have slave boards, which will only have the shift registers on them. In the case of a double-sided display, all 3 boards on the secondary will be slaves. That makes everything fairly plug-and-play.

The digit selector will be 3 knobs with another 328, oscillator, ect hiding out back. Ditto with the indicator. It's going to be one mad science experiment. 3-way serial between master/selector/indicator and dual daisy chained SPI shift registers. Sounds complex, amazing how simple it really is. Nice part is how easy the packaging will be.
Logged

KF5RVR

Ft. Worth, Texas
Offline Offline
God Member
*****
Karma: 0
Posts: 591
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's where I'm at on the schematics.

http://i1105.photobucket.com/albums/h355/magnethead494/dial_board_master.jpg

http://i1105.photobucket.com/albums/h355/magnethead494/dial_board_slave.jpg

http://i1105.photobucket.com/albums/h355/magnethead494/dial_board_selector.jpg

http://i1105.photobucket.com/albums/h355/magnethead494/dial_board_indicator.jpg


I'm not sure what part number for the oscillator..mouser only has one xtal and they want $15 for it.

I'll break things up by board:

----------

Selector Board:

Switch: NKK Binary Coded Decimal http://www.mouser.com/Search/ProductDetail.aspx?R=FR01AR10PB-W-Svirtualkey63300000virtualkey633-FR01AR10PB-W-S
Knob for Switch: NKK AT433A: http://www.mouser.com/Search/ProductDetail.aspx?R=AT433Avirtualkey63300000virtualkey633-AT433
RJ45 port, right angle: FCI 54602-908LF: http://www.mouser.com/ProductDetail/FCI/54602-908LF/?qs=sGAEpiMZZMvQhAhQbXdbBseXx%252btLS%252bLV8lpIitz%2fSwI%3d
RJ45 port, vertical: Molex 95503-2881: http://www.mouser.com/ProductDetail/Molex/95503-2881/?qs=sGAEpiMZZMvQhAhQbXdbBpAwtzh57ZJU%252b12Gp50sFk4%3d
10K resistor pull-up for reset: Vishay TNPW060310K0DEEA: http://www.mouser.com/ProductDetail/Vishay/TNPW060310K0DEEA/?qs=sGAEpiMZZMvdGkrng054t2aw0xAnHr8cyglfeXQbQ5Q%3d
Atmel 328P-AU: http://www.mouser.com/ProductDetail/Atmel/ATMEGA328P-AU/?qs=sGAEpiMZZMtVoztFdqDXO3RbBx7FKCmV
Oscillator: ??
Capacitors for oscillator: ??
3 pin IDC connector for connecting to indicator board: http://www.mouser.com/ProductDetail/3M-Electronic-Solutions-Division/CHG-1003-001010-KEP/?qs=sGAEpiMZZMtsLRyDR9nM18SX895SbBDG7PcRT8JksiU%3d
3 conductor cable for connecting mto indicator board: http://www.mouser.com/ProductDetail/Alpha-Wire/1173C-SL005/?qs=sGAEpiMZZMuPnr6I6Psi5cXCNOyBX32jeaPsJSM2Yeg%3d

-------------

Indicator Board:

Indicator Display: Lite-On LTC-4727JR: http://www.mouser.com/ProductDetail/Lite-On/LTC-4727JR/?qs=sGAEpiMZZMvkC18yXH9iIgvlR62MGniBcMrTIHXqM2o%3d
330 ohm SMD resistor for indicator: Vishay/Dale CRCW0603330RJNTA: http://www.mouser.com/ProductDetail/Vishay-Dale/CRCW0603330RJNTA/?qs=sGAEpiMZZMtlubZbdhIBILxXaVI2KEnFAwsUpwT18g4%3d
3 pin IDC connector for connecting to selector board: http://www.mouser.com/ProductDetail/3M-Electronic-Solutions-Division/CHG-1003-001010-KEP/?qs=sGAEpiMZZMtsLRyDR9nM18SX895SbBDG7PcRT8JksiU%3d
3 conductor cable for connecting selector board: http://www.mouser.com/ProductDetail/Alpha-Wire/1173C-SL005/?qs=sGAEpiMZZMuPnr6I6Psi5cXCNOyBX32jeaPsJSM2Yeg%3d

--------------

Master Display Board:

Bit Shifter: TI TPIC6B595: http://www.mouser.com/ProductDetail/Texas-Instruments/TPIC6B595DWRG4/?qs=sGAEpiMZZMtsbn1GaJysl5n9mZ%252buky8fvzWTfbYIY%252bQ%3d
5 volt regulator: STMicro LD29150DT50R: http://www.mouser.com/ProductDetail/STMicroelectronics/LD29150DT50R/?qs=sGAEpiMZZMsGz1a6aV8DcF1%2fpLH4TRMJcGtMnQnSZII%3d
RJ45 port, right angle: FCI 54602-908LF: http://www.mouser.com/ProductDetail/FCI/54602-908LF/?qs=sGAEpiMZZMvQhAhQbXdbBseXx%252btLS%252bLV8lpIitz%2fSwI%3d
+12 volt power-in terminal block: Molex 38720-7202: http://www.mouser.com/Search/ProductDetail.aspx?R=38720-7202virtualkey53810000virtualkey538-38720-7202
3 pin IDC connector for connecting master/slave boards: http://www.mouser.com/ProductDetail/3M-Electronic-Solutions-Division/CHG-1003-001010-KEP/?qs=sGAEpiMZZMtsLRyDR9nM18SX895SbBDG7PcRT8JksiU%3d
3 conductor cable for connecting master/slave boards: http://www.mouser.com/ProductDetail/Alpha-Wire/1173C-SL005/?qs=sGAEpiMZZMuPnr6I6Psi5cXCNOyBX32jeaPsJSM2Yeg%3d

(3 conductor is to keep +12/+5/gnd away from mosi/ss/sclk)

--------------

Slave Display Board:

Bit Shifter: TI TPIC6B595: http://www.mouser.com/ProductDetail/Texas-Instruments/TPIC6B595DWRG4/?qs=sGAEpiMZZMtsbn1GaJysl5n9mZ%252buky8fvzWTfbYIY%252bQ%3d
3 pin IDC connector for connecting master/slave boards: http://www.mouser.com/ProductDetail/3M-Electronic-Solutions-Division/CHG-1003-001010-KEP/?qs=sGAEpiMZZMtsLRyDR9nM18SX895SbBDG7PcRT8JksiU%3d
3 conductor cable for connecting master/slave boards: http://www.mouser.com/ProductDetail/Alpha-Wire/1173C-SL005/?qs=sGAEpiMZZMuPnr6I6Psi5cXCNOyBX32jeaPsJSM2Yeg%3d

(3 conductor is to keep +12/+5/gnd away from mosi/ss/sclk)
« Last Edit: January 10, 2012, 12:31:07 am by magnethead794 » Logged

KF5RVR

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27144
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I use a 22pF cap and crystal from dipmicro on my  boards.
http://www.dipmicro.com/store/XC7-16000
http://www.dipmicro.com/store/C1K22-1000

I find your schematics very hard to read.
Can you create them doing this instead of whatever you did:
File:Export:Image, select Window (vs full), adjust the Resolution (DPI) so picture is ~800 x XX. Then post that.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Ft. Worth, Texas
Offline Offline
God Member
*****
Karma: 0
Posts: 591
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks. Not sure why Mouser wouldn't have something that simple (unless I overlooked something). I buy from there since I get everything through will-call, no shipping charge.

Sorry, I used print to PDF then converted to image (should be approx 1500 pixels wide, using A4-A1 paper size at 3x scaling). This method seems to have shrunk them down alot? I'm using .025 grid spacing spanned across 3 monitors, wasn't sure if that was going to affect the size.

http://i1105.photobucket.com/albums/h355/magnethead494/master_2.png

http://i1105.photobucket.com/albums/h355/magnethead494/slave2.png

http://i1105.photobucket.com/albums/h355/magnethead494/selector_2.png

http://i1105.photobucket.com/albums/h355/magnethead494/indicator_2.png


edit- ran that part # through mouser. 19 results.

http://www.mouser.com/Passive-Components/Frequency-Control-Timing-Devices/Crystals/_/N-6zu9f?P=1z0wnukZ1z0z7l5&Keyword=hc49us&Ns=Pricing|0&FS=True
« Last Edit: January 10, 2012, 12:47:35 am by magnethead794 » Logged

KF5RVR

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27144
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Like this?
http://www.mouser.com/ProductDetail/ABRACON/ABL-16000MHZ-B2/?qs=sGAEpiMZZMsBj6bBr9Q9aUe%252bp9Tek3UMf7HCqm%252bSvX0%3d

Just need to know how to search smiley-cool

The pictures are not legible. Maybe photobucket is hosing them. Use the Select button (looks like magnifying glass over a piece of paper) to get the image as big on the screen as you can before exporting it.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: 1 [2] 3 4   Go Up
Jump to: