Advertisement
Litigare

Untitled

Jun 17th, 2021
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.00 KB | None | 0 0
  1. /*
  2.  * "Hello World" example.
  3.  *
  4.  * This example prints 'Hello from Nios II' to the STDOUT stream. It runs on
  5.  * the Nios II 'standard', 'full_featured', 'fast', and 'low_cost' example
  6.  * designs. It runs with or without the MicroC/OS-II RTOS and requires a STDOUT
  7.  * device in your system's hardware.
  8.  * The memory footprint of this hosted application is ~69 kbytes by default
  9.  * using the standard reference design.
  10.  *
  11.  * For a reduced footprint version of this template, and an explanation of how
  12.  * to reduce the memory footprint for a given application, see the
  13.  * "small_hello_world" template.
  14.  *
  15.  */
  16.  
  17. #include <stdio.h>
  18. #include <system.h>
  19. #include <io.h>
  20.  
  21. //      leds
  22. #define  LED0 0x00000001
  23. #define  LED1 0x00000002
  24. #define  LED2 0x00000004
  25. #define  LED3 0x00000008
  26. #define  LED4 0x00000010
  27. #define  LED5 0x00000020
  28. #define  LED6 0x00000040
  29. #define  LED7 0x00000080
  30. #define  LED8 0x00000100
  31. #define  LED9 0x00000200
  32. //      hex
  33. #define  SEGA 0x00001
  34. #define  SEGB 0x00002
  35. #define  SEGC 0x00004
  36. #define  SEGD 0x00008
  37. #define  SEGE 0x00010
  38. #define  SEGF 0x00020
  39. #define  SEGG 0x00040
  40. //     hex - numbers
  41. #define ZERO SEGA | SEGB | SEGC | SEGD |SEGE | SEGF
  42. #define ONE  SEGB | SEGC
  43. #define TWO  SEGA | SEGB | SEGG | SEGE | SEGD
  44. #define THREE SEGA | SEGB | SEGC | SEGD | SEGG
  45. #define FOUR SEGG | SEGF | SEGB | SEGC
  46. #define FIVE SEGA | SEGE | SEGG | SEGC | SEGD
  47. #define E  SEGA | SEGD | SEGE | SEGF | SEGG
  48. #define R  SEGE | SEGG
  49.  
  50. int main()
  51. {
  52.           int i=0;
  53.           int read;
  54.           while (1)
  55.             {
  56.               read = IORD(SHAREDMEMORY_BASE, 0); //read shared memory
  57.               if(read=6){
  58.                     while(1){
  59.  
  60.                                                           if(i % 2 == 0){
  61.                                                               IOWR(LEDS_BASE, 0, LED1); // 1 zolte
  62.  
  63.                                                               IOWR(LEDS_BASE, 0, LED6);// 2 Zolte
  64.                                                               IOWR(SKRZYZOWANIE_0_BASE, 0, 4); // -- LED1(3): ON LED2(4): on LED3(8): on LED4(9): ON
  65.                                                               for(int k=0; k<50000000 ; k++){ // opoznienie procesore 2 mhz o 1 sek
  66.                                                                                  }
  67.                                                           }
  68.                                                           else{
  69.                                                               IOWR(LEDS_BASE, 0, 0x0);
  70.                                                               IOWR(SKRZYZOWANIE_0_BASE, 0, 3);// -- LED1(3): off LED2(4): off LED3(8): off LED4(9): off
  71.                                                               for(int k=0; k<50000000 ; k++){ // opoznienie procesore 2 mhz o 1 sek
  72.                                                                                  }
  73.                                                           }
  74.                                                           i++;
  75.                                                       }
  76.               }
  77.               else break;
  78.  
  79.  
  80.  
  81.                               OSTimeDlyHMSM(0, 0, 0, 10);
  82.                           }
  83. }
  84.  
  85.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement