piclist 2003\02\24\180941a >
Thread: c test code
www.piclist.com/techref/microchip/languages.htm?key=c
flavicon
face BY : Ned Konz email (remove spam text)



On Monday 24 February 2003 03:00 pm, Andre Abelian wrote:
> Hi to all engineers,
>
> I wrote simple led test code for microchip demo board2
> it works but when I move main () function to top it generates
> an error why?
> Any help will appreciate. Hitech support said I didn't
> Define port_init () function but I do not get it.

You should declare or define all functions that you're calling, before
you call them.

If you move main() to the beginning of the program (which is what I
believe you're trying to do), the compiler hasn't yet seen
port_init(), which you're calling from main().

You could do this:

void port_init(void); /* declare it */

void main(void)
{
   port_init();
   /* stuff */
}

void port_init(void) /* define it */
{
/* stuff */
}

--
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email TakeThisOuTlistservEraseMEspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body
<200302241507.27254@ned.bike-nomad.com> 7bit

In reply to: <000001c2dc58$9b84f550$79954094@xeon>
See also: www.piclist.com/techref/microchip/languages.htm?key=c
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) c test code

month overview.

new search...