You are right Martin. Thank you, sorry I am a fool. -----Original Message----- From: Martin Peach To: PICLIST@MITVMA.MIT.EDU Date: mi=E9rcoles 12 de diciembre de 2001 22:37 Subject: Re: [PIC]: Memory bank >----- Original Message ----- >From: "Carlos Ojea" >To: >Sent: Wednesday, December 12, 2001 1:24 PM >Subject: [PIC]: Memory bank > > >> Hello : >> I have this piece of code written in C for the mcc18 : >> >> char buffer [150]; >> char i; >> for (i=3D0; i> >> I compile it in mplab for the pic 18c252 and using mplab-ice I found t= hat >> 'buffer' starts at >> the data memory location : 0x100. >> Then I discovered this strange behavior: >> The code starts writing a 0x00 at the data memory location 0x100, (all OK) >> but when it >> reaches the data memory location 0x17F it continues writing at the dat= a >> memory location >> 0x080 !!!. >> It must continue at 0x180 but it does at 0x080, anyone know why? >> Is it because of memory banks ? > >No it's probably because i is a char and char only holds numbers from -1= 28 >to 127, or 0x80 to 0x7f in two's complement representation, which is wha= t >you get if you don't declare i as unsigned. So you need to declare i as >short or int or something with enough capacity. >/\/\/\/*=3DMartin > >-- >http://www.piclist.com hint: To leave the PICList >mailto:piclist-unsubscribe-request@mitvma.mit.edu > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads