Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

variable lenght of array not accept by keil uvision4

Status
Not open for further replies.
Hello Everyone ,

anybody send me a uart1 interrupt code .I am little bit confuse that hoe to enable uart1 interrup and I also write uart0 interrup code but my uart1 is not working..my code is bellow:



Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#define UART1_CH_NUM   7
#define VIC_UART1_CH   (0x01 << UART1_CH_NUM)
#define VIC_INT_CH_EN   (0x01 << 5) 
#define Fosc            12000000                    
#define Fcclk           (Fosc * 5)                  
#define Fcco            (Fcclk * 4)                 
#define Fpclk           (Fcclk / 4) * 1             
 
#define  UART_BPS   9600     //Set Baud Rate here
 
 
void  Init_UART1(void)                 //This function setups UART1
{  
   unsigned int Baud16;
   U1LCR = 0x83;                    // DLAB = 1
   Baud16 = (Fpclk / 16) / UART_BPS;  
   U1DLM = Baud16 / 256;                            
   U1DLL = Baud16 % 256;                        
   U1LCR = 0x03;
     U1FCR = 0x01;
   /* Configure the VIC for Interrupt Handling */
     VICVectCntl7  =  0x00000027;
     VICIntSelect &= ~0x00000080;      // UART1 selected as IRQ
       VICVectAddr7  =  (char)UART1_ISR;
     VICIntEnable |=  0x00000080;      // UART1 interrupt enabled
   /* Enabel the Interrupt for listening request */
  
    
    U1IER = 0x01;    //RI and TI interrupt
}

anyone tell me whats is my mistake of this init code of uart1........


thanks in advance
 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top