PIC16F877A lights up LED

Publisher:haoyingLatest update time:2016-12-07 Source: eefocusKeywords:PIC16F877A Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Key points:
PORTA, PORTB, PORTC, PORTD, and PORTE are in input state after reset.

PORTA.4 is open-drain output.

TRISx is the direction register. When it is 0, it indicates output, and when it is 1, it indicates input.

PORTx is the IO port

PORTA. By default, it is not a digital IO port, but an analog IO port. If we
want to use PORTA as a digital IO port, we need to set ADCON1 = 0x06;
*****************************/
#include
#include "../head/config.h" //Include your own configuration header file

__CONFIG(HS&WDTDIS&LVPDIS&PWRTEN); //Set the fuse bit
//HS oscillation, disable watchdog, turn off low-voltage programming, and start the delay timer
void main(void)
{
   PORTD = 0xff; //PORTD is ff
   TRISD = 0x00; //PD port direction is set to output
   

   while(1)
   {
   RD0 = 0; //RD0 outputs 1, turning on the LED
   }
   
}

Keywords:PIC16F877A Reference address:PIC16F877A lights up LED

Previous article:PIC16F877A LED Blinking
Next article:Discussion on the problem of PIC writing internal EEPROM

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号