Introduction: Multiple 7 Segment Display Counter With CloudX Microcontroller
This Project explains how to display data on Two 7-Segment using CloudX microcontroller
Step 1: GET THIS MATERIAL
CLOUDX MICROCONTROLLER
CLOUDX SOFTCARD
V3 CORD
JUMPER WIRE
2 SEVEN SEGMENT
330ohm resistor
Buy your component online here
Step 2: SET-UP HARDWARE
In this we have to do multiplexing
connect A,B,DP,C,D,E,F,G pin of the two segment together,
Pin A of the segment to pin1 of the CloudX
Pin B of the segment to pin2 of the CloudX
Pin DP of the segment to pin3 of the CloudX
Pin C of the segment to pin4 of the CloudX
Pin D of the segment to pin5 of the CloudX
Pin E of the segment to pin6 of the CloudX
Pin F of the segment to pin7 of the CloudX
Pin G of the segment to pin9 of the CloudX
connect common cathode of the first segment to pin10 and
connect common cathode of the second segment to pin11
download CloudX IDE here
Step 3: CODING
Copy this Code to CloudX IDE
#include <CloudX\M633.h>
#include <CloudX\Segment.h> #include <CloudX\stdlib.h>
char counter[2] = {'0','0'}; setup() { //setup here char NumberOfDigit = 2; // set number of 7 segment displays to be used // connect these CloudX pins to the Data Pins A,B,C,D,E,F,G and H pins of the Display char segmentDataPins[]= {1,2,3,4,5,6,7,8}; // connect these CloudX pins to the Common Anode or Cathode of each 7-segment display char segmentScanPins[]= {9,10}; // initialize the 7 segment Display with these data Segment_setting(CCathode,NumberOfDigit,segmentScanPins,segmentDataPins); loop(){ //Program here for (int i =0; i<100; i++) { // calculate i / 10 and add 48 (to convert it to a character) then load in counter[0] counter[0] = (i/10) + 48 ; counter[1] = (i%10) + 48 ; // load this calculation into counter[0]
Segment_writeText(counter , 1000); // Display the content in counter array on 7segment } for (int i =99; i>0; i--){ // convert the value in the i variable (input) to a string(output) in base 10 intTostr(counter , i , DEC); if( i < 10) //execute this section of code if the value in the i variable is less than 10 { counter[1]=counter[0]; // replace counter[1] with the content of the counter[0] counter[0]='0'; // replace counter[0] variable with the character ‘0’ } Segment_writeText(counter , 1000); // Display the content in counter array for 1 sec } } }
Step 4: DID YOU ACHIEVE IT
Share it with us here