i have problem with the led blinking. I using the exmaple program given by keil using uVision3. When i run the program, the LED on the development board didnt blink, it just stay on! wat should i do?
thanks!
Vince, I hope you were not offended by this famous quote. It was meant as a compliment! By the way, for the sake of the ill-informed, "I Am Become Death, The Shatterer Of Worlds" is a quote from the Bhagavad Gita, uttered by Robert Oppenheimer 63 years ago today, on the occasion of the first nuclear weapon's test in New Mexico. It just crossed my mind.
Gita outta here! No offense taken.
But don't give Oppenheimer a Baum rap. He ensured that the good guys (aka USA) had it first.
--Cpt. Vince Foster 2nd Cannon Place Fort Marcy Park, VA
Hmm no such thing? So is there any hexa code for port 1 or 2 of the development board so that i can enable the port to send output to the LED
So is there any hexa code for port 1 or 2 of the development board so that i can enable the port to send output to the LED depends on current requirements depends on LED configuration depends on ...
Erik
"So is there any hexa code for port 1 or 2 [...]"
I somehow get the impression that the language fools you. This is not similar to a "cheat code" or "access code" that you get from someone and that allows you to activate a new feature.
Hexadecimal numbers are just a different way of writing a number. No need to use hexadecimal numbers. An 8-bit port can handle a number between 0 and 255 (8 bits represents 2^8 = 256 states).
You must know what you have connected to different pins of a port. Then you must calculate what number to write to the port to tell if a pin is input or output. And you must calculate what pins to drive high or low. And you must calculate what pins you are interested in when reading a port.
Note that your processor pins may not require any special setting to change the individual pins between input or output. But your datasheet will tell you.
And you have still not told what your PCW is?
Hell, maybe PSW (does it even exist on a C51...?)
Sorry it should be control word, not PCW. Hmm can tell me where to find the formular to calculate the whether the pin is input or output?
Yes. The formula is simple:
a*1 + b*2 + c*4 + d*8 + e*16 + f*32 + g*64 + h*128
You have eight bits. Each having a bit position, i.e. a value of 1, 2, 4, 8, 16, 32, 64 or 128. The datasheet will tell what happens if you write a one or a zero to the bit. And it will tell if the relevant port has a data direction register, or if it only supports a open-drain transistor with a weak pull-up.
Now add together the relevant bit values. You do not post and ask how to sum the money to pay at the cafeteria. No need to ask how to sum the individual bits for the I/O ports either. And you should also be able to find a huge amount of sample code that shows how to use port pins as inputs and/or outputs. How much time have you spent reading datasheets and code in the week since this thread started? You should be quite comfortable with this by now.
oo so this formula is a representation of CW right? which determine which port is input and which port is output rite? thanks alot!
i saw this digram on how control word works. Link: www.sharpmz.org/.../8255ovview.htm
It says that the bit can control which port to work. So do i need to use binary for the program or just use hexadecimal/decimal will do?
One more thing, my data sheet does not clearly tell which hexadecimal is for control work. Because without the hexadecimal for the CW, i am not able to program the port using the formula that u gave me.
wait.... the hexadecimal/name for LED is it P1_0? or is this for the port pin? if this is for the port pin, anyone know where to get control the LED light?
Please refer to the following resources. They will answer your questions fully. You really cannot expect to make progress without knowing the very based stuff.
Chapter 1 www.semiconductors.philips.com/.../80C51_FAM_ARCH_1.pdf
chapter 2 www.semiconductors.philips.com/.../80C51_FAM_PROG_GUIDE_1.pdf
chapter 3 www.semiconductors.philips.com/.../80C51_FAM_HARDWARE_1.pdf
That link refers to an 8255 chip.
You have never mentioned before that you are using an 8255 chip.
How is anyone supposed to guess what chips you might be using if you don't say?
If you want to use an 8255 chip then, in addition to studying the 8051 and how to use it, you are also going to have to spend time studying the 8255 chip and how to use it.
It seems that you haven't even mastered the basics of the 8051 yet - so you really shouldn't be messing about with the added complications of an 8255 at this point!
Again, the basics for the 8051 are in the so-called "bible":
Chapter 1 - 80C51 Family Architecture: www.nxp.com/.../80C51_FAM_ARCH_1.pdf
Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set: www.nxp.com/.../80C51_FAM_PROG_GUIDE_1.pdf
Chapter 3 - 80C51 Family Hardware Description: www.nxp.com/.../80C51_FAM_HARDWARE_1.pdf
For a tutorial on the basics of the 8051 - including how the ports work - see: www.8052.com/tutorial.phtml
There is a whole section about 8051 port IO at http://www.8052.com/faqs - in particular, see: www.8052.com/.../120176
And, of course, the book lists: http://www.keil.com/books/8051books.asp www.8052.com/books.phtml
That link refers to an 8255 chip. not for beginners (and not for advanced either, unless you are an anachronism) In the olden days the 8255 had its merits; however today all uCs outrun the 8255 and, in addition to the crummy interface, you will get timing problems.
Of course, you 'can' use a 2MHz crystal or such, but what's the point?
oo ok cause i heard from my teacher that it need to use control word to program the port whether the port should be input or output. guys thanks alot, i will go read up on the links that you have given me. realli thx alot:)