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()
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"
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!!
If you're stuck on just this really basic stuff, don't you think that "adhoc sensor network" is a bit over-ambitious at this stage?
Your delay loop may come and haunt you - it doesn't hurt to have a free-running timer and poll the timer for the required number of us delay.
View all questions in Keil forum