Hello all,
I have been programming the 8051 chip using assembly for small programs and applications such as A to D converter, alarm clock, etc. In which I have learned that it is a great pain to do more complicated projects with assembly, as the number of lines of codes get larger and harder to track.
I have downloaded the uVision 4 C complier to try to replace assembly, but I'm having difficulties learning how to use it. I have had C/C++ programming before, but I must admit it has been a while since I used it.
Are there any tutorials on programming the 8051 using C?
Also, I have been trying to duplicate my counter project (counting from 0 to 99 using assembly code) with C. I have it count from 0 to 9, but I could not figure out how to do decimal adjust using C. Any idea? In assembly the code is simply DA
Thanks all, Woozie
I have this C/C++ pocket reference with definitions of syntax and examples. I could probably do this counter in just C/C++ without any problem. My biggest problem is understanding how to use C/C++ to program the micro controller to do what I wanted to do. Which I learned I needed 8051 headers, and from the way it looks, it seems like the header is a file with all the 8051 registers declared into C variables per the addresses. Hence why I tried to use ACC to do my counter calculation like I did with embedded. But since I can't use ACC directly, I wonder why it is in the header file. Something I need to do some study on.
As for classes, they can only teach so much. I have not yet taken a class where they teaches me how to program in C to interact with micro controller. Neither are books available.. Anyone knows? Any recommendations?
I tried to use ACC to do my counter calculation like I did with embedded. But since I can't use ACC directly, I wonder why it is in the header file.
For writing in-line assembly.
Jon
So what's all this, then: http://www.keil.com/books
"Neither are books available."
there are so many (too many?) of them out there.
but that's 2ndary. programming a micro controller is no different from programming a regular pc/large computer in that you need to have thought out a structure to your code (aka how are you going to have the computer solve a problem?), and then program individual pieces to actually achieve that goal.
the distinction here is that with a mcu, you are communicating with the outside world solely with their pins: you create certain patterns on those pins, across time or across multiple pins.
it is that simple - that's why embedded programmers don't make much money.