hi i whant define function "UART0_IRQHandler" in my library ( uart library ) but i dont whant use #include <lpc17xx.h> and startup_LPC17xx.s
I tried this code but did not work void (*test) (void) = (void (*) (void)) 0x54;
in file "LPC176x/5x User manual ( UM10360 )" and "Table 50" :
Interrupt_ID : 5 Exception_Number : 21 Vector_Offset : 0x54 Function : UART0 Flag(s) : Rx Line Status (RLS) Transmit Holding Register Empty (THRE) Rx Data Available (RDA) Character Time-out Indicator (CTI) End of Auto-Baud (ABEO) Auto-Baud Time-Out (ABTO)
www2.keil.com/.../learn
http://www.keil.com/support/man/
http://www.keil.com/appnotes/
http://www.keil.com/books/
And don't forget resources from the chip manufacturer:
www.nxp.com/.../lpc1700-cortex-m3:MC_1403790745385
www.nxp.com/.../developer-resources:DEVELOPER_HOME
So why discard all the available methods? At least they were coded by people who had a grasp of what they were doing and what the processor is expecting.
i define all register and i whant define all interrupt function - i dont love use default library keil -
dif register for uart :
class UART { // Table 271 public : volatile uint32_t *RBR[4] = { // DLAB = 0, RO (uint32_t *)0x4000C000, (uint32_t *)0x40010000, (uint32_t *)0x40098000, (uint32_t *)0x4009C000 }; volatile uint32_t *THR[4] = { // DLAB = 0, WO (uint32_t *)0x4000C000, (uint32_t *)0x40010000, (uint32_t *)0x40098000, (uint32_t *)0x4009C000 }; volatile uint32_t *DLL[4] = { // DLAB = 1, R/W (uint32_t *)0x4000C000, (uint32_t *)0x40010000, (uint32_t *)0x40098000, (uint32_t *)0x4009C000 }; volatile uint32_t *DLM[4] = { // DLAB = 1 (uint32_t *)0x4000C004, (uint32_t *)0x40010004, (uint32_t *)0x40098004, (uint32_t *)0x4009C004 }; volatile uint32_t *IER[4] = { // DLAB = 0 (uint32_t *)0x4000C004, (uint32_t *)0x40010004, (uint32_t *)0x40098004, (uint32_t *)0x4009C004 }; volatile uint32_t *IIR[4] = { // RO (uint32_t *)0x4000C008, (uint32_t *)0x40010008, (uint32_t *)0x40098008, (uint32_t *)0x4009C008 }; volatile uint32_t *FCR[4] = { // WO (uint32_t *)0x4000C008, (uint32_t *)0x40010008, (uint32_t *)0x40098008, (uint32_t *)0x4009C008 }; volatile uint32_t *LCR[4] = { (uint32_t *)0x4000C00C, (uint32_t *)0x4001000C, (uint32_t *)0x4009800C, (uint32_t *)0x4009C00C }; volatile uint32_t *U1MCR = (uint32_t *)0x40010010; // Just for UART1 volatile uint32_t *LSR[4] = { (uint32_t *)0x4000C014, (uint32_t *)0x40010014, (uint32_t *)0x40098014, (uint32_t *)0x4009C014 }; volatile uint32_t *U1MSR = (uint32_t *)0x40010018; // Just for UART1 volatile uint32_t *SCR[4] = { (uint32_t *)0x4000C01C, (uint32_t *)0x4001001C, (uint32_t *)0x4009801C, (uint32_t *)0x4009C01C }; volatile uint32_t *ACR[4] = { (uint32_t *)0x4000C020, (uint32_t *)0x40010020, (uint32_t *)0x40098020, (uint32_t *)0x4009C020 }; volatile uint32_t *U0ICR = (uint32_t *)0x4000C024; // Just for UART0 volatile uint32_t *U2ICR = (uint32_t *)0x40098024; // Just for UART2 volatile uint32_t *U3ICR = (uint32_t *)0x4009C024; // Just for UART3 volatile uint32_t *FDR[4] = { (uint32_t *)0x4000C028, (uint32_t *)0x40010028, (uint32_t *)0x40098028, (uint32_t *)0x4009C028 }; volatile uint32_t *TER[4] = { (uint32_t *)0x4000C030, (uint32_t *)0x40010030, (uint32_t *)0x40098030, (uint32_t *)0x4009C030 }; volatile uint32_t *U1RS485CTRL = (uint32_t *)0x4001004C; // Just for UART1 volatile uint32_t *U1ADRMATCH = (uint32_t *)0x40010050; // Just for UART1 volatile uint32_t *U1RS485DLY = (uint32_t *)0x40010054; // Just for UART1 };
wtf - sry - see this link ( dif register for uart ) - paste.debian.net/.../
pls help me - i need define interrupt function in my project but i dont whant use this file : "startup_LPC17xx.s"
========== i define all register and clock setting and i removed "startup_LPC17xx.c" but i cant define interrupt function in my project
no person cant help me?
Until you understand what startup_LPC17xx.s does, you will not be able to add its functionality somewhere else and add your own interrupt handler routines.
fortunately, if you do use startup_LPC17xx.s, you can just write a c function with the same name as in startup_LPC17xx.s and the Default handler will be replaced with your function.
In main (or somewhere)
void UART0_HandlerIRQ(void) { your code here }
Will cause your UART0_HandlerIRQ{) function to be called every time it is activated.
You really do need to understand what startup_LPC17xx.s does before you can remove it. it is only about 250 lines. It would be helpful if you did not post again until you understand what startup_LPC17xx.s does and how you plan on making sure startup happens properly without using startup_LPC17xx.s
The instructions for posting source code are simple, and clearly stated.
See: www.danlhenry.com/.../keil_code.png
That's no reason not to look at what they (and others) have done, and learn from it.
If you want to build from first principles, then you'll need some good references:
http://infocenter.arm.com/
http://www.keil.com/books/armbooks.asp
In particular, I would recommend Joseph Yiu's Definitive Guide series.
In a Cortex-M3 device, the Nested Vector Interrupt Controller (NVIC) and the processor core interface are closely coupled, which enables low latency interrupt processing The device handles interrupts. This coupling means that are rules that need to be followed in setting up the vector table, including the order in the table, and how to place the initial stack pointer.
See more at:
developer.arm.com/.../about-the-nvic
You can learn about the parts of a startup file here: www.keil.com/.../group__NVIC__gr.html
As a warning, if you do not use the startup file that NXP provides, you will find it harder to get help from others for using non-standard code.
If you want to write your own startup file, I suggest taking an online class about the Cortex-M architecture.
www.arm.com/.../efficient-embedded-systems