Hi,
I'm starting learning 8051 mcu, came up with the startup code written in assembly. I have few things I need to know.
Here is the sample startup source code of bootloader:
My questions start with ????? below.
;SOME INITIALIZATION HERE CSEG AT 0 ?C_STARTUP: LJMP Start LJMP ISRApp_ExternalInt0 LJMP _WritePageOnFlash ds 2 ????? Why reserve 2-bytes? LJMP ISRApp_Timer0 LJMP GetP2Value ds 2 ????? Why reserve 2-bytes? ... LJMP ISRApp_UART1 ds 10 ????? Why reserve 10-bytes, does it overlap the 8-byte interrupt interval? LJMP ISRApp_SMB1 ... CSEG AT 1400h Base: dw $ ISRApp_Reset: lcall Error ????? Why it calls Error? ISRApp_ExternalInt0: lcall Error ISRApp_Timer0 lcall Error ... ISRApp_UART1 lcall Error Error: clr EA Loop: jmp Loop ... END
Also, what I don't understand here is, why it didn't indicate CSEG AT 03h for Interrup 0, CSEG AT 0Bh for Interrup 1, etc. as to what states here http://www.keil.com/support/docs/132.htm?
Hope somebody can lighten me up here.
I used Silabs 8051 mcu w/ keil's C51.
thanks gee
Is there something wrong with using someone elses initialisation code? I've done it before when I use Keil's startup code. The first time I did it the inquisitive part of me had me wondering what soome parts were about and what they did. no, but it is nice to say so. Using code provides as part of a toolset is more or less mandatory, so there is absolutely nothing 'wrong' with using Keil startup. However the code where unused interrupts go to 'error' is not Keil. Just it is far easier to answer questions if it is known whether it is code downloaded or written by the OP. The problems with downloaded code are (usually) very different fom the problems with own code.
Erik