Advertisement
Guest User

lab4fixed

a guest
Oct 15th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <reg51.h>
  2.  
  3. int x_fixed;
  4. unsigned char xdata y[100], i;
  5.  
  6. unsigned int f(unsigned int x) {
  7. unsigned int S = 0x0f;
  8. S = 0xf0+((x*S)>>8);
  9. S = 0xf0+((x*S)>>8);
  10. S = 0xf0+((x*S)>>8);
  11. S = 0xf0-((x*S)>>8);
  12. return S;
  13. }
  14.  
  15. main()
  16. {
  17. i = 0;
  18. for (x_fixed = 99; x_fixed >= 0; --x_fixed)
  19. y[i++] = f(x_fixed);
  20. while(1)
  21. {
  22. i = 0;
  23. for (x_fixed = 0; x_fixed <= 99; ++x_fixed)
  24. {
  25. f(x_fixed);
  26. P1 = y[i++];
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement