Guest User

Untitled

a guest
Sep 10th, 2013
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Seven Segment.c
  3.  
  4. Display segments on a 7-segment (common cathode) LED display.
  5. */
  6.  
  7. #include "simpletools.h" // Include simpletools
  8.  
  9. int main()
  10. {
  11. while(1) // main function
  12. {
  13. set_directions(15, 8, 0b11111111); // P15...P8 -> output
  14.  
  15. set_outputs(15, 8, 0b00000000);
  16. pause(500);
  17. set_outputs(15, 8, 0b00000001);
  18. pause(500);
  19. set_outputs(15, 8, 0b00000010);
  20. pause(500);
  21. set_outputs(15, 8, 0b00000100);
  22. pause(500);
  23. set_outputs(15, 8, 0b00001000);
  24. pause(500);
  25. set_outputs(15, 8, 0b00010000);
  26. pause(500);
  27. set_outputs(15, 8, 0b00100000);
  28. pause(500);
  29. set_outputs(15, 8, 0b01000000);
  30. pause(500);
  31. set_outputs(15, 8, 0b10000000);
  32. pause(500);
  33. set_outputs(15, 8, 0b00000000);
  34. pause(500);
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment