Experimental requirements
Code
#include "ioCC2530.h"
#define D3 P1_0
#define D4 P1_1
#define D5 P1_3
#define D6 P1_4
//delay function
void Delay(unsigned int t)
{
while(t--);
}
//Port initialization function
void Init_Prot()
{
//Configure the engine with 4 LED lights
//Select port function
P1SEL &=~0x1B;//Set general io port
//Configure the direction of the port
P1DIR |=0x1B;
//Turn off the LED light
P1 &=~0x1B;
}
//Initialization of external interrupt port 1
void Init_INTP1()
{
//Clear the external interrupt flag bit
P1IFG = 0x00;
//Enable P1 port group interrupt
IEN2 |=0x10;
//Enable P1 pin interrupt P1_2
P1IEN |=0x04;
//Select the trigger type of the external interrupt signal
PICTL |=0x02;
//Turn on and enable the total interrupt
EA = 1;
}
#pragma vector = P1INT_VECTOR //Start statement
//interrupt service function
__interrupt void Service_INTP1()
{
//Handle external interrupt
if((P1IFG &0x04)==0x04)
{
D5 =~D5;
}
//Clear the index of the register to zero
P1IFG = 0x00; //Clear the pin first
P1IF = 0x00; //Clear the port group again
}
void main(void)
{
//Port initialization
Init_Prot();
Init_INTP1();
while(1)
{
D4 = 1;
Delay(60000);
Delay(60000);
D4 = 0;
Delay(60000);
Delay(60000);
}
}
Previous article:CC2530 second flash light based on timer 1 touch mode
Next article:CC2530 button controls the running and pausing of the marquee
- 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
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- Goodbye 2019 ~ Hello 2020 - Looking back at 2019 and planning for 2020
- FPGA design ideas and techniques: data interface synchronization
- Together: About the GD32L233 development board unpacking test
- It is said that uC/OS system is free. Is it true?
- Last two days! Free review - Pingtouge scenario-based Bluetooth Mesh gateway development kit
- EEWORLD University Hall----Research and development of high-speed motors
- How to choose between different chips in TI's Sub-1GHz product line?
- Why does C6000 need Cache?
- What are the benefits of using an op amp to drive a MOS tube? Who knows? Tell me
- How to convert Allegro PCB to AD PCB?