On Thu, May 26, 2011 at 00:20, Raphael Neider <rnei...@web.de> wrote: >> But I need to access a variable, defined in asm like this: >> GLOBAL disp_digits >> >> UDATA >> disp_digits res 5 >> >> >> What would be the correct way to define that variable in C? >> I tried this: >> extern unsigned char disp_digits[5]; >> main(){ >> disp_digits[0]="0"; >> disp_digits[1]="1"; >> disp_digits[2]="2"; >> disp_digits[3]="3"; >> >> But compiler complains: >> main_lcd_disp.c:37: error 47: indirections to different types assignment >> from type 'const-char [2] code' >> to type 'unsigned-char fixed' > > You try to assign a string literal ("0") to a char. You need single quotes > ('0') if you want disp_digits to hold the ASCII character '0' (or simple 0 > if you want to store the ASCII NUL, the character with the encoding value > of 0). > > > Good luck > > Raphael
Thanks, will try that, if ssh tunnel to home PC will work. I am sure I actually tried yesterday, and got different compiler complaints. But in general, is the declaration correct? If that variable would be defined in asm with only one byte, it should be more clear, but if there are 5 bytes, is "extern unsigned char disp_digits[5]" correct? I'm actually trying to get just plain 0 in there, as 0x00. originally in asm I'm doing it like this: banksel disp_digits movlw 0 movwf disp_digits movlw 1 movwf disp_digits+1 movlw 2 movwf disp_digits+2 movlw 3 movwf disp_digits+3 -- KPL ------------------------------------------------------------------------------ vRanger cuts backup time in half-while increasing security. With the market-leading solution for virtual backup and recovery, you get blazing-fast, flexible, and affordable data protection. Download your free trial now. http://p.sf.net/sfu/quest-d2dcopy1 _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user