1 Digit Pinout (HCOPTO0012)
4 Digit Pinout (HCOPTO0013)
Description
The HCOPTO0012 & HCOPTO0013 are 1 and 4 digit seven segment display modules ideally suited for use with various microcontrollers such a Pic, Atmel AVR, and Arduino products.
The 1 digit module is a CL5611AH common cathode type display
The 4 digit module is a 5641AS common cathode type display
Example Arduino Sketch Using HC7Segment Library
Code: Select all
/* FILE: HC7Segment_Example.pde
DATE: 28/02/13
VERSION: 0.1
AUTHOR: Andrew Davies
This is an example of how to use the 7 segment LED displays found within
our product range. This sketch is designed to work with both the single
and four digit displays but can also work with a combination of single
digit displays stacked together.
When connecting your LED display to your arduino board, make sure that you
have correctly identified the version of display and understood its pinout
as an incorrect connection to your Arduino board can result in permanant
damage to both your LED display and your Arduino. Never connect the annode
and cathode of any of the LED segments across the GPIO's of your Arduino
without a current limiting resistor in series.
1 DIGIT MODULE CONNECTIONS (CAI5011)
PIN DESCRIPTION ARDUINO PIN
1 Segment E D2 (VIA 220R resistor)
2 Segment D D3 (VIA 220R resistor)
3 Segment DP D4 (VIA 220R resistor)
4 Segment C D5 (VIA 220R resistor)
5 Segment G D6 (VIA 220R resistor)
6 Digit 1 Select D7
7 Segment B A0 (VIA 220R resistor)
10 Segment F A3 (VIA 220R resistor)
11 Segment A A4 (VIA 220R resistor)
4 DIGIT MODULE CONNECTIONS (CAI5416 & 5641xx)
PIN DESCRIPTION ARDUINO PIN
1 Segment E D2 (VIA 220R resistor)
2 Segment D D3 (VIA 220R resistor)
3 Segment DP D4 (VIA 220R resistor)
4 Segment C D5 (VIA 220R resistor)
5 Segment G D6 (VIA 220R resistor)
6 Digit 1 Select D7
7 Segment B A0 (VIA 220R resistor)
8 Digit 2 Select A1
9 Digit 3 Select A2
10 Segment F A3 (VIA 220R resistor)
11 Segment A A4 (VIA 220R resistor)
12 Digit 4 Select D8
ALL SEGMENT PINS MUST BE CONNECTED TO THE ARDUINO GPIO VIA 220R
RESISTORS OTHERWISE YOU MAY RISK DAMAGING THE MODULE AND YOUR ARDUINO.
To initilise the library include the following line:
HC7Segment HC7Segment(Number_Of_Digits, Digit_Select_State);
Where Number_Of_Digits is the number of digits your 7 segment display has
(e.g. 1, 2, 3, or 4) and Digit_Select_State is the logic level required on
each of the digit select pins of the module to make the module illuminate
(e.g. HIGH For common annode displays or LOW for common cathode displays).
You cannot damage your module by selecting the wrong Digit_Select_State
(so long as you have connected your module correctly) but your display
will not illuminate.
To output a number to the display you must continually run the following
function in a loop or via a timer interrupt:
HC7Segment.vDisplay_Number(Number, Decimal_Point);
Where Number is the number (of type int) to be displayed and Decimal point
is the optional position of the decimal point.
You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used directly for the purpose of selling products that
directly compete with Hobby Components Ltd's own range of products.
THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.
*/
/* Include the 7 segment display library */
#include <HC7Segment.h>
/* Create an instance of HC7Segment(). In this example we will be using a 4 digit
common cathode display (CAI5416) */
HC7Segment HC7Segment(4, LOW);
/* Place any setup code that you require here */
void setup()
{
}
/* Main program */
void loop()
{
/* Holds the current runtime in 100mS intervals */
int Time100mS;
/* Store the current runtime */
Time100mS = millis() / 100;
/* Output the current time to the display */
HC7Segment.vDisplay_Number(Time100mS,2);
}
Arduino Sketch Example Using HC7Segment and HCTimer2 Library
Code: Select all
/* FILE: HC7Segment_Example_Using_HCTimer2.pde
DATE: 28/02/13
VERSION: 0.1
AUTHOR: Andrew Davies
This is an example of how to use the 7 segment LED displays found within
our product range. This sketch is designed to work with both the single
and four digit displays but can also work with a combination of single
digit displays stacked together.
When connecting your LED display to your arduino board, make sure that you
have correctly identified the version of display and understood its pinout
as an inccorrect connection to your Arduino board can result in permanant
damage to both your LED display and your Arduino. Never connect the annode
and cathode of any of the LED segments across the GPIO's of your Arduino
without a current limiting resistor in series.
1 DIGIT MODULE CONNECTIONS (CAI5011)
PIN DESCRIPTION ARDUINO PIN
1 Segment E D2 (VIA 220R resistor)
2 Segment D D3 (VIA 220R resistor)
3 Segment DP D4 (VIA 220R resistor)
4 Segment C D5 (VIA 220R resistor)
5 Segment G D6 (VIA 220R resistor)
6 Digit 1 Select D7
7 Segment B A0 (VIA 220R resistor)
10 Segment F A3 (VIA 220R resistor)
11 Segment A A4 (VIA 220R resistor)
4 DIGIT VERSION (CAI5416 & 5641xx)
PIN DESCRIPTION ARDUINO PIN
1 Segment E D2 (VIA 220R resistor)
2 Segment D D3 (VIA 220R resistor)
3 Segment DP D4 (VIA 220R resistor)
4 Segment C D5 (VIA 220R resistor)
5 Segment G D6 (VIA 220R resistor)
6 Digit 1 Select D7
7 Segment B A0 (VIA 220R resistor)
8 Digit 2 Select A1
9 Digit 3 Select A2
10 Segment F A3 (VIA 220R resistor)
11 Segment A A4 (VIA 220R resistor)
12 Digit 4 Select D8
ALL SEGMENT PINS MUST BE CONNECTED TO THE ARDUINO GPIO VIA 220R
RESISTORS OTHERWISE YOU MAY RISK DAMAGING THE MODULE AND YOUR ARDUINO.
To initilise the library include the following line:
HC7Segment HC7Segment(Number_Of_Digits, Digit_Select_State);
Where Number_Of_Digits is the number of digits your 7 segment display has
(e.g. 1, 2, 3, or 4) and Digit_Select_State is the logic level required on
each of the digit select pins of the module to make the module illuminate
(e.g. HIGH For common annode displays or LOW for common cathode displays).
You cannot damage your module by selecting the wrong Digit_Select_State
(so long as you have connected your module correctly) but your display
will not illuminate.
To output a number to the display you must continually run the following
function in a loop or via a timer interrupt:
HC7Segment.vDisplay_Number(Number, Decimal_Point);
Where Number is the number (of type int) to be displayed and Decimal point
is the optional position of the decimal point.
You may copy, alter and reuse this code in any way you like but please leave
reference to hobbycomponents.com in your comments. This software may not be
used directly for the purpose of selling products that directly compete with
Hobby Components Ltd's own range of products.
THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.
*/
/* Include the HCTimer2 library */
#include <HCTimer2.h>
/* Include the 7 segment display library */
#include <HC7Segment.h>
/* Create an instance of HC7Segment(). In this example we will be using a 4 digit
common cathode display (CAI5416) */
HC7Segment HC7Segment(4, LOW);
/* Holds the current runtime in 100mS intervals */
int Time100mS;
void setup()
{
/* Initiliase the HCTimer2 library with a 2.04mS interval */
HCTimer2Init(T2_CLK_DIV_128, 254);
}
/* Main program */
void loop()
{
/* Store the current runtime */
Time100mS = millis() / 254;
}
/* Use the HCTimer2 Timer 2 interrupt to constantly update the
LED display. */
void HCTimer2()
{
/* Output the current time to the display */
HC7Segment.vDisplay_Number(Time100mS,1);
}