VLSI Solution Oy VS1103 VLSI Solution Karaoke, MIDI and ADPCM Player Source Code Documentation

Main Page | Class List | File List | Class Members | File Members | Related Pages

board.c

Go to the documentation of this file.
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); /* send 0xff */
00020   SPIWait(); /* wait for the byte to transfer */
00021   return SPI_RESULT_BYTE; /* Return the received byte */
00022 }
00023   
00024 
00026 void SPI8Clocks(unsigned char nClocks){
00027   while (nClocks--){
00028     SPIPutCharWithoutWaiting(0xff);
00029     SPIWait();
00030   }
00031 }
00032 
00033 
00036 void Delay(int milliseconds){
00037   for (;milliseconds;milliseconds--){  /* for n times do: */
00038     InitiateDelay (1000);
00039     WaitOutDelay(); /* 1 ms delay */
00040     }
00041 }
00042        
00044 void InitBoard()
00045 {
00046   AUXR   = 0x11;           /* Take full memory into use */
00047   
00048   Mp3PutInReset();
00049 
00050   //  MP3_XRESET = 0;          /* Put the MP3 chip into reset */
00051 
00052 
00053   SPCON  = 0xF2;    /* Set slow spi clock        */
00054   CKCON0 = 0x01;    /* CPU x 2, timer2 x 1       */
00055   IEN0   = 0;       /* Disable all interrupts    */
00056   
00057   BDRCON = 0x1F;    /* Set uart for  115200,8n1  */
00058   PCON   = 0x80;    /* Double Baud Rate */
00059   BRL    = 248;      /* 248 for 115200 */
00060   SCON   = 0x50;    /* Serial Port Control Register */
00061   TI     = 1;
00062  
00063   ConsoleWrite ("\r\r\rBoard: Console is up.\r");
00064 
00065 
00066   //Timer1: make interrupt for each up-pulse
00067   //Accomplish this by setting counter auto-reload mode
00068   //with 0xff as auto-reload value
00069   TMOD = 0x61;
00070   TH1 = 0xFF;
00071   TL1 = 0xFF;
00072   ET1 = 1; //Enable Interrupt
00073   
00074   
00075 
00076   TR1 = 1;
00077 
00078 
00079   RCAP2H = 143;     /* Set timer2 for 128 interrupts in second */
00080   RCAP2L = 89;
00081   TH2    = 143;
00082   TL2    = 89;
00083   T2CON  = 0;
00084   T2MOD  = 0;
00085 
00086   TR2 = 1;          /* Start timer2               */
00087   // ET2 = 1;          /* Enable timer2 interrupts   */
00088 
00089   //  P2 = 0xEF;
00090   //P3 = 0xFF;
00091 
00092   InitiateDelay(0); /* Initialize the Delay System */
00093 
00094   SPISetFastClock(); // Switch to fast SPI clock
00095 
00096   ConsoleWrite ("Init: Board; supports: AT89C51RD2, MMC, VS10xx, RS232\r");
00097 
00098 
00099 
00100   // EA  = 1;          /* Global enable for interrupts */
00101 }
00102  
00103 
00104 

All software copyright 2000-2004 VLSI Solution OY. Redistribution of these software modules is limited to VLSI Solution Oy chip promotional use only. Free or commercial use of these software modules in MP3 players is ok if the product includes chip(s) from VLSI. You can request the complete (compilable) package from mp3@vlsi.fi. This exampe code is provided with good faith to assist You in code development, but under no circumstances will VLSI offer any guarantees on the usability or functionality of any example software or its fitness for any purpose.