how to use header file

given below is a code which is used for the transmission and the reception of data by motes. i have scrubbed the irrelevant part

#include<msp430.h> 

#include<stdio.h> 

#include "contiki.h" 

#include "isr_compat.h" 

#include "string.h" 




void uart0_init() 
{	


WDTCTL=WDTPW+WDTHOLD;	 //Stop Watch Dog Timer 

P3SEL |= 0x30;	 //Select UART0 Transmit and Receive 

P3DIR &= ~0x20; //Make URXD0 as input 

P3DIR |= 0x10; //make UTCD0 as output 

P3OUT |= 0x10; 
ME1 |= UTXE0 + URXE0;	 //module enable 

U0CTL = CHAR;	 //Select 8 bit transceive mode 

U0TCTL = SSEL0;	 //ACLK = UCLK 
U0RCTL |= 0x00; 
U0BR0=0x1b;	 //Baud rate register 
U0BR1=0x00; 
U0MCTL=0x24;	 //Modulation control register 
U0CTL &= ~SWRST;	

IE1 = URXIE0+UTXIE0;	 //Enable receive and transmit interrupt 


_BIS_SR(GIE); 



} 

PROCESS(uart_check,"uart-communication"... 
AUTOSTART_PROCESSES(&uart_check); 

PROCESS_THREAD(uart_check,ev,data) 
{ 
PROCESS_BEGIN(); 
uart0_init(); 
PROCESS_END(); 
} 

my main question is , is that , as you people can see above, there is a function called uart_init().
I would like to make uart_init function into a header file.

and later i would like to call the header file in the program. how should i go about on this

regards,
pacific

You can create a new header file with a new name say “NAMEOFHEADERFILE.h”

#ifndef NAMEOFHEADERFILE_H
#define NAMEOFHEADERFILE_H
void uart0_init() 
{


WDTCTL=WDTPW+WDTHOLD;    //Stop Watch Dog Timer

P3SEL |= 0x30;   //Select UART0 Transmit and Receive

P3DIR &= ~0x20; //Make URXD0 as input

P3DIR |= 0x10; //make UTCD0 as output

P3OUT |= 0x10; 
ME1 |= UTXE0 + URXE0;    //module enable

U0CTL = CHAR;    //Select 8 bit transceive mode

U0TCTL = SSEL0;  //ACLK = UCLK 
U0RCTL |= 0x00; 
U0BR0=0x1b;  //Baud rate register 
U0BR1=0x00; 
U0MCTL=0x24;     //Modulation control register 
U0CTL &= ~SWRST;

IE1 = URXIE0+UTXIE0;     //Enable receive and transmit interrupt


_BIS_SR(GIE);



}

Do not forget to include those headerfiles in the NAMEOFHEADERFILE.h file which are used in uart_init()…
Then keep the header file in the same directory and then include in main program using

#include "NAMEOFHEADERFILE.h"

Hope this helps.