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!!

Parents
  • hello,
    i have to write a code where i need to get the data from adc. display it on lcd as well as i have to transmit via serial communication using hyper terminal.three channels should be use in adc.n i have to display, 1) voltage 2) current 3) speed
    pls can mail me such code.pls

Reply
  • hello,
    i have to write a code where i need to get the data from adc. display it on lcd as well as i have to transmit via serial communication using hyper terminal.three channels should be use in adc.n i have to display, 1) voltage 2) current 3) speed
    pls can mail me such code.pls

Children
  • If someone mails you such code - what use would it then be that your teacher gave you this as an assignment for you to do?

    Isn't it better to just tell the teacher that you refuse to do the assignment? That would, at least, be honest.

  • hello,
    i tried my hard. its not like that am cheating on my teacher. & i just thought i will get help form your side, as this side is for technical help i guess. i have asked for small help, i have do many things further. its not assignment or anything. its my own things to do. pls its my humble request to you!!

  • its not like that am cheating on my teacher.

    Ahh, think again.
    Your teacher is on the side of knowledge and learning - you are on the side of stealing, lying and fraud. Shame on you, buzz off!

  • 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.

  • other side you ask us about any technical help and when we ask u any help, you discourage us by saying such things. i told its not any assignment its just my own work. and i showed you my code earlier only but u still do not wanted to help then fine .thanks.

  • hey ok, i will definitely try my best. sorry & thanks!!

  • No, it won't be your own work if someone else does it for you - will it?!

    If you actually want to learn 'C' programming, here are some tips for you: blog.antronics.co.uk/.../

    Learning requires you to do the study and the practice - nobody can do it for you!