00001 
00005 
#include "board.h"
00006 
#include "lcd.h"
00007 
00008 
00010 union Temp {
00011   
unsigned char c;
00012   
unsigned int i;
00013   
unsigned long l;
00014 } 
temp;
00015 
00016 
00018 unsigned char SPIGetChar(){
00019   
SPIPutCharWithoutWaiting(0xff); 
00020   
SPIWait(); 
00021   
return SPI_RESULT_BYTE; 
00022 }
00023   
00024 
00026 void SPI8Clocks(
unsigned char nClocks){
00027   
while (nClocks--){
00028     
SPIPutCharWithoutWaiting(0xff);
00029     
SPIWait();
00030   }
00031 }
00032 
00033 
00035 void Delay(
int milliseconds){
00036   
for (;milliseconds;milliseconds--){  
00037     
InitiateDelay (1000);
00038     
WaitOutDelay(); 
00039     }
00040 }
00041        
00043 void InitBoard()
00044 {
00045   AUXR   = 0x11;           
00046   
MP3_XRESET = 0;          
00047   
MMC_OFF = 1;             
00048 
00049 
00050   SPCON  = 0xF2;    
00051   CKCON0 = 0x01;    
00052   IEN0   = 0;       
00053   
00054   BDRCON = 0x1F;    
00055   PCON   = 0x80;    
00056   BRL    = 248;
00057   SCON   = 0x50;    
00058   TI     = 1;
00059  
00060   ConsoleWrite (
"\r\r\rBoard: Console is up.\r");
00061 
00062   
00063   TMOD = 1;
00064 
00065 
00066   RCAP2H = 143;     
00067   RCAP2L = 89;
00068   TH2    = 143;
00069   TL2    = 89;
00070   T2CON  = 0;
00071   T2MOD  = 0;
00072 
00073   TR2 = 1;          
00074   
00075 
00076   P2 = 0xEF;
00077   P3 = 0xFF;
00078 
00079   
InitiateDelay(0); 
00080 
00081   ConsoleWrite (
"Init: Board; supports: AT89C51RD2, MMC, VS10xx, RS232\r");
00082 
00083 
00084   
00085 }
00086  
00087 
00088