I used the SI Labs config 2 wizard to generate the following code and then added the interrupt at the bottom. The only thing I do in my main is try to set TI1 to 1 which should signal hardware to jump to the UART1 ISR. If I set a break point in main and in the UART1 ISR, I never get there. Any ideas??? Jeff Below is code:
#include "c8051F060.h" void Timer_Init(); void UART_Init(); void Port_IO_Init(); void Oscillator_Init(); void Interrupts_Init(); void Init_Device(void); void UART1_ISR(); void main(); void Reset_Sources_Init(); void UART1_ISR(void); void main() { TI1 = 1; } // Peripheral specific initialization functions, // Called from the Init_Device() function void Reset_Sources_Init() { WDTCN = 0xDE; WDTCN = 0xAD; } void Timer_Init() { SFRPAGE = TIMER01_PAGE; TCON = 0x40; TMOD = 0x20; CKCON = 0x10; TH1 = 0x40; } void UART_Init() { SFRPAGE = UART1_PAGE; SCON1 = 0x50; } void Port_IO_Init() { // P0.0 - TX1 (UART1), Open-Drain, Digital // P0.1 - RX1 (UART1), Open-Drain, Digital // P0.2 - Unassigned, Open-Drain, Digital // P0.3 - Unassigned, Open-Drain, Digital // P0.4 - Unassigned, Open-Drain, Digital // P0.5 - Unassigned, Open-Drain, Digital // P0.6 - Unassigned, Open-Drain, Digital // P0.7 - Unassigned, Open-Drain, Digital // P1.0 - Unassigned, Open-Drain, Digital // P1.1 - Unassigned, Open-Drain, Digital // P1.2 - Unassigned, Open-Drain, Digital // P1.3 - Unassigned, Open-Drain, Digital // P1.4 - Unassigned, Open-Drain, Digital // P1.5 - Unassigned, Open-Drain, Digital // P1.6 - Unassigned, Open-Drain, Digital // P1.7 - Unassigned, Open-Drain, Digital // P2.0 - Unassigned, Open-Drain, Digital // P2.1 - Unassigned, Open-Drain, Digital // P2.2 - Unassigned, Open-Drain, Digital // P2.3 - Unassigned, Open-Drain, Digital // P2.4 - Unassigned, Open-Drain, Digital // P2.5 - Unassigned, Open-Drain, Digital // P2.6 - Unassigned, Open-Drain, Digital // P2.7 - Unassigned, Open-Drain, Digital SFRPAGE = CONFIG_PAGE; XBR2 = 0x44; } void Oscillator_Init() { int i = 0; SFRPAGE = CONFIG_PAGE; OSCXCN = 0x67; for (i = 0; i < 3000; i++); // Wait 1ms for initialization while ((OSCXCN & 0x80) == 0); CLKSEL = 0x01; OSCICN = 0x00; } void Interrupts_Init() { IE = 0x80; EIE2 = 0x40; } // Initialization function for device, // Call Init_Device() from your main program void Init_Device(void) { Reset_Sources_Init(); Timer_Init(); UART_Init(); Port_IO_Init(); Oscillator_Init(); Interrupts_Init(); } //----------------------------------------------------------------------------- // UART1 Interrupt Service Routine //----------------------------------------------------------------------------- void UART1_ISR (void) interrupt 20 { TI1 = 0; // Clear interrupt flag }
Sorry forgot, add the Init_device(); in main. Still does not jump tho.
It looks like Tx should be push-pull not open drain
just found crosspost at http://www.cygnal.org/ubb/Forum5/HTML/000788.html
Thanks everyone for you help. I now have it working and have posted below the code that will jump in the UART1 ISR for anyone that would like to use it as a bare minimum check. My settings are for a Ex. Osc. at 22.1184 Mhz and a baud rate of 57600 ///////////////////////////////////// // Generated Initialization File // /////////////////////////////////////
#include "c8051F060.h" void Timer_Init(); void UART_Init(); void Port_IO_Init(); void Oscillator_Init(); void Interrupts_Init(); void Init_Device(void); void Reset_Sources_Init(); void UART1_ISR(void); void main() { Init_Device(); TI1 = 1; } // Peripheral specific initialization functions, // Called from the Init_Device() function void Reset_Sources_Init() { WDTCN = 0xDE; WDTCN = 0xAD; } void Timer_Init() { SFRPAGE = TIMER01_PAGE; TCON = 0x40; TMOD = 0x20; CKCON = 0x10; TH1 = 0x40; } void UART_Init() { SFRPAGE = UART1_PAGE; SCON1 = 0x50; } void Port_IO_Init() { // P0.0 - TX1 (UART1), Open-Drain, Digital // P0.1 - RX1 (UART1), Open-Drain, Digital // P0.2 - Unassigned, Open-Drain, Digital // P0.3 - Unassigned, Open-Drain, Digital // P0.4 - Unassigned, Open-Drain, Digital // P0.5 - Unassigned, Open-Drain, Digital // P0.6 - Unassigned, Open-Drain, Digital // P0.7 - Unassigned, Open-Drain, Digital // P1.0 - Unassigned, Open-Drain, Digital // P1.1 - Unassigned, Open-Drain, Digital // P1.2 - Unassigned, Open-Drain, Digital // P1.3 - Unassigned, Open-Drain, Digital // P1.4 - Unassigned, Open-Drain, Digital // P1.5 - Unassigned, Open-Drain, Digital // P1.6 - Unassigned, Open-Drain, Digital // P1.7 - Unassigned, Open-Drain, Digital // P2.0 - Unassigned, Open-Drain, Digital // P2.1 - Unassigned, Open-Drain, Digital // P2.2 - Unassigned, Open-Drain, Digital // P2.3 - Unassigned, Open-Drain, Digital // P2.4 - Unassigned, Open-Drain, Digital // P2.5 - Unassigned, Open-Drain, Digital // P2.6 - Unassigned, Open-Drain, Digital // P2.7 - Unassigned, Open-Drain, Digital SFRPAGE = CONFIG_PAGE; XBR2 = 0x44; } void Oscillator_Init() { int i = 0; SFRPAGE = CONFIG_PAGE; OSCXCN = 0x67; for (i = 0; i < 3000; i++); // Wait 1ms for initialization while ((OSCXCN & 0x80) == 0); CLKSEL = 0x01; OSCICN = 0x00; } void Interrupts_Init() { IE = 0x80; EIE2 = 0x40; } // Initialization function for device, // Call Init_Device() from your main program void Init_Device(void) { Reset_Sources_Init(); Timer_Init(); UART_Init(); Port_IO_Init(); Oscillator_Init(); Interrupts_Init(); SFRPAGE = UART1_PAGE; //Return to page 1 } //----------------------------------------------------------------------------- // UART1 Interrupt Service Routine //----------------------------------------------------------------------------- void UART1_ISR (void) interrupt 20 { TI1 = 0; // Clear interrupt flag }