Permalink
Browse files

Version 3.0: Massive overhaul of the code. Added I2C Functionality.

Added commands to better support I2C.
Added buffering to serial inputs.
The hardware has changed, pins have moved, current limiting resistors added. Code reflects this.
Adding Eagle PCB design files.
  • Loading branch information...
Jim Lindblom
Jim Lindblom committed Sep 6, 2012
1 parent f752458 commit ada6c856cf31423fc2cb6f8fc550f04fbb03f1af
Showing with 23,535 additions and 2,059 deletions.
  1. +3 −2 README
  2. +74 −0 firmware/Arduino/Serial 7-Segment Display/Arduino_Examples/Test_I2C/Test_I2C.ino
  3. +61 −0 firmware/Arduino/Serial 7-Segment Display/Arduino_Examples/Test_SPI/Test_SPI.ino
  4. +60 −0 firmware/Arduino/Serial 7-Segment Display/Arduino_Examples/Test_jig/Test_jig.ino
  5. +465 −0 ...no/Serial 7-Segment Display/Serial_7_Segment_Display_Firmware/Serial_7_Segment_Display_v3_0_1.ino
  6. +157 −0 firmware/Arduino/Serial 7-Segment Display/Serial_7_Segment_Display_Firmware/settings.h
  7. +19 −0 firmware/Arduino/hardware/Serial7Seg/boards.bak
  8. +19 −0 firmware/Arduino/hardware/Serial7Seg/boards.txt
  9. +469 −0 firmware/Arduino/hardware/Serial7Seg/bootloaders/optiboot/Makefile
  10. +81 −0 firmware/Arduino/hardware/Serial7Seg/bootloaders/optiboot/README.TXT
  11. 0 firmware/Arduino/hardware/Serial7Seg/bootloaders/optiboot/avrdude
  12. +848 −0 firmware/Arduino/hardware/Serial7Seg/bootloaders/optiboot/boot.h
  13. +20 −0 firmware/Arduino/hardware/Serial7Seg/bootloaders/optiboot/makeall
  14. +2 −0 firmware/Arduino/hardware/Serial7Seg/bootloaders/optiboot/omake
  15. +1 −0 firmware/Arduino/hardware/Serial7Seg/bootloaders/optiboot/omake.bat
  16. +672 −0 firmware/Arduino/hardware/Serial7Seg/bootloaders/optiboot/optiboot.c
  17. +35 −0 firmware/Arduino/hardware/Serial7Seg/bootloaders/optiboot/optiboot_atmega328_serial7Seg.hex.bak
  18. +2,049 −0 firmware/Arduino/hardware/Serial7Seg/bootloaders/optiboot/optiboot_serial7Seg-COMBINED.hex
  19. +32 −0 firmware/Arduino/hardware/Serial7Seg/bootloaders/optiboot/optiboot_serial7Seg.hex
  20. +548 −0 firmware/Arduino/hardware/Serial7Seg/bootloaders/optiboot/optiboot_serial7Seg.lst
  21. +80 −0 firmware/Arduino/hardware/Serial7Seg/bootloaders/optiboot/pin_defs.h
  22. +39 −0 firmware/Arduino/hardware/Serial7Seg/bootloaders/optiboot/stk500.h
  23. +215 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/Arduino.h
  24. +233 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/CDC.cpp
  25. +26 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/Client.h
  26. +520 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/HID.cpp
  27. +428 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/HardwareSerial.cpp
  28. +81 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/HardwareSerial.h
  29. +56 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/IPAddress.cpp
  30. +76 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/IPAddress.h
  31. +23 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/Platform.h
  32. +263 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/Print.cpp
  33. +78 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/Print.h
  34. +40 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/Printable.h
  35. +9 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/Server.h
  36. +270 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/Stream.cpp
  37. +96 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/Stream.h
  38. +601 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/Tone.cpp
  39. +195 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/USBAPI.h
  40. +672 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/USBCore.cpp
  41. +303 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/USBCore.h
  42. +63 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/USBDesc.h
  43. +88 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/Udp.h
  44. +168 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/WCharacter.h
  45. +298 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/WInterrupts.c
  46. +60 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/WMath.cpp
  47. +645 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/WString.cpp
  48. +205 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/WString.h
  49. +515 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/binary.h
  50. +20 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/main.cpp
  51. +18 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/new.cpp
  52. +22 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/new.h
  53. +324 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/wiring.c
  54. +282 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/wiring_analog.c
  55. +178 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/wiring_digital.c
  56. +69 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/wiring_private.h
  57. +69 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/wiring_pulse.c
  58. +55 −0 firmware/Arduino/hardware/Serial7Seg/cores/arduino/wiring_shift.c
  59. +230 −0 firmware/Arduino/hardware/Serial7Seg/variants/standard/pins_arduino.h
  60. +1,610 −0 hardware/Serial-7-Segment-Display.brd
  61. +8,697 −0 hardware/Serial-7-Segment-Display.sch
  62. +0 −667 source-code/Makefile
  63. +0 −7 source-code/README
  64. BIN source-code/Serial-7-Seg-v2.zip
  65. +0 −50 source-code/Serial-7-Seg.h
  66. +0 −530 source-code/main-production.c
  67. +0 −656 source-code/main.c
  68. +0 −147 source-code/main.hex
View
5 README
@@ -1,7 +1,8 @@
-Serial 7-Segment Display v2
-5/12/10
+Serial 7-Segment Display v3
+September 6, 2012
Spark Fun Electronics
by: Jim Lindblom
License: Creative Commons Attribution Share-Alike 3.0
http://creativecommons.org/licenses/by-sa/3.0
+
@@ -0,0 +1,74 @@
+#include <Wire.h>
+
+const int DISPLAY_COUNT = 1;
+
+//int address[DISPLAY_COUNT] = {0x71, 0x72, 0x73, 0x74};
+int address[DISPLAY_COUNT] = {0x71};
+
+int digs[4*DISPLAY_COUNT] = {0, 0, 0, 0};
+
+void setup()
+{
+ randomSeed(analogRead(A0));
+ for (int i=0; i<(4*DISPLAY_COUNT); i++)
+ {
+ digs[i] = random(9);
+ }
+ //Serial.begin(9600);
+ Wire.begin();
+ for (int i=0; i<4; i++)
+ {
+ Wire.beginTransmission(address[i]);
+ Wire.write('v');
+ Wire.endTransmission();
+ }
+}
+
+void loop()
+{
+ delay(1);
+ digs[0]+=1;
+ digs[1]+=1;
+ digs[2]+=1;
+ digs[3]+=1;
+ digs[4]+=1;
+ digs[5]+=9;
+ for (int n=0; n<16; n++)
+ {
+ if (digs[n] >=10)
+ {
+ digs[n] = 0;
+ digs[(n+1)%16]++;
+ }
+ }
+ Wire.beginTransmission(address[3]);
+ Wire.write(digs[3]);
+ Wire.write(digs[2]);
+ Wire.write(digs[1]);
+ Wire.write(digs[0]);
+ Wire.endTransmission();
+ Wire.beginTransmission(address[2]);
+ Wire.write(digs[7]);
+ Wire.write(digs[6]);
+ Wire.write(digs[5]);
+ Wire.write(digs[4]);
+ Wire.endTransmission();
+ Wire.beginTransmission(address[1]);
+ Wire.write(digs[11]);
+ Wire.write(digs[10]);
+ Wire.write(digs[9]);
+ Wire.write(digs[8]);
+ Wire.endTransmission();
+ Wire.beginTransmission(address[0]);
+ Wire.write(digs[15]);
+ Wire.write(digs[14]);
+ Wire.write(digs[13]);
+ Wire.write(digs[12]);
+ Wire.endTransmission();
+ /*if (Serial.available())
+ {
+ Wire.beginTransmission(address);
+ Wire.write(Serial.read());
+ Wire.endTransmission();
+ }*/
+}
@@ -0,0 +1,61 @@
+#include <SPI.h>
+
+const int slaveSelectPin = 9;
+int digits[4] = {0, 0, 0, 0};
+
+void setup()
+{
+ pinMode (slaveSelectPin, OUTPUT);
+ SPI.begin();
+ SPI.setBitOrder(MSBFIRST);
+ SPI.setDataMode(SPI_MODE0);
+ SPI.setClockDivider(SPI_CLOCK_DIV64); // Default div is 4, but that's too fast
+ Serial.begin(9600);
+ digitalWrite(slaveSelectPin, LOW);
+ SPI.transfer('v');
+ digitalWrite(slaveSelectPin, HIGH);
+ delay(2000);
+}
+
+void loop()
+{
+ if (Serial.available())
+ {
+ digitalWrite(slaveSelectPin, LOW);
+ SPI.transfer(Serial.read());
+ digitalWrite(slaveSelectPin, HIGH);
+ }
+ /*
+ digits[0]++;
+ for (int i=0; i<4; i++)
+ {
+ if (digits[i] > 9)
+ {
+ digits[i] = 0;
+ digits[(i+1)%4]++;
+ }
+ }
+ Serial.print(digits[3]);
+ Serial.print(digits[2]);
+ Serial.print(digits[1]);
+ Serial.println(digits[0]);
+
+ digitalWrite(slaveSelectPin, LOW);
+ SPI.transfer(digits[3]);
+ SPI.transfer(digits[2]);
+ SPI.transfer(digits[1]);
+ SPI.transfer(digits[0]);
+ digitalWrite(slaveSelectPin, HIGH);
+ delay(100);
+ /*int temp = millis()/100;
+ digitalWrite(slaveSelectPin, LOW);
+ SPI.transfer('v');
+ SPI.transfer(temp/1000);
+ SPI.transfer((temp-temp/1000)/100);
+ SPI.transfer((temp-temp/1000-temp/100)/10);
+ SPI.transfer((int)(temp-temp/1000-temp/100-temp/10));
+ SPI.transfer('w');
+ SPI.transfer(0x2);
+ digitalWrite(slaveSelectPin, HIGH);
+ delay(500);*/
+}
@@ -0,0 +1,60 @@
+#include <Wire.h>
+#include <SPI.h>
+#include <SoftwareSerial.h>
+
+// Default I2C address of 7Segment Display
+const byte DISPLAY_ADDRESS = 0x71;
+
+// Test jig pin defines
+const int slaveSelect = 7;
+const int statLed = A0;
+const int softwareTx = 4;
+
+// Initialize SoftwareSerial
+SoftwareSerial seg7(5, 4);
+
+void setup()
+{
+ randomSeed(analogRead(A1));
+ seg7.begin(9600); // Start software serial
+}
+
+void loop()
+{
+ if (digitalRead(slaveSelect) == 0)
+ {
+ delay(100);
+ i2cTest();
+ serialTest();
+ }
+}
+
+void spiTest()
+{
+ pinMode(slaveSelect, INPUT);
+}
+
+void serialTest()
+{
+ //seg7.write('v'); // Clear display
+ //seg7.write(0x77); // Decmial command
+ //seg7.write(0xFF); // All decimals on
+ //seg7.write(random(9)); // Digit 1
+ //seg7.write(random(9)); // Digit 2
+ seg7.write(8); // Digit 3
+ seg7.write(8); // Digit 4
+}
+
+void i2cTest()
+{
+ Wire.begin();
+ Wire.beginTransmission(DISPLAY_ADDRESS);
+ Wire.write('v'); // Clear display
+ Wire.write(0x77); // Decmial command
+ Wire.write(0xFF); // All decimals on
+ Wire.write(8); // Digit 1
+ Wire.write(8); // Digit 2
+ //Wire.write(random(9)); // Digit 3
+ //Wire.write(random(9)); // Digit 4
+ Wire.endTransmission();
+}
Oops, something went wrong.

0 comments on commit ada6c85

Please sign in to comment.