Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Seven Segment.c
- Display digits on a 7-segment (common cathode) LED display.
- */
- #include "simpletools.h" // Include simpletools
- int n[] = {0b11100111, 0b10000100, 0b11010011,
- 0b11010110, 0b10110100, 0b01110110,
- 0b11110111, 0b11000100, 0b11110111,
- 0b11110110, 0b11110101, 0b00110111,
- 0b00010011, 0b10010111, 0b01110011,
- 0b01110001, 0b11110110, 0b00110101,
- 0b00100001, 0b10000111, 0b00100011,
- 0b00010101, 0b00010111, 0b11110001,
- 0b11110100, 0b00010001, 0b01110110,
- 0b00110011, 0b00000111, 0b10110100};
- char s[9];
- int main()
- {
- while(1) // main function
- {
- set_directions(15, 8, 0b11111111); // P15...P8 -> output
- pause(1000);
- for(int i = 0; i < 30; i++)
- {
- set_outputs(15, 8, n[i]);
- printf("n[%d] displayed.\n", i, n[i]);
- pause(1000);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement