TCPmaker : Visual Tour    Exploring and Customizing the Generated Code  

The mtUserInit event

The first mtServer event we will discuss is the mtUserInit() event handler in file mtGen.c (where all the other TCPmaker event handlers are located). This routine is called only once, when your device starts up.

You can add code to this routine to initialize your software, or even your hardware if you wish.  (Microchip provides a routine called InitializeBoard() in file MainDemo.c in your project for you to initialize your hardware, but since MainDemo.c is pretty complex looking, you might want to just use mtUserInit() in mtGen.c instead.  It's up to you.)

TCPmaker does add some code of its own to mtUserInit() , to initialize all the variables it has declared for you.

 
  

12 of 21
Copyright Notice and Author Information