Reynard 0 Posted October 25, 2007 Report Share Posted October 25, 2007 A static array only initializes (zeroes) the first 2 bytes of the array. Put the array inside a structure though and all bytes are initializes. static unsigned char myArray[4]; static struct { unsigned char myArray[4]; } myStruct; produces assemly instructions: static unsigned char myArray[4]; 0004 1283 BCF STATUS, RP0 0005 1303 BCF STATUS, RP1 0006 01A0 CLRF gbl_11_myArray 0007 01A1 CLRF gbl_11_myArray+D'1' static struct { unsigned char myArray[4]; } myStruct; 0008 01A4 CLRF gbl_11_myStruct 0009 01A5 CLRF gbl_11_myStruct+D'1' 000A 01A6 CLRF gbl_11_myStruct+D'2' 000B 01A7 CLRF gbl_11_myStruct+D'3' An array of int's does the same (only 2 bytes zeroed). Using IDE & BoostC 6.81, PIC16F873A, Windows XP Pro SP2. Cheers Reynard Quote Link to post Share on other sites
Pavel 0 Posted May 7, 2008 Report Share Posted May 7, 2008 This was fixed a while ago and fix is available in current release. Thanks for reporting. Regards, Pavel Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.