We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Anyone seen this one? I have a data structure in assembly (bit-mapped font) that I want to reference in C. The 'C' code looks like this:
extern code unsigned char *FONT1;
NAME FONT1 ?CO?FONT1 SEGMENT CODE PUBLIC FONT1 RSEG ?CO?FONT1 FONT1: ... END
What happens when you try this?
extern code unsigned char FONT1 [];
same problem... I've tried several different types in the 'C' code. thanks!
Is there any problem with "FONT1" being a module name, a segment name, and an address name all at the same time?
I just tried the following simple program and it works great. FONT1.A51
NAME FONT1 ?CO?FONT1 SEGMENT CODE PUBLIC FONT1 RSEG ?CO?FONT1 FONT1: DB 'K' ,'e' ,'i' ,'l' ,' ' ,'S' ,'o' ,'f' ,'t' ,'w' DB 'a' ,'r' ,'e' ,000H END
#include <reg51.h> #include <stdio.h> extern unsigned char code font1[]; void main (void) { SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */ TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */ TH1 = 221; /* TH1: reload value for 1200 baud @ 16MHz */ TR1 = 1; /* TR1: timer 1 run */ TI = 1; /* TI: set TI to send first char of UART */ while (1) { printf ("%s\n", font1); } }
Jon, The only real difference I see in what you have and what I have is the position of the "code" keyword in the 'C' extern statement. I'm not at work right now, so I can't check it out...do you think this is my problem? thanks a bunch! -alex
SO... It turns out that the issue had to do with a bad install of either or both the Keil SW and the Cygnal IDE. I reinstalled both and now its all happy. thanks, ai
The only real difference I see in what you have and what I have is the position of the "code" keyword in the 'C' extern statement. The postition of the code keyword is all important. In this case:
extern unsigned char code font1[];