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

Bootloader for PIC16 / use of write_program_memory()

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







Bootloader for PIC16 / use of write_program_memory()
PostPosted: Tue Jan 29, 2008 8:40 am     Reply with quote

Hi everybody,

I'm currently trying to write a bootloader for a PIC16F88 device.
I've got some problems in understanding the "write_program_memory" built-in function. And couldn't find no accurate information.

1 - PIC16 instructions are coded with 14 bits (roughly 6 bits for opcode & 8 bits for parameters) but the "write_program_memory" function takes as input data parameter a pointer on a BYTE array. So how have I to organize this byte array for well programming the memory?

For example :
#Byte:opcode1#Byte:parameters1#Byte:opcode2#Byte:parameters2#...
or
#Byte:parameters1#Byte:opcode1#Byte:parameters2#Byte:opcode2#...
or other?
What is the right way? Is there special rules to follow because the 2 extra bits provided by the 2 bytes (16 bits) and 14 bits difference?

2 - I saw that in the binary file generated by CCS the parameters of an opcode was written before the opcode and not after.
For example :
MOVLW FF
is coded in the binary file :
FF 30 (and not "30 FF")
Why has this way been chosen? And could that be an answer to my first question? ;-)

3 - Once I will have a well running bootloader the goal will be that neither the bootloader nor the first lines of code (used for calling the bootloader) can be erased by the bootloader itself. How can I compile the application in a special memory area? Is the #org sufficient or will the fact that there will be no code in the #0000 address trigger an error?

Thanks in advance for all your useful help and answers.

MATRO.
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