Advertisement
Atdiy

Untitled

Aug 28th, 2013
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. /*
  2. Seven Segment.c
  3.  
  4. Display digits on a 7-segment (common cathode) LED display.
  5. */
  6.  
  7. #include "simpletools.h" // Include simpletools
  8.  
  9. int n[] = {0b11100111, 0b10000100, 0b11010011,
  10. 0b11010110, 0b10110100, 0b01110110,
  11. 0b11110111, 0b11000100, 0b11110111,
  12. 0b11110110, 0b11110101, 0b00110111,
  13. 0b00010011, 0b10010111, 0b01110011,
  14. 0b01110001, 0b11110110, 0b00110101,
  15. 0b00100001, 0b10000111, 0b00100011,
  16. 0b00010101, 0b00010111, 0b11110001,
  17. 0b11110100, 0b00010001, 0b01110110,
  18. 0b00110011, 0b00000111, 0b10110100};
  19.  
  20. char s[9];
  21.  
  22. int main()
  23. {
  24. while(1) // main function
  25. {
  26. set_directions(15, 8, 0b11111111); // P15...P8 -> output
  27. pause(1000);
  28.  
  29. for(int i = 0; i < 30; i++)
  30. {
  31. set_outputs(15, 8, n[i]);
  32. printf("n[%d] displayed.\n", i, n[i]);
  33.  
  34. pause(1000);
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement