Little easy(for you) program on LPC2138 . ARM

Status
Not open for further replies.

komabra

Newbie level 1
Joined
Feb 1, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,292
Hello. I have a problem. I don't want to cheat you.I'm good at maths, physics but... agrrr... programming is my Achilles heel. I have never known how to deal with it. It's just like magic to me. I know that every forum's maxim is to try to make sth alone but i dont have any choice...

I have to make a program, but I just don't know anything how to do it.:sad:

I have to do it on microcontroller LPC2138.

So.. It figures on it, that by clicking on buttons S1...S4 there must appear a sound. I have to do it using Digital-to-analog converter (DAC).Probably by changing voltage and then there will be 4 different sunds.

I have nearly the same program that is using ' "beep"command ' ( I dont know how to say it in english. sorry). Someone said that it's nearly finished but there is needed to change some things.( only change beep to DAC )

Code:
//buczek podpiety pod p0.26
//ledy p1.16
//buttons s1:s4 p0.4..7
#include <lpc213x.h>
void beep (unsigned int del_time)
{
unsigned int i;
IOSET0= 1<<26;
for(i=0; i<del_time;i++);
IOCLR0=1<<26;
for(i=0;i<del_time; i++);
}
int main (void)
{
IODIR0=0xFFFF0000;
IODIR1=0x00FF0000;
while(1)
{
IOCLR1=0x00FF0000;
if(!(IOPIN0 & 0x00000010))
{
IOSET1=1<<16;
beep(5000);
}
if(!(IOPIN0 & 0x00000020))
{
IOSET1=1<<17;
beep(20000);
}
if(!(IOPIN0 & 0x00000040))
{
IOSET1=1<<18;
beep(30000);
}
if(!(IOPIN0 & 0x00000080))
{
IOSET1=1<<19;
beep(40000);
}
}
}

I can also pay or help with sth to someone who will help with this program because it's so important to me.. but as I said. I dont want to lie. I'm a student from Poland so i dont have much money.

Thanks
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…