PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Circuits
Seven Segment.c
1
/*
2
Seven Segment.c
3
4
Display digits on a 7 segment (common cathode) LED display.
5
6
http://learn.parallax.com/propeller-c-simple-circuits/seven-segment-display
7
*/
8
9
#include "
simpletools.h
"
// Include simpletools
10
11
int
main
()
// main function
12
{
13
set_directions
(15, 8, 0b11111111);
// P15...P8 -> output
14
15
set_outputs
(15, 8, 0b11100111);
// 0 -> 7-segment display
16
pause
(500);
17
set_outputs
(15, 8, 0b10000100);
// 1
18
pause
(500);
19
set_outputs
(15, 8, 0b11010011);
// 2
20
pause
(500);
21
set_outputs
(15, 8, 0b11010110);
// 3
22
pause
(500);
23
set_outputs
(15, 8, 0b10110100);
// 4
24
pause
(500);
25
set_outputs
(15, 8, 0b01110110);
// 5
26
pause
(500);
27
set_outputs
(15, 8, 0b01110111);
// 6
28
pause
(500);
29
set_outputs
(15, 8, 0b11000100);
// 7
30
pause
(500);
31
set_outputs
(15, 8, 0b11110111);
// 8
32
pause
(500);
33
set_outputs
(15, 8, 0b11110110);
// 9
34
pause
(500);
35
}
set_directions
void set_directions(int endPin, int startPin, unsigned int pattern)
Set directions for a contiguous group of I/O pins.
Definition:
setDirections.c:19
pause
void pause(int time)
Delay cog from moving on to the next statement for a certain length of time.
Definition:
libws2812.c:125
set_outputs
void set_outputs(int endPin, int startPin, unsigned int pattern)
Set output states for a contiguous group of I/O pins.
Definition:
setOutputs.c:20
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
main
int main(void)
Definition:
GraphicsTest.c:20
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17