Keil Logo Arm Logo

need help in code

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
trupti N
Posted
12-May-2012 14:01 GMT
Toolset
ARM
New! 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!!

Read-Only
Author
Tamir Michael
Posted
12-May-2012 14:20 GMT
Toolset
ARM
New! RE: need help in code

What have you done so far? How about using proper tags to post source code?

Read-Only
Author
Andrew Neil
Posted
12-May-2012 14:55 GMT
Toolset
None
New! Over-ambitious?

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?

Read-Only
Author
Per Westermark
Posted
12-May-2012 15:31 GMT
Toolset
None
New! RE: Over-ambitious?

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.

Read-Only
Author
trupti N
Posted
16-May-2012 09:53 GMT
Toolset
None
New! help

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

Read-Only
Author
Per Westermark
Posted
16-May-2012 10:31 GMT
Toolset
None
New! RE: help

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.

Read-Only
Author
trupti N
Posted
16-May-2012 10:39 GMT
Toolset
None
New! RE: help

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

Read-Only
Author
Tamir Michael
Posted
16-May-2012 10:48 GMT
Toolset
None
New! RE: help

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!

Read-Only
Author
trupti N
Posted
16-May-2012 10:51 GMT
Toolset
None
New! RE: help

thanks!!

Read-Only
Author
trupti N
Posted
16-May-2012 10:59 GMT
Toolset
None
New! RE: help

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.

Read-Only
Author
Andrew Neil
Posted
16-May-2012 19:50 GMT
Toolset
None
New! RE: it's just my own work

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: http://blog.antronics.co.uk/2011/08/08/

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

Read-Only
Author
Per Westermark
Posted
16-May-2012 10:53 GMT
Toolset
None
New! RE: help

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.

Read-Only
Author
trupti N
Posted
16-May-2012 11:05 GMT
Toolset
None
New! RE: help

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

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.