Sunteți pe pagina 1din 9

How to Interface 7SEG with PIC16F877A

https://www.pantechsolutions.net/microcontroller-boards/7segment-inte

How to Interface 7SEG with PIC16F877A https://www.pantechsolutions.net/microcontroller-boards/7segment-inte
Member Login | About Us | Become a Member
Member Login

Member Login

|

|

About Us

About Us

|

|

Become a Member

Become a Member

|

|

Contact Us

Contact Us

|

|

Dealership

Dealership

 
 
Home

Home

Products

Products

Project Kits

Project Kits

Components

Components

Articles

Articles

Customers

Customers

Forum

Forum

Blog

Blog

Jobs

Jobs

Training

Training

Microcontroller Boards

Microcontroller Boards

DSP/DSC Boards

DSP/DSC Boards

Power Electronics and Drives

Power Electronics and Drives

CPLD/FPGA Boards

CPLD/FPGA Boards

Accessory Boards

Accessory Boards

My cart(0) items

How to Interface 7SEG with PIC16F877A

7 Segment Display Interfacing With PIC16F Primer

Tags: Interfacing Seven Segment with PIC16F877A primer board, Circuit Diagram to Interface 7 segment with PIC16F877A primer board, C Program to 7 Segment Display using PIC16F877A primer board,, seven segment project using pic16f877a,seven segment interface with PIC16F877ASEVEN SEGMENT Interface with PIC microcontrollers

PIC16F877ASEVEN SEGMENT Interface with PIC microcontrollers Rate this (Log in to add a rating) Overall rating

Rate this (Log in to add a rating) Overall rating

How to Interface 7SEG with PIC16F877A

How to Interface 7SEG with PIC16F877A https://www.pantechsolutions.net/microcontroller-boards/7segment-inte PIC16F/18F

https://www.pantechsolutions.net/microcontroller-boards/7segment-inte

PIC16F/18F Primer Board

The PIC16F/18F Primer board is specifically designed to help students to master the required skills in the area of embedded systems. The kit is designed in such way that all the possible features of the microcontroller will be easily used by the students. The kit supports in system programming (ISP) which is done through USB port.

Microchip’s PIC (PIC16F877A), PIC16F/18F Primer Kit is proposed to smooth the progress of developing and debugging of various designs encompassing of High speed 8-bit Microcontrollers.

Seven Segment Display

A seven segment display is the most basic electronic display device that can display digits from 0-9. The most common configuration has an array of eight LEDs arranged in a special pattern to display these digits. They are laid out as a squared-off figure ‘8’.

Interfacing Seven Segment Display

Fig. 1 shows how to interface the seven segments with microcontroller. A seven segment is generally available in ten pin package. While eight pins correspond to the eight LEDs, the remaining two pins (at middle) are common and internally shorted. These segments come in two configurations, namely, Common cathode (CC) and Common anode (CA).

namely, Common cathode (CC) and Common anode (CA). Fig.1 Interfacing 7segment to Microcontroller Interfacing

Fig.1 Interfacing 7segment to Microcontroller

Interfacing Seven Segment with PIC16F877A

How to Interface 7SEG with PIC16F877A

https://www.pantechsolutions.net/microcontroller-boards/7segment-inte

We now want to display a four digit number in PIC16F/18F Primer Board by using seven segment displays. The seven segment display is connected with PIC16F877A microcontroller.

In PIC16f/18F Primer Kit, 4 nos. of common anode seven segment displays are controlled by seven segment drivers.

Pin Assignment with PIC16F877A

 

7-SEG Driver

PIC16F LINES

Connections

A

PORTB.0

 

B

PORTB.1

C

PORTB.2

* Connect PORTB with JP15 via FRC Cable.

D

PORTB.3

* JP15 is at Seven Segment Section

E

PORTB.4

7-SEG

   

Display

F

PORTB.5

G

PORTB.6

Output

DP

PORTB.7

 

CL1

PORTA.3

   

* Digits will be incrementing from 0 to

CL2

PORTA.2

9999

CL3

PORTA.1

CL4

PORTA.0

Circuit Diagram to Interface 7 segment with PIC16F877A

CL3 PORTA.1 CL4 PORTA.0 Circuit Diagram to Interface 7 segment with PIC16F877A 3 trong 9 25/07/2014

How to Interface 7SEG with PIC16F877A

https://www.pantechsolutions.net/microcontroller-boards/7segment-inte

Source Code The Interfacing seven segment displays with

Source Code

The Interfacing seven segment displays with PIC16F877A program is very simple and straight forward, which display a four digit number in seven segment display .The C programs are developed in Mplab software. Here we are increment a counter and display this value loaded into seven segment driver in PIC16F/18F PIC Primer Board.

C Program to 7 Segment Display using PIC16F877A

***************************************************************************************

Title : Program to Seven Segment display

***************************************************************************************

#include<pic.h> // Define PIC Registers

_CONFIG(0x3f72); // HS,Enable(PWRTE,BOREN),

// Disable (CPD,CP,WDTEN,In-circuit Debugger)

#define CNTRL_PORT PORTA

#define DATA_PORT PORTB

void hex2dec(unsigned char);

void send_seg(unsigned char,unsigned char,

unsigned char,unsigned char);

How to Interface 7SEG with PIC16F877A

https://www.pantechsolutions.net/microcontroller-boards/7segment-inte

void DelayMs(unsigned int);

unsigned char x;

unsigned char thou=0,hun=0,ten=0,single=0;

unsigned char CA[10]

{0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};

=

unsigned char CC[10]

{0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};

=

unsigned char CA_CNTRL[4]

=

{0x07,0x0b,0x0d,0x0e};

unsigned char CC_CNTRL[4]

=

{0x08,0x04,0x02,0x01};

unsigned char n=1;

void main()

{

unsigned char number;

nRBPU =0;

TRISB=0x00;

//PORTB configured as O/P

ADCON1=0x07;

//Configure PORTA & PORTE as Digital port

TRISA=0x00;

//PORTA Configured as O/P

while(1)

{

if(x == 200)

{

x=0;

single++; //Increment up to 9 in unit place

if(single>9)

{

single=0;

ten++; //Increment up to 9 in Tenth place

if(ten>9)

{

ten=0;

hun++;//Increment up to 9 in Hundredth place

if(hun>9)

{

hun=0;

thou++;//Increment up to 9 in Thousandth place

if(thou>9)

How to Interface 7SEG with PIC16F877A

https://www.pantechsolutions.net/microcontroller-boards/7segment-inte

}

}

}

x++;

thou=0;

}

send_seg(thou,hun,ten,single);

}

}

void send_seg(unsigned char thou,unsigned char hun,

unsigned char ten,unsigned char single)

{

if(n==1)

{

CNTRL_PORT=CA_CNTRL[0]; //Eanble Unit place 7-Segment

{

DATA_PORT=CA[single];

n=2;

DelayMs(5);

}

else if(n==2)

//Display Unit Place Number

CNTRL_PORT=CA_CNTRL[1]; //Eanble Tenth place 7-Segment

DATA_PORT=CA[ten];

n=3;

DelayMs(5);

}

else if(n==3)

//Display Tenth Place Number

{

CNTRL_PORT=CA_CNTRL[2]; //Enable Hundredth place 7-Segment

DATA_PORT=CA[hun];

//Display Hundredth Place Number

n=4;

DelayMs(5);

}

else if(n==4)

How to Interface 7SEG with PIC16F877A

https://www.pantechsolutions.net/microcontroller-boards/7segment-inte

{ CNTRL_PORT=CA_CNTRL[3];//Eanble Thousandth place 7-Segment DATA_PORT=CA[thou]; //Display Thousandth Place Number
{
CNTRL_PORT=CA_CNTRL[3];//Eanble Thousandth place 7-Segment
DATA_PORT=CA[thou];
//Display Thousandth Place Number
n=1;
DelayMs(5);
}
}
void DelayMs(unsigned int Ms)
{
int delay_cnst;
while(Ms>0)
{
Ms--;
for(delay_cnst = 0;delay_cnst <220;delay_cnst++);
}
}

To compile the above C code you must need the Mplab software and Hi-Tech C Compiler. They must be properly set up and a project with correct settings must be created in order to compile the code. To compile the above code, the C file must be added to the project.

In Mplab, you want to develop or debug the project without any hardware setup. You must compile the code for generating HEX file. In debugging Mode, you want to check the port output without PIC16F/18F Primer Board.

The PICKIT2 software is used to download the hex file into your microcontroller IC PIC16F877A through USB port.

Testing the I2C – Seven segment with PIC16F

Give +12V power supply to PIC16F/18F Primer Board; the four seven segment display is connected with the PIC16F/18F Primer Board. First check the entire seven segments LED’s are properly working or not. Here we are display just 1234 in four seven segment. The entire seven segments receive it through I2C & display it in order.

If any data is not coming in seven segments, then you just check the entire seven segments LED’s are working or not. Change the seven segment driver IC & Check the I2C connections. Check the four seven segments connections. Otherwise you just check the code with debugging mode in Mplab. If you want to see more details about debugging just see the videos in below

How to Interface 7SEG with PIC16F877A

link.

https://www.pantechsolutions.net/microcontroller-boards/7segment-inte

How to create & Debug a Project in Mplab using PIC16F using Hi-Tech Compiler.General Information For proper working use the components of

General Information

For proper working use the components of exact values as shown in Circuit file. Wherever possible use new components.using PIC16F using Hi-Tech Compiler. General Information Solder everything in a clean way. A major problem

Solder everything in a clean way. A major problem arises due to improper soldering, solder jumps and loose joints.shown in Circuit file. Wherever possible use new components. Use the exact value crystal shown in

Use the exact value crystal shown in schematic.due to improper soldering, solder jumps and loose joints. More instructions are available in following articles,

More instructions are available in following articles,joints. Use the exact value crystal shown in schematic. - Interfacing UART with PIC16F877A . -

- Interfacing UART with PIC16F877A.

- Interfacing Keys with PIC16F877A.

- User Manual of PIC16F/18F Primer Board.

- Create & Debug a project in Mplab using PIC16F877A.

Join the World's Largest Technical Community

PIC16F877A. Join the World's Largest Technical Community we respect your privacy. Stay Connected Follow us !

we respect your privacy.

Stay Connected

Follow us !

 
Stay Connected Follow us !   Find us on Facebook   Pantech ProLabs India Pvt Ltd
Stay Connected Follow us !   Find us on Facebook   Pantech ProLabs India Pvt Ltd
Stay Connected Follow us !   Find us on Facebook   Pantech ProLabs India Pvt Ltd
Stay Connected Follow us !   Find us on Facebook   Pantech ProLabs India Pvt Ltd
Stay Connected Follow us !   Find us on Facebook   Pantech ProLabs India Pvt Ltd

Find us on Facebook

 

Pantech ProLabs India Pvt Ltd

Like Like

LikeLike

17,744 people like Pantech ProLabs India Pvt Ltd.

ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook
ProLabs India Pvt Ltd Like Like 17,744 people like Pantech ProLabs India Pvt Ltd . Facebook

Facebook social plugin

 

Resources

BlogPvt Ltd . Facebook social plugin   Resources Videos Presentations Buying Guides Newsletters Across the

VideosLtd . Facebook social plugin   Resources Blog Presentations Buying Guides Newsletters Across the Web

Presentations. Facebook social plugin   Resources Blog Videos Buying Guides Newsletters Across the Web Twitter 8

Buying Guidessocial plugin   Resources Blog Videos Presentations Newsletters Across the Web Twitter 8 trong 9 25/07/2014

Newslettersplugin   Resources Blog Videos Presentations Buying Guides Across the Web Twitter 8 trong 9 25/07/2014

Across the Web

Twitterplugin   Resources Blog Videos Presentations Buying Guides Newsletters Across the Web 8 trong 9 25/07/2014

How to Interface 7SEG with PIC16F877A

FacebookHow to Interface 7SEG with PIC16F877A Linkedin Google + YouTube Slideshare Scribd Stumbleupon Pinterest More Information

LinkedinHow to Interface 7SEG with PIC16F877A Facebook Google + YouTube Slideshare Scribd Stumbleupon Pinterest More Information

Google +How to Interface 7SEG with PIC16F877A Facebook Linkedin YouTube Slideshare Scribd Stumbleupon Pinterest More Information

YouTubeto Interface 7SEG with PIC16F877A Facebook Linkedin Google + Slideshare Scribd Stumbleupon Pinterest More Information

Slideshare7SEG with PIC16F877A Facebook Linkedin Google + YouTube Scribd Stumbleupon Pinterest More Information Warranty

ScribdPIC16F877A Facebook Linkedin Google + YouTube Slideshare Stumbleupon Pinterest More Information Warranty Information

StumbleuponFacebook Linkedin Google + YouTube Slideshare Scribd Pinterest More Information Warranty Information Return

PinterestLinkedin Google + YouTube Slideshare Scribd Stumbleupon More Information Warranty Information Return Policy

More Information

Warranty InformationSlideshare Scribd Stumbleupon Pinterest More Information Return Policy Cancellation Order Holidays Terms for

Return PolicyStumbleupon Pinterest More Information Warranty Information Cancellation Order Holidays Terms for Softwares RoHS

Cancellation OrderMore Information Warranty Information Return Policy Holidays Terms for Softwares RoHS Dealership Shipping Policy

HolidaysWarranty Information Return Policy Cancellation Order Terms for Softwares RoHS Dealership Shipping Policy Company

Terms for SoftwaresInformation Return Policy Cancellation Order Holidays RoHS Dealership Shipping Policy Company About Us Terms of

RoHSPolicy Cancellation Order Holidays Terms for Softwares Dealership Shipping Policy Company About Us Terms of use

DealershipPolicy Cancellation Order Holidays Terms for Softwares RoHS Shipping Policy Company About Us Terms of use

Shipping PolicyOrder Holidays Terms for Softwares RoHS Dealership Company About Us Terms of use Privacy policy Terms

Company

About UsTerms for Softwares RoHS Dealership Shipping Policy Company Terms of use Privacy policy Terms & Conditions

Terms of useSoftwares RoHS Dealership Shipping Policy Company About Us Privacy policy Terms & Conditions Careers Events SiteMap

Privacy policyDealership Shipping Policy Company About Us Terms of use Terms & Conditions Careers Events SiteMap Contact

Terms & ConditionsShipping Policy Company About Us Terms of use Privacy policy Careers Events SiteMap Contact us Pantech

CareersAbout Us Terms of use Privacy policy Terms & Conditions Events SiteMap Contact us Pantech ProLabs

EventsTerms of use Privacy policy Terms & Conditions Careers SiteMap Contact us Pantech ProLabs Team Copyright

SiteMapof use Privacy policy Terms & Conditions Careers Events Contact us Pantech ProLabs Team Copyright ©

Contact usPrivacy policy Terms & Conditions Careers Events SiteMap Pantech ProLabs Team Copyright © 2014 Pantech ProLabs

Pantech ProLabs TeamTerms & Conditions Careers Events SiteMap Contact us Copyright © 2014 Pantech ProLabs India Pvt Ltd

Copyright © 2014 Pantech ProLabs India Pvt Ltd

ProLabs Team Copyright © 2014 Pantech ProLabs India Pvt Ltd

https://www.pantechsolutions.net/microcontroller-boards/7segment-inte

Content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License 9 trong 9 25/07/2014 12:07
is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License 9 trong 9 25/07/2014 12:07