On May 25, 2011, at 1:36 PM, KPL wrote:

> Hi,
> 
> I have tried a little bit of programming in sdcc for pic before, but
> it never went too far, so treat me as a complete beginner. I have
> studied C programming many years ago, but almost never used it, so
> everything except the very general stuff is forgotten long time ago.
> 
> So:
> I'm trying to build a small application (tachometer with 4-digit
> 7-segment LED display) on PIC14 platform, pic16f648a in particular.
> I wrote some routines in gpasm, tested them, but few parts of the task
> seem unnecessary difficult to code in asm. So, I want to write main
> program in sdcc, which would use already existing asm routines.
> These articles were helpful:
> http://www.btinternet.com/~Peter.Onion/sdcc/sdcc-intro.html
> http://burningsmell.org/pic16f628/
> 
> In asm module, few routines are defined ar global:
>    GLOBAL _DISPLAY, _DECODE
> 
> And when used in C, compiler does not complain.
> extern void _DISPLAY(void);
> extern void _DECODE(void);
> main(){
>       _DECODE();
> 
> 
> 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";     // this is a string attempting to be put in a 
> char
>       disp_digits[1]="1";
>       disp_digits[2]="2";
>       disp_digits[3]="3";
> 

        disk_digits[0] = '0';   // this is a char


> 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'
> 
> 
> Can anybody explain this, or direct me to the correct article to read?
> 
> -- 
> 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


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

Reply via email to