📄 control.lst
字号:
189 1 HIGH_ADD = ((byte_address >> 8) & 0x00FF);// Upper 8 address bits
190 1 LOW_ADD = (byte_address & 0x00FF); // Lower 8 address bits
191 1
192 1 WORD = out_byte; // Data to be writen
193 1
194 1 STO = 0;
195 1 STA = 1; // Start transfer
196 1
197 1 }
198
199
200
201 /*********************************************************************************************************
202 ----------------------------------------------------------------------------------------------------------
203 char SM_Receive (char, unsigned int)
204 Author : Neil
205 Data : 2005-4
206 ----------------------------------------------------------------------------------------------------------
207 SMBus random read function------------------------------------------------------
208 Reads 1 byte from the specified memory location.
209
210 byte_address = memory address of byte to read
211 chip_address = device address of EEPROM to be read from
212
213 *********************************************************************************************************/
214
215 char SM_Receive (unsigned char chip_address, unsigned int byte_address)
216 {
217 1 while (SM_BUSY); // Wait for bus to be free.
218 1 SM_BUSY = 1; // Occupy SMBus (set to busy)
219 1 SMB0CN = 0x44; // SMBus enabled, ACK on acknowledge cycle
220 1
221 1 BYTE_NUMBER = 2; // 2 address bytes
222 1 COMMAND = (chip_address | READ); // Chip select + READ
223 1
224 1 HIGH_ADD = ((byte_address >> 8) & 0x00FF);// Upper 8 address bits
225 1 LOW_ADD = (byte_address & 0x00FF); // Lower 8 address bits
226 1
227 1 STO = 0;
228 1 STA = 1; // Start transfer
229 1 while (SM_BUSY); // Wait for transfer to finish
230 1 return WORD;
231 1 }
232
233
234
235
236
237 /*********************************************************************************************************
238 ----------------------------------------------------------------------------------------------------------
239 void UART0_Isr(void)
C51 COMPILER V7.06 CONTROL 06/13/2005 12:55:38 PAGE 5
240 Author : Neil
241 Data : 2005-4
242 ----------------------------------------------------------------------------------------------------------
243 UART0 interrupt service routine:
244
245 *********************************************************************************************************/
246 void UART0_Isr(void) interrupt 4
247 {
248 1 ES0 = 0x0; //Disable UART0 interrupt
249 1 if(TI0) //Transmission
250 1 {
251 2 SCON0 &=0xFD; //Clearn transmit interrupt pending flag
252 2 Tran_Flag=0;
253 2 if (Count_UART0a==7)
254 2 Tran_OK=0x45;
255 2
256 2 }
257 1 else //Receive
258 1 {
259 2 SCON0 &=0xFE; //Clearn receive interrupt pending flag
260 2 *pointer++ = SBUF0;
261 2 Count_UART0++;
262 2 if (Count_UART0==7)
263 2 {
264 3 Rec_OK=0x23;
265 3 }
266 2
267 2 }
268 1 ES0 = 0x1;
269 1 }
270
271
272
273
274
275
276 /*********************************************************************************************************
277 ----------------------------------------------------------------------------------------------------------
278 void SetTG (void)
279 Author : Neil
280 Data : 2005-5
281 ----------------------------------------------------------------------------------------------------------
282 This routine is read data and address
283 from 24lc256 to Set Timing Generator Register
284
285 *********************************************************************************************************/
286 void SetTG (void)
287 {
288 1 n=0;
289 1 for(i=0;i<=28;i++)
290 1 {
291 2 sRecComBuf[0]=SM_Receive (_24LC256, 4*n);
292 2 sRecComBuf[1]=SM_Receive (_24LC256, 4*n+1);
293 2 sRecComBuf[2]=SM_Receive (_24LC256, 4*n+2);
294 2 sRecComBuf[3]=SM_Receive (_24LC256, 4*n+3);
295 2 n++;
296 2 pointer=sRecComBuf; //pointer->sRecComBuf[0]
297 2 Address0707=*pointer++<<8;
298 2 Address0707+=*pointer++;
299 2 Data0707 =*pointer++<<8;
300 2 Data0707 +=*pointer;
301 2 Address24LC256=*pointer++<<8;
C51 COMPILER V7.06 CONTROL 06/13/2005 12:55:38 PAGE 6
302 2 Address24LC256 +=*pointer++;
303 2 pointer=sRecComBuf; //pointer->sRecComBuf[0]
304 2 _0707READY();
305 2 WRITE_0707(Address0707,Data0707);
306 2 NONE_READY();
307 2 }
308 1 }
309
310
311
312
313 /*********************************************************************************************************
314 ----------------------------------------------------------------------------------------------------------
315 void SetVSPCR (void)
316 Author : Neil
317 Data : 2005-5
318 ----------------------------------------------------------------------------------------------------------
319 This routine is read data and address
320 from 24lc256 to Set Video Signal Processing Common Setting Register
321
322 *********************************************************************************************************/
323 void SetVSPCR (void)
324 {
325 1 n=29;
326 1 for(i=0;i<=17;i++)
327 1 {
328 2 sRecComBuf[0]=SM_Receive (_24LC256, 4*n);
329 2 sRecComBuf[1]=SM_Receive (_24LC256, 4*n+1);
330 2 sRecComBuf[2]=SM_Receive (_24LC256, 4*n+2);
331 2 sRecComBuf[3]=SM_Receive (_24LC256, 4*n+3);
332 2 n++;
333 2 pointer=sRecComBuf; //pointer->sRecComBuf[0]
334 2 Address0707=*pointer++<<8;
335 2 Address0707+=*pointer++;
336 2 Data0707 =*pointer++<<8;
337 2 Data0707 +=*pointer;
338 2 Address24LC256=*pointer++<<8;
339 2 Address24LC256 +=*pointer++;
340 2 pointer=sRecComBuf; //pointer->sRecComBuf[0]
341 2 _0707READY();
342 2 WRITE_0707(Address0707,Data0707);
343 2 NONE_READY();
344 2 }
345 1 }
346
347
348
349
350
351 /*********************************************************************************************************
352 ----------------------------------------------------------------------------------------------------------
353 void SetVSPRSR (void)
354 Author : Neil
355 Data : 2005-5
356 ----------------------------------------------------------------------------------------------------------
357 This routine is read data and address
358 from 24lc256 to Set Video Signal Processing Red Setting Register
359
360 *********************************************************************************************************/
361 void SetVSPRSR (void)
362 {
363 1 n=47;
C51 COMPILER V7.06 CONTROL 06/13/2005 12:55:38 PAGE 7
364 1 for(i=0;i<=18;i++)
365 1 {
366 2 sRecComBuf[0]=SM_Receive (_24LC256, 4*n);
367 2 sRecComBuf[1]=SM_Receive (_24LC256, 4*n+1);
368 2 sRecComBuf[2]=SM_Receive (_24LC256, 4*n+2);
369 2 sRecComBuf[3]=SM_Receive (_24LC256, 4*n+3);
370 2 n++;
371 2 pointer=sRecComBuf; //pointer->sRecComBuf[0]
372 2 Address0707=*pointer++<<8;
373 2 Address0707+=*pointer++;
374 2 Data0707 =*pointer++<<8;
375 2 Data0707 +=*pointer;
376 2 Address24LC256=*pointer++<<8;
377 2 Address24LC256 +=*pointer++;
378 2 pointer=sRecComBuf; //pointer->sRecComBuf[0]
379 2 _0707READY();
380 2 WRITE_0707(Address0707,Data0707);
381 2 NONE_READY();
382 2 }
383 1 }
384
385
386
387
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -