CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Reset Vector

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
.C



Joined: 06 May 2004
Posts: 19
Location: Italy

View user's profile Send private message

Reset Vector
PostPosted: Thu May 27, 2004 8:45 am     Reply with quote

Hi

Do you know if Main() start at 0x000h ?
Thank
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

Reset vector
PostPosted: Thu May 27, 2004 9:15 am     Reply with quote

No, main does not start at zero. If you examine the program listing you would see where everything is located.

The processor does restart at zero and, if you look at the listings you see a jump right after that around the interrupt vectors.

It might help for you to closely read the data sheet and memory map etc.
.C



Joined: 06 May 2004
Posts: 19
Location: Italy

View user's profile Send private message

PostPosted: Thu May 27, 2004 10:17 am     Reply with quote

ok
What does the first two rows mean ?
Tahnks

-> * *
000000 3018 MOVLW 0x18
000001 008A MOVWF 0xa
000002 2800 GOTO 0
000003 0000 NOP
000004 00FF MOVWF 0x7f
000005 0E03 SWAPF 0x3, W
000006 0183 CLRF 0x3
000007 00A1 MOVWF 0x21
000008 080A MOVF 0xa, W
000009 00A0 MOVWF 0x20
00000A 018A CLRF 0xa
00000B 0804 MOVF 0x4, W
00000C 00A2 MOVWF 0x22
Ttelmah
Guest







PostPosted: Thu May 27, 2004 10:56 am     Reply with quote

.C wrote:
ok
What does the first two rows mean ?
Tahnks

-> * *
000000 3018 MOVLW 0x18
000001 008A MOVWF 0xa
000002 2800 GOTO 0
000003 0000 NOP
000004 00FF MOVWF 0x7f
000005 0E03 SWAPF 0x3, W
000006 0183 CLRF 0x3
000007 00A1 MOVWF 0x21
000008 080A MOVF 0xa, W
000009 00A0 MOVWF 0x20
00000A 018A CLRF 0xa
00000B 0804 MOVF 0x4, W
00000C 00A2 MOVWF 0x22


Recite the following mantra fifty times:
I will state what processor I am using...

The registers used, and the exact behaviour of the chip, changes with the processor. However the 'general' answer, is that it is loading '18' into the W register, and then writing this into the PCLATH register. When you execute a 'Goto', the target address, receives it's low bits from the instruction, and it's high bits from the PCLATH register. The exact mapping changes with the chips, but for the 16 family, 11bits come from the instruction, and then the next couple of bits come from bits 3 and 4 of the PCLATH register. So the Goto, gives a jump to 0b1100000000000.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group