GPIO - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

GPIO

Description:

volatile unsigned long ulLoop; // Enable the GPIO port that is used for the on-board LED. ... Cho logic 0 (OFF) ra c?ng F ch n s? 2 ... – PowerPoint PPT presentation

Number of Views:466
Avg rating:3.0/5.0
Slides: 10
Provided by: hoap
Category:
Tags: gpio | cong

less

Transcript and Presenter's Notes

Title: GPIO


1
GPIO
  • Tr?n Xuân NghiaPhan Van Hòa

2
GPIO Block Diagram
3
M?u B?ng Ð?a Ch? Thanh Ghi GPIO
4
GPIO Configuration Table
5
LM3S2965 Board
6
LM3S2110 Board
7
L?p Trình GPIO
  • include "lm3s2110.h
  • int main(void)
  • volatile unsigned long ulLoop
  • //
  • // Enable the GPIO port that is used for the
    on-board LED.
  • //
  • SYSCTL_RCGC2_R SYSCTL_RCGC2_GPIOF
  • //
  • // Do a dummy read to insert a few cycles
    after enabling the peripheral.
  • //
  • ulLoop SYSCTL_RCGC2_R
  • //
  • // Enable the GPIO pin for the LED (PF2).
    Set the direction as output, and
  • // enable the GPIO pin for digital function.
  • //
  • GPIO_PORTF_DIR_R 0x04
  • GPIO_PORTF_DEN_R 0x04

8
L?p Trình GPIO (t2)
  • while(1)
  • // Cho logic 1 (ON) ra c?ng F chân s? 2
  • GPIO_PORTF_DATA_R 0x04 //0x04
    0000 0100 Port F Pin 2
  • Delay()
  • // Cho logic 0 (OFF) ra c?ng F chân s? 2
  • GPIO_PORTF_DATA_R (0x04) //0xFB 1111
    1011 Port F Pin 2
  • Delay()

9
LAB GPIO
Write a Comment
User Comments (0)
About PowerShow.com