Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

how to use header file

$
0
0

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


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>