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

buzzer on mcb2300

Hi,I want to test out my buzzer/sounder on the mcb2300 but do not know how to do so in uvision.I can not seem to find any sample programs either.

Does anyone have any advice??

  • Look at the "Blinky" example. It shows the code for blinking an LED. It's still a GPIO output.
    If you are using the MCB2300 eval board, look at the data sheet or schematic to see where the buzzer is connected.
    Bradford

  • Thanks,I will give that a go.It's just that I am new to programming,especially uvision so its difficult to understand what is what soemtimes.

    perhaps you can help me with another issue I am having.I have the lcd test program and i can print to my lcd fine but when I want to print a variable that is constantly changing I am having issues.For example in a loop i have a variable int x that increments each time from 0 and carries on increasing.I simply want to print this variable value as it changes to the lcd.

    I have the functions in the example program that is lcd_putchar and lcd_printf but neither just prints a number.There seems to be very little help for uvision online and the help menu in the program is very limited.

    Many Thanks for any advice

  • Chris;
    I sense that you are having some basic problems with the C language. Is this true?
    There are a number of C language constructs for outputting or formatting and output of data or strings.
    If you are new to the C language then a whole new set of suggestions arise such as online tutorials. There are some good books referenced on this website.
    But as Erik has pointed out several times on this website, learning the C language in the Embedded framework is more difficult than in the straight PC enviornment.
    Let us know more about your C lnaguage background and I sure that you will get better information from these posts.
    Bradford

  • Yes - that's my impression, too.

    The Keil manuals aren't 'C' programming tutorials - they assume that you are already competent with the language itself.
    They aren't embedded development tutorials either,

    "There are some good books referenced on this website"

    Here: http://www.keil.com/books/

    See also:
    publications.gbdirect.co.uk/.../
    www.cplusplus.com/.../
    http://c-faq.com/

    "learning the C language in the Embedded framework is more difficult than in the straight PC enviornment."

    Agreed.

  • Well yes,hence why I sad I was new to programming.I have only ever done simple visual C++ programming then some programming in mplab.I am most definately a novice in programming and have found it hard to grasp as many of my fellow students had encountered it at college however I have always sticked to physics,chemisrty maths etc and never branched off into studying electronics until university (Current studies)

    The difficult thing with programming I find is that it all differs from one system to another.For example using mplab is different to using uvision.Granted it is still or can strill be a c language however many little differences exist,even using the lcd or printf commands etc.They are only small differences however withouth adequate experience or information I do find it hard to fully engage in this learning process.Is there any good information that relates directly to writing programs in uvision.Its all very well having c info. but one that relates to uvision directly would be very helpful.

    Many Thanks

  • The difficult thing with programming I find is that it all differs from one system to another.

    Which is why you should concentrate on those things that don't differ so much, for now. You need a solid foundation to tie all that platform-specific stuff together into some meaningful overall system of knowledge. The C programming language is that foundation.

    Is there any good information that relates directly to writing programs in uvision.

    No --- because you don't write programs "in uVision". You use uVision as a tool, to write programs in C. Or Assembly. Or C++, even. For uVision itself, you got documentation, including a tutorial. Work through that, but do it after you've got yourself comfortable with C as programming language.

    Learning ten things at the same time usually doesn't work. Mastering a programming language, a hardware platform, and a toolset like uVision, all at the same, is doomed to fail. You really have to do it in sequence.

  • "...never branched off into studying electronics until university (Current studies)"

    So what, exactly, are your "current studies"?

    If 'C' programming is part of it then, surely, there must be a class in it?

    Or your tutors should be able to recommend a book (or books) from the library...?

  • My current studies is electronic engineering.We have had some c classes and embedded stuff.I have got mutiple books out from the library but they do not help you tackle every problem or really prepare you for the branch off of c languages.Its not a case of me being lazy,problem with my course is that it only touches on certain things,1 for example is programming.As stated many students have done some form of programming before but not me,i just wanted some help or advice.perhaps this is the wrong place for a begineer to find it.

    Thanks any way

  • Chris;
    This is a good forum for beginners in microcontroller programming with the Keil Toolset. You have been given a number of good sources to begin.

    But it's been pointed out that you are "beginning" in several different areas. First the C language is common to many areas of development and the answers for one area do not fit all areas. To learn to program in C is more difficult in the embedded area. We have suggested that you consider the PC as a better framework for learning the C language.
    Microsoft offers a set of C/C++ tools for free download. They come with good tutorials. The Visual Studio Express C++ can be used as a good C compiler.

    Second are the tools. Learning a new set of tools present a different set of problems. The "Complete User's Guide" will guide you through the Keil Toolset with examples but give you very little help on the C language.

    Third is the actual device that you have chosen as a target device. You ask how to set a bit and clear a bit to make an LED to blink. You are directed to an example for the MCB2300 board. We need to add the Data Sheet as the next reference you will need. Programming microcontrollers DEMAND that you carefully read and study the data sheet for the target device. There are so many different devices and device types that have different method of controlling the embedded peripherals that even very experienced programmers have problems when they encounter a new device type.

    There are other websites for more detailed information but each website will be directed to a limited type of information.

    For example, http://www.8052.com is an excellent website for information and tutorials on the 8051 type devices.

    The vendor website of SiLabs at http://www.sillabs.com has a great deal of information and examples on their devices.

    The UK company HiTex has an excellect website for ARM information. They have several manuals for the MCB2300 type devices in PDF format for download or you can purchase their manuals in hard copy. Check at http://www.hitex.co.uk/arm for "The Insider's Guide to the Philips ARM7-Based Microcontrollers" by Trevor Martin.

    But having said all that, you are right, this website is more directed to problems of the Keil Toolset.

    Just a couple of notes how better to get your questions answered.
    1. Direct you question to a specific problem.
    2. Note what you have tried, the results and how you attempted to debug the problem.
    3. Where possible, show code snippets and any error messages that you encounter. Try to cut and paste rather than re-type. A single typing error can mis-direct your problem. And always excuse my typing errors!
    4. Note the "pre" and "post" tags to format your code snippets so others can read your code. They are outlined at the top of this page. You will be suprised how often someone will post code that is totally un-readable. No one will waste their time attempting to read such garbled code.
    Good luck in your learning experiences.
    Bradford

  • Thanks

    Unfortunately doing electronic engineering has only really introduced me to programming.I have a basics in it but its taking this basics to a suitable level for programming microcontrollers which I do find difficult.My project has a time constraint and unfortunately I do not have time to delve into a large number of c texts.I have done so before but still found it difficult to fully grasp,I guess its just practice and some have the knack and some don't.I will continue to practice,i chose this project as it is my weak point area and I wanted to learn something new,despite what some of you may think from impressions I do work rather hard on this programming.

    If i ask any questions in the future which may seem ignorant or amateur like please do excuse me.

    Thanks

  • and that time constraint has been set such that a student keeping up with the course should be able to meet it.

    If you feel that you're going to have difficulty meeting it, then you need to discuss that with your tutor(s)/supervisor(s) now!

  • Andy

    I would appreciate if you no longer replied to my comments.Perhaps you have too much time on your hands,I do not need your opnion nor did I ask for it.I was replying to someone else's comment.

    You do not know anything about the course I am undertaking nor the background to this project therefore keep such comments to your damn self.

  • Chris,

    Here is a nice FAQ page which answers a lot of questions related to C:

    http://c-faq.com/index.html

    It is not a classic introduction, but reading through it with some knowledge can be eye opening, I think. Good luck.