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!!
There are lots of code available that emits information to an LCD. You can locate it. But you can only use it if you invest enough time to understand it.
There are lots of code available that reads from an ADC. You can locate it. But you can only use it if you invest enough time to understand it.
There are lots of code available that performs serial communication. You can locate it. But you can only use it if you invest enough time to understand it.
Only when you understand what the code does (and why) will you be able to take the code and modify it to fit your specific needs.
No one on this forum is going to write any code that fulfill your teachers specific requirements, so in the end, you have to invest time. It is meaningless to sign up for a school course if you don't agree to spend the time required for actually learning.
When simulating a program, the Keil debuger can (for a number of processors) simulate the peripherials. So it can pick up an ADC value from a debugger script, and make the simulated ADC return that value to the program running in the simulated processor.
hey ok, i will definitely try my best. sorry & thanks!!