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
}
}
Previous article:PIC16F877A LED Blinking
Next article:Discussion on the problem of PIC writing internal EEPROM
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- Structure of optical devices and chips
- Has anyone done OTA online upgrade for RL78?
- Millimeter wave radar IWR1443
- mpy starts supporting USB for STM32L432
- Voltage follower composed of op amp
- [Hua Diao Experience] 08 Series of tests on the hardware control pinpong library of Xingkong board (Part 1)
- What sampling rate is required for an oscilloscope to measure various types of signals?
- Application of wireless Bluetooth transparent transmission modules in five common industries
- Do I need to set the pull-up or pull-down resistor of the port for output?
- There are 20 prizes left to be drawn: Watch the video "Avoiding Common AC-DC Design Pitfalls" and win a prize