OpenCores
URL https://opencores.org/ocsvn/neo430/neo430/trunk

Subversion Repositories neo430

[/] [neo430/] [trunk/] [neo430/] [sw/] [example/] [blink_led/] [main.c] - Blame information for rev 198

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 198 zero_gravi
// #################################################################################################
2
// #  < Blinking LED example program >                                                             #
3
// # ********************************************************************************************* #
4
// #  Displays an 8-bit counter on the high-active LEDs connected to the parallel output port.     #
5
// # ********************************************************************************************* #
6
// # BSD 3-Clause License                                                                          #
7
// #                                                                                               #
8
// # Copyright (c) 2020, Stephan Nolting. All rights reserved.                                     #
9
// #                                                                                               #
10
// # Redistribution and use in source and binary forms, with or without modification, are          #
11
// # permitted provided that the following conditions are met:                                     #
12
// #                                                                                               #
13
// # 1. Redistributions of source code must retain the above copyright notice, this list of        #
14
// #    conditions and the following disclaimer.                                                   #
15
// #                                                                                               #
16
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of     #
17
// #    conditions and the following disclaimer in the documentation and/or other materials        #
18
// #    provided with the distribution.                                                            #
19
// #                                                                                               #
20
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to  #
21
// #    endorse or promote products derived from this software without specific prior written      #
22
// #    permission.                                                                                #
23
// #                                                                                               #
24
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS   #
25
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF               #
26
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE    #
27
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,     #
28
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
29
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED    #
30
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING     #
31
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED  #
32
// # OF THE POSSIBILITY OF SUCH DAMAGE.                                                            #
33
// # ********************************************************************************************* #
34
// # The NEO430 Processor - https://github.com/stnolting/neo430                                    #
35
// #################################################################################################
36
 
37
 
38
// Libraries
39
#include <stdint.h>
40
#include <neo430.h>
41
 
42
// Configuration
43
#define BAUD_RATE 19200
44
 
45
 
46
/* ------------------------------------------------------------
47
 * INFO Main function
48
 * ------------------------------------------------------------ */
49
int main(void) {
50
 
51
  // setup UART
52
  neo430_uart_setup(BAUD_RATE);
53
 
54
  // intro text
55
  neo430_uart_br_print("\nBlinking LED demo program\n");
56
 
57
  uint16_t i = 0;
58
  while (1) {
59
    neo430_gpio_port_set(0x00FF & (i++)); // set output port and increment counter
60
    neo430_cpu_delay_ms(200); // wait 200ms
61
  }
62
 
63
  return 0;
64
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.