Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,176 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,384 people online right now. Registration is fast and FREE... Join Now!




hi. i need help.

 
Reply to this topicStart new topic

hi. i need help., buzzer

silvermilk
29 May, 2008 - 08:22 AM
Post #1

New D.I.C Head
*

Joined: 29 May, 2008
Posts: 2

hi, i wonder if there is something wrong with this set of codes.
im doing a project and im incharge of the buzzer.

#include <p18f4520.h>
#include <pwm.h>
#include <timers.h>

#pragma config WDT = OFF


void main (void)
{
TRISB = 0;
PORTB = 0;

TRISAbits.TRISA4 = 1; // Button RA4 als Input
PORTAbits.RA4 = 0; // Button auf Null setzen


OpenPWM1(0xff); // set PWM
// set Timer2


while (1>0)
{
if(PORTAbits.RA4 == 0)
{
SetDCPWM1(90); //set_pwm_duty(90);
PORTBbits.RB3 = 1;
}
else
{
SetDCPWM1(20); //set_pwm_duty(20);
PORTBbits.RB0 = 1;
}

}
}
User is offlineProfile CardPM
+Quote Post

1lacca
RE: Hi. I Need Help.
29 May, 2008 - 08:25 AM
Post #2

code.rascal
Group Icon

Joined: 11 Aug, 2005
Posts: 3,822



Thanked: 11 times
My Contributions
Moved to C/C++.
User is offlineProfile CardPM
+Quote Post

jjsaw5
RE: Hi. I Need Help.
29 May, 2008 - 08:43 AM
Post #3

I must break you
Group Icon

Joined: 4 Jan, 2008
Posts: 1,411



Thanked: 7 times
Dream Kudos: 125
Expert In: HTML, CSS, Database,

My Contributions
how about an explaination of what your code is supposed to do and what the problem is (error messages)


And next time you start a thread READ the BIG ORANGE BOX that says "BEFORE YOU POST" located directly in your face when you make a new post, especially take note to the part that says :"Give your topic a descriptive title, NOT "Help" or "Plz Help Me" or "I'm a noob"

and number 3.....but i'll let you read that one.
User is offlineProfile CardPM
+Quote Post

polymath
RE: Hi. I Need Help.
31 May, 2008 - 08:07 AM
Post #4

D.I.C Regular
Group Icon

Joined: 4 Apr, 2008
Posts: 415



Thanked: 4 times
Dream Kudos: 500
My Contributions
Please use the code tags, it makes your code much more readable. Also, if you're doing a buzzer, couldn't you just output the \a escape (which to my rememberence makes a beep). I won't repeat what jjsaw5 has already said

User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/4/08 10:53AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month