Rev 2953 Rev 4248
Line 25... Line 25...
25 unsigned int8 LSB=0,ZK,k=0; 25 unsigned int8 LSB=0,ZK,k=0;
26 //unsigned int8 26 //unsigned int8
27 27
28 while(TRUE) 28 while(TRUE)
29 { 29 {
30 -  
31 -  
32   -  
33   -  
34 i2c_start(); //blockdatacontrol 30 i2c_start(); //blockdatacontrol
35 I2C_Write(0xAA); 31 I2C_Write(0xAA);
36 I2C_write(0x61); 32 I2C_write(0x61);
37 i2c_start(); 33 i2c_start();
38 I2C_Write(0xAA); 34 I2C_Write(0xAA);
Line 50... Line 46...
50 i2c_write(0x40); 46 i2c_write(0x40);
51 i2c_stop(); 47 i2c_stop();
52 delay_ms (1); 48 delay_ms (1);
53 49
54 50
55 i2c_start();//dataflashblock 51 i2c_start();//dataflashblock
56 I2C_Write(0xAA); 52 I2C_Write(0xAA);
57 I2C_write(0x3f); 53 I2C_write(0x3f);
58 54
59 i2c_start(); 55 i2c_start();
60 I2C_Write(0xAA); 56 I2C_Write(0xAA);
61 I2C_write(0x00); 57 I2C_write(0x00);
62 i2c_stop(); 58 i2c_stop();
-   59
-   60 delay_ms (1);
63 61
64 delay_ms (1); -  
65 -  
66 i2c_start();//blockdata 62 i2c_start();//blockdata
67 I2C_Write(0xAA); 63 I2C_Write(0xAA);
68 I2C_write(0x44); 64 I2C_write(0x44);
69 65
70 i2c_start(); 66 i2c_start();
71 I2C_Write(0xAB); 67 I2C_Write(0xAB);
Line 74... Line 70...
74 70
75 delay_ms (1); 71 delay_ms (1);
76 72
77 printf("LED %lX \r\n", ZK); 73 printf("LED %lX \r\n", ZK);
78   74  
79 if(ZK==0x73) 75 if(ZK==0x73)
80 { 76 {
81 LSB=LSB-1; 77 LSB=LSB-1;
82 printf("Vysledne LSB %lX \r\n", LSB); 78 printf("Vysledne LSB %lX \r\n", LSB);
83 while(TRUE) 79 while(TRUE){}
84 { -  
85 } -  
86 } 80 }
87   -  
88 else 81 else
89 { 82 {
90 i2c_start();//blockdata 83 i2c_start();//blockdata
91 I2C_Write(0xAA); 84 I2C_Write(0xAA);
92 I2C_write(0x44); 85 I2C_write(0x44);
93 -  
94 i2c_start(); -  
95 I2C_Write(0xAA); -  
96 I2C_write(0x73); //pro 5LED 0x53 pro 7led 0x73 -  
97 i2c_stop(); -  
98 -  
99   -  
100 int i=64; -  
101 SOUCET=0; -  
102 SOUCET1=0; -  
103   -  
104 /* -  
105 for (i=64;i<96;++i) -  
106 { -  
107 printf("%u\r\n",i); -  
108 i2c_stop(); -  
109 86
-   87 i2c_start();
-   88 I2C_Write(0xAA);
-   89 I2C_write(0x73); //pro 5LED 0x53 pro 7led 0x73
-   90 i2c_stop();
-   91
-   92  
-   93 int i=64;
-   94 SOUCET=0;
-   95 SOUCET1=0;
-   96  
-   97 /*
-   98 for (i=64;i<96;++i)
-   99 {
-   100 printf("%u\r\n",i);
-   101 i2c_stop();
-   102
110 i2c_start();//blockdata 103 i2c_start();//blockdata
111 I2C_Write(0xAA); 104 I2C_Write(0xAA);
112 I2C_write(i); 105 I2C_write(i);
113 106
114 i2c_start(); 107 i2c_start();
115 I2C_Write(0xAB); 108 I2C_Write(0xAB);
116 STAV1=I2C_read(0); 109 STAV1=I2C_read(0);
117 i2c_stop(); 110 i2c_stop();
118 111
119 printf("STAV %lX \r\n", STAV1); 112 printf("STAV %lX \r\n", STAV1);
120 SOUCET=SOUCET+STAV1; 113 SOUCET=SOUCET+STAV1;
121 114
122 115
123 116
124 117
125 118
126 } 119 }
127 printf("SOUCET: %lX (procenta)\r\n", SOUCET); 120 printf("SOUCET: %lX (procenta)\r\n", SOUCET);
128 SOUCET1=SOUCET; 121 SOUCET1=SOUCET;
129 SOUCET1=SOUCET1>>8; 122 SOUCET1=SOUCET1>>8;
130 printf("Deleno 256: %lX (procenta)\r\n", SOUCET1); 123 printf("Deleno 256: %lX (procenta)\r\n", SOUCET1);
131 SOUCET1=SOUCET-SOUCET1; 124 SOUCET1=SOUCET-SOUCET1;
132 printf("Soucet - soucet/256: %lX \r\n", SOUCET1); 125 printf("Soucet - soucet/256: %lX \r\n", SOUCET1);
133 LSB=(unsigned int8)SOUCET1; 126 LSB=(unsigned int8)SOUCET1;
134 printf("LSB: %lX\r\n", LSB); 127 printf("LSB: %lX\r\n", LSB);
135 //printf("Stav: %X (procenta)\r\n", STAV2); 128 //printf("Stav: %X (procenta)\r\n", STAV2);
136 */ 129 */
137   130  
138 i2c_start();//blockdata 131 i2c_start();//blockdata
139 I2C_Write(0xAA); 132 I2C_Write(0xAA);
140 I2C_write(0x60); 133 I2C_write(0x60);
141 134
142 i2c_start(); 135 i2c_start();
143 I2C_Write(0xAA); 136 I2C_Write(0xAA);
144 I2C_write(LSB); 137 I2C_write(LSB);
145 i2c_stop(); 138 i2c_stop();
146   139  
147 } 140 }
148   141  
149 LSB=LSB+1; 142 LSB=LSB+1;
150   143  
151 delay_ms (100); 144 delay_ms (100);
152 } 145 }
153 } 146 }