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

Subversion Repositories light52

[/] [light52/] [trunk/] [test/] [blinker/] [src/] [blinker.c] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 ja_rd
/**
2
    @file blinker.c
3
    @brief LED blinker demo for light52 core.
4
 
5
    Does nothing but send a greeting string to the console and do a binary count
6
    on port P0.
7
    Should fit in 4K of ROM and use no XRAM.
8
    This demo may come in handy to try the core on boards with no RS232 port or
9
    display.
10
*/
11
#include <stdio.h>
12
#include "../../include/light52.h"
13
#include "../../common/soc.h"
14
 
15
 
16
/*-- Local function prototypes -----------------------------------------------*/
17
 
18
 
19
 
20
 
21
/*-- Public functions --------------------------------------------------------*/
22
 
23
void main(void){
24
    uint32_t msecs, secs;
25
 
26
    /* Initialize the support code: timer0 set to count seconds. */
27
    /* The UART is left in its default reset state: 19200-8-N-1 */
28
    soc_init();
29
 
30
    /* Send a banner to the serial port, in case it is connected. */
31
    printf("\n\r");
32
    printf("Light52 project -- " __DATE__ "\n\n\r");
33
    printf("LED blinker test.\n\r");
34
 
35
    while(1){
36
        msecs = soc_get_msecs();
37
        secs = msecs/1000;
38
        P1 = (uint8_t)(secs & 0xff);
39
        P0 = (uint8_t)((secs>>8) & 0xff);
40
    }
41
}
42
 
43
/*-- Local functions ---------------------------------------------------------*/
44
 
45
 
46
 
47
 
48
 

powered by: WebSVN 2.1.0

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