Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About MrZebra

  • Rank
  1. Pointer addition only seems to work for inbuilt data types, not for structures. I've made a minimal test case to reproduce this, below. I guess I could get around it by casting to a char* and adding on sizeof(s), then casting back... but that's kind of annoying! The fact that "s++" works but "s+=1" doesn't definately looks like a bug! #include <system.h> struct ST { unsigned char x; }; void main(void) { struct ST *s; // Pointer to structure unsigned char *c; // Pointer to character c++; // OK s++; // OK c += 1; // OK s += 1; // error: illegal operation for operands 'unsigned
  2. Hi - a n00b here... I have a PIC18 device and I'd like to get the address of one of my C variables so I can use a pointer to it in inline assembly. I see in the manual that I can use "movlw _variable" to get the address in the W register, but to set the indirection registers I need 12 bits (8 for FSR0L, and 4 for FSR0H). "movlw _variable" just seems to me to get the lower 8 bits, how do I get the upper bits so I can set up the indirection registers properly? I made a quick test in C and looked at the disassembly instructions and it does what I was expecting it to do... two separate
  • Create New...