C51 COMPILER V6.02 MAIN 04/28/2005 13:57:00 PAGE 1 C51 COMPILER V6.02, COMPILATION OF MODULE MAIN OBJECT MODULE PLACED IN .\main.OBJ COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE .\main.c DEBUG OBJECTEXTEND stmt level source 1 #include 2 #define uchar unsigned char 3 #define uint unsigned int 4 #define MSGLEN 10 5 6 uchar incoming, outgoing, lastincar; // Received, Trans Msgs 7 bit newin; 8 bit gone; // Global Flags 9 10 // Initialize Message Variables 11 uchar inmsg[MSGLEN]; 12 uchar msg[MSGLEN] = {13,14,31,12,04,18,18,00,06,12}; 13 uchar outmsg[MSGLEN] = {13,14,31,12,04,18,18,00,06,12}; 14 uint inpos = 0; 15 uint outpos = 0; 16 17 // Serial Port Interrupt-Service Routine 18 // Interrupt 4 is generated by RI or TI, 19 // the serial port interrupt. 20 21 22 void serint(void) interrupt 4 using 1{ 23 1 24 1 uint temp; 25 1 26 1 if(RI){ // Check for a received byte 27 2 28 2 inmsg[inpos] = SBUF; 29 2 inpos = inpos + 1; // Increment Message Position 30 2 31 2 if(inpos == 10){ // We finished receiving the message 32 3 33 3 for(temp=0; temp < MSGLEN ;temp++) 34 3 msg[temp] = inmsg[temp]; 35 3 inpos = 0; 36 3 newin = 1; // Tell the main function we received 37 3 38 3 } 39 2 40 2 RI = 0; // Reset interrupt flag 41 2 42 2 } else if(TI){ // Check if we just sent a byte 43 2 44 2 SBUF = outgoing; // Send the next byte 45 2 TI = 0; // Reset interrupt flag 46 2 gone = 1; // Tell the main function we sent 47 2 48 2 } 49 1 } 50 51 52 xdata uchar FrameBuffer[384] _at_ 0xFE00; 53 54 55 // Main Function C51 COMPILER V6.02 MAIN 04/28/2005 13:57:00 PAGE 2 56 57 void main(void){ 58 1 59 1 // Initialize Display Variables 60 1 uint delay; 61 1 uint temp; 62 1 uint x=0; // start x-coord 63 1 uint y=4; // start y-coord 64 1 uint vx=0; // velocity in x-dir 65 1 uint vy=1; // velocity in y-dir//Initialize UART 66 1 67 1 TMOD = 0x20; // User Timer1, Mode 2 68 1 TH1 = 0xFD; // 9600 baud w/ 11.059mhz clock 69 1 TCON = 0x40; // Start baud clock 70 1 SCON = 0x50; // Enable receive 71 1 IE = 0x90; // Enable serial interface 72 1 73 1 // Initialize Flags 74 1 gone = 0; 75 1 newin = 0; 76 1 77 1 while(1){ 78 2 79 2 // If we sent the last character, put the lastcharacter 80 2 // read into the output buffer, outgoing. 81 2 82 2 while(!newin){ 83 3 84 3 if(gone){ 85 4 86 4 outgoing = outmsg[outpos]; 87 4 outpos = outpos + 1; // Increment Message Position 88 4 89 4 if(outpos = 10){ *** WARNING C276 IN LINE 89 OF .\MAIN.C: constant in condition expression 90 5 outpos = 0; 91 5 TI = 0; 92 5 } else { 93 5 TI = 1; // If we didn't just finish 94 5 // sending tot msg, send again 95 5 } 96 4 97 4 gone = 0; // Reset flag 98 4 } 99 3 100 3 } 101 2 102 2 // Display Functionality 103 2 104 2 for(temp=0; temp(16-MSGLEN)) // Checks Xmax value 108 2 x=0; 109 2 110 2 if(y>7) // Checks Ymax value 111 2 y=0; 112 2 113 2 for(temp=0; temp