arm7 Litian Electronics lpc2148 GPIO one buzzer test program

Publisher:PositiveEnergyLatest update time:2019-05-14 Source: eefocusKeywords:arm7  lpc2148  GPIO Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The experiment uses the output function of P0.22 to control the buzzer. The program sets PINSEL0 to connect P0.22 to GPIO, and sets it to output state through IO0DIR; then sets and clears P0.22 port through IO0DET and IO0CLR to control the buzzer.


#include


void Delay(unsigned long n);

main()

{

  PINSEL0=0x00000000; //Set the pin to connect to GPIO

  IO0DIR=1<<22; //P0.7 controls the buzzer, set to output

  

  while(1)

  {

    IO0SET=1<<22; //Buzzer beeps

    Delay(100000); //delay

    IO0CLR=1<<22; //Buzzer stops beeping

    Delay(100000); //delay 

  }

}

void Delay(unsigned long n)

{

  while(n--);

}


The circuit schematic is shown below:



Keywords:arm7  lpc2148  GPIO Reference address:arm7 Litian Electronics lpc2148 GPIO one buzzer test program

Previous article:arm7 Litian Electronics lpc2148 GPIO 2 single-channel LED control experiment
Next article:Summary of ARM fragmentary knowledge points

Recommended ReadingLatest update time:2024-11-16 11:48

51 MCU introductory case - one button to light up the LED and turn on the buzzer
A special button s1 can realize two functions, one is to light up the LED light, the other is to turn on the buzzer. You can also add other functions, such as lighting up the LED light and turning on the buzzer at the same time when num=3. Tools: Keil U3 + STC-SP (v6.86) + BST-v51 MCU development board Crystal: 11
[Microcontroller]
stm32 GPIO port configuration operation
         The most basic idea in stm32 is that before using the corresponding registers of the peripherals, the clock that controls the corresponding registers must be turned on. Readers can check the corresponding registers controlled by the corresponding clock in the technical manual.            Here we first turn on
[Microcontroller]
LPC2124--GPIO button controls the flashing of LED lights
Example Purpose Purpose of the example: Master the use and debugging methods of Proteus software and learn IO programming. Example content:  Learn to use Proteus, ADS, and Keil for ARM software, and master drawing principles and compilation programs.  Keyboard input: when a key input is detected, the LED is invert
[Microcontroller]
LPC2124--GPIO button controls the flashing of LED lights
LPC1768 Novice Learning GPIO and External Interrupts
The P0 and P2 ports of LPC1768 can be used for input and output, and can also be configured as interrupt sources. Now P2.10 is used as a button and is configured as follows: void BUTTON_init(void) {  LPC_GPIO2- FIODIR      &=~(1 10);    /* PORT2.10 definedas input       */  LPC_GPIOINT- IO2IntEnF |=  (1 10);    /* e
[Microcontroller]
Using a microcontroller to drive a buzzer to generate an alarm sound
//******************************************************  //Purpose of the experiment:  //Be familiar with using the microcontroller to drive the buzzer to generate an alarm sound  //******************************************************  //******************************************************  //Hardware settings: 
[Microcontroller]
arm力天电子 lpc2148流水灯驱动程序详解
一个破流水灯程序看了两天了,void WriteByte(unsigned char data)这部分还是没看懂,力天电子上面介绍说这部分三端口的数据输入,选出8位的串行数据。 选择16,17,18,19四个控制位,主要跟电路图的连接有关,4块74HC595,组成32位(如图所示),从下往上依次是0~31为,图中写反了。因此到D13对应的引脚应该是16,D12对应的是17,D11对应的是18,D10对应的是19. 当16,17,18,19分别为低电平时二极管才能够导通发光。高电平时熄灭 1#include NXP/iolpc2148.h 2#define         SCLK  0x01 24  //指定P1.24
[Microcontroller]
arm力天电子 lpc2148流水灯驱动程序详解
Signal Acquisition System Designed with ARM7 and UC/OS-II
In some industrial sites, equipment is prone to failure after long-term operation. In order to monitor these devices, data acquisition devices are usually used to collect data from them during operation and send them to the PC. The data is analyzed by specific software running on the PC to determine the status of the
[Microcontroller]
Signal Acquisition System Designed with ARM7 and UC/OS-II
STM32 Getting Started: GPIO
       I have been using STM32 for a while. I felt it was difficult to get started and I didn't know where to start. Now I have learned a little bit and I would like to share it with you.        First of all, what is GPIO? The answer to this question is that I don’t know either! At least I don’t need to know it for no
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号