PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Propeller GCC Demos
toggle
lmm_toggle
toggle.c
1
/*
2
This shows an example for creating an LMM program and Makefile.
3
It simply toggles the pins at 1Hz rate.
4
5
This program can also be run in COG mode.
6
7
Copyright (c) 2011 Parallax, Inc.
8
MIT Licensed.
9
10
+--------------------------------------------------------------------
11
TERMS OF USE: MIT License
12
+--------------------------------------------------------------------
13
Permission is hereby granted, free of charge, to any person obtaining
14
a copy of this software and associated documentation files
15
(the "Software"), to deal in the Software without restriction,
16
including without limitation the rights to use, copy, modify, merge,
17
publish, distribute, sublicense, and/or sell copies of the Software,
18
and to permit persons to whom the Software is furnished to do so,
19
subject to the following conditions:
20
21
The above copyright notice and this permission notice shall be
22
included in all copies or substantial portions of the Software.
23
24
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
27
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
28
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
29
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
30
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
+--------------------------------------------------------------------
32
*/
33
34
#include "propeller.h"
35
36
int
main
(
int
argc,
char
* argv[])
37
{
38
int
mask = 0x3fffffff;
39
int
freq =
CLKFREQ
>>1;
40
DIRA
= mask;
41
for
(;;) {
42
OUTA
^=
DIRA
;
43
waitcnt
(freq+
CNT
);
44
}
45
}
46
OUTA
#define OUTA
Use to set output pin states when corresponding DIRA bits are 1.
Definition:
propeller1.h:157
main
int main(void)
Definition:
GraphicsTest.c:20
CLKFREQ
#define CLKFREQ
Returns the current clock frequency.
Definition:
propeller.h:46
waitcnt
#define waitcnt(a)
Wait until system counter reaches a value.
Definition:
propeller.h:176
CNT
#define CNT
The system clock count.
Definition:
propeller1.h:151
DIRA
#define DIRA
Use to set pins to input (0) or output (1).
Definition:
propeller1.h:161
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17