PIC24 Support Libraries
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
chap8
ledflash.c
Go to the documentation of this file.
1
/*
2
* "Copyright (c) 2008 Robert B. Reese, Bryan A. Jones, J. W. Bruce ("AUTHORS")"
3
* All rights reserved.
4
* (R. Reese, reese_AT_ece.msstate.edu, Mississippi State University)
5
* (B. A. Jones, bjones_AT_ece.msstate.edu, Mississippi State University)
6
* (J. W. Bruce, jwbruce_AT_ece.msstate.edu, Mississippi State University)
7
*
8
* Permission to use, copy, modify, and distribute this software and its
9
* documentation for any purpose, without fee, and without written agreement is
10
* hereby granted, provided that the above copyright notice, the following
11
* two paragraphs and the authors appear in all copies of this software.
12
*
13
* IN NO EVENT SHALL THE "AUTHORS" BE LIABLE TO ANY PARTY FOR
14
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
15
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE "AUTHORS"
16
* HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17
*
18
* THE "AUTHORS" SPECIFICALLY DISCLAIMS ANY WARRANTIES,
19
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21
* ON AN "AS IS" BASIS, AND THE "AUTHORS" HAS NO OBLIGATION TO
22
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
23
*
24
* Please maintain this header in its entirety when copying/modifying
25
* these files.
26
*
27
*
28
*/
29
30
#include "
pic24_all.h
"
31
32
/** \file
33
A simple program that flashes the Power LED, uses I/O macros.
34
RB15 is configured as an open drain output, and drives an LED at
35
the junction between the LED and a pullup resistor to VDD. When
36
RB15 is driven low, the LED is off. When RB15 is driven high,
37
the RB15 output floats because of the open drain, and so the
38
LED is turned on by the pullup resistor to VDD. This allows
39
the power LED to function as a 'blinky' LED in addition to serving
40
as a power indicator.
41
*/
42
43
#define CONFIG_LED1() CONFIG_RB15_AS_DIG_OD_OUTPUT()
44
#define LED1 _LATB15 //_LATB15 is port register for RB15
45
46
int
main
(
void
) {
47
48
configClock
();
49
/********** GPIO config **********/
50
CONFIG_LED1();
51
LED1 = 0;
52
while
(1) {
53
DELAY_MS
(250);
//delay long enough to see LED blink
54
LED1 = !LED1;
// Toggle LED
55
}
// end while (1)
56
}
Generated by
1.8.4