This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

need help in code

hi,
my project name "adhoc sensor network for windmill conditioning monitoring and control"
so im writing code in keil.i have serial communication & ADC-LCD code where i have to merge these to programs. how do i do dis? pls help.
1) code for ADC-LCD
#include <stdio.h>
#include <LPC214x.H> /* LPC214x definitions */
#include "lcd.h"
#include "adc.h"

/**
**************************************************************************

****1111 Function Name : wait()

Description :This function suspends the tasks for specified ticks.

Input : ticks:no of ticks in multiple of 1 usec task: task to be suspended

Output : void

Note :
*******************************************************************************
*/

void wait(int count)
{ int j=0,i=0;

for(j=0;j<count;j++) { /* At 60Mhz, the below loop introduces delay of 10 us */ for(i=0;i<35;i++); }
}

/**
******************************************************************************************** Function Name : process_adc()

Description :

Input : Void

Output : Void

Note :
**********************************************************************************************
*/
void process_adc(void)
{ unsigned short adc_value = 0; unsigned char buf[16] = {0};

adc_value = adc_read(ADC0, CHANNEL_1); sprintf((char *)buf, "ADC:%d ", adc_value); lcd_putstring(LINE1, (char *)buf);

}

/**
******************************************************************************************** Function Name : main()

Description :

Input : Void

Output :

Note :
**********************************************************************************************
*/
int main (void)
{ init_adc0(); // Initialize ADC init_lcd(); // Initialize LCD lcd_clear(); // clear display

lcd_putstring(0,"LCD TEST 123"); lcd_putstring(1,"LPC2148"); wait(900000); lcd_clear(); // clear display while(1) { process_adc(); // Read ADC value and display it on first line of LCD wait(30000); }
}

2) code for SERIAL COMMUNICATION
#include <LPC214X.h>
#include "Serial.h"

void wait(int count)
{ int j=0,i=0;

for(j=0;j<count;j++) { /* At 60Mhz, the below loop introduces delay of 10 us */ for(i=0;i<35;i++); }
}

int main()
{ uart0_init(); IO0DIR|=((unsigned long)1<<31);

while(1){ uart0_puts("\n\rHello World!!!"); wait(1000); }

}

PLS MERGE THESE TWO PROGRAMS, SO THAT I CAN READ DATA FROM ADC & DISPLAY IT ON LCD AS WELL AS CN PERFORM SERIAL COMM ON HYPER TERMINAL. PLS PLS
THNAK U!!

0