We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi I have the following array declared at the start of my program as global: int number[] = {0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x98}; 0 1 2 3 4 5 6 7 8 9 It is for a 7 segment display to display the numbers that I need, the array is from 0-9 in that order. My code to call the array is: P2 = number[4]; so in this case it should get the 4th number being 0x99 This works fine if i replace the 4 with 0,1 or 2 but anything greater than 2 all it does is return the data for 8 (80) If anyone can work out why this is doing this please let me know Thanks
"I'm not sure how do I tell?" Project->Options for target. You really need to understand this stuff before you attempt to write code for the 8051.
"You really need to understand this stuff before you attempt to write code for the 8051." Absolutely! Standard advice: First, you need to read the uVision Getting Started guide, and work through the example projects in it. This will give you a proper introductions to the tools, how they work, and how to use them - rather than just jumping-in blindly at the deep-end! You need to read the following documents - commonly referred to as "the bible" for the 8051: Chapter 1 - 80C51 Family Architecture: http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_ARCH_1.pdf Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set: http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_PROG_GUIDE_1.pdf Chapter 3 - 80C51 Family Hardware Description: http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_HARDWARE_1.pdf Are you also a newbie to 'C' programming in general? If so, you'll also need a good 'C' textbook. Here are some other introductory & reference materials: http://www.keil.com/books/8051books.asp http://www.8052.com/books.phtml http://www.8052.com/tutorial.phtml You will need to read the Data Sheet for your particular processor, and the Manual(s) for any development boards, etc. You will need to read the Manuals for the C51 Compiler, A51 Assembler, etc, etc,...
Thanks Guys for your advice, I'm in the process in reading the "bible", I have done some C programming previously, with a standard 8051 chip, I think I'm coming across problem as I have not used this compiler before and some of the syntax is different. I'm only a student however so I'm no expert when it comes to all this. I think using the P89LPC935 is also making it a little different as previously I didn't have all the extra features that it has so I'm new when it comes to programming these features. I would say my biggest problems lie in using the correct definitions/declarations and setup code for this chip/compiler. I have a fairly logical brain which helps when it come to the actual coding. Can any of you suggest why I get the 2 problems I talked about in the article I Posted 10/19/05 5:48:28. I think these are related to my setup/declarations. Thanks Again I appreciate your support Alex
You present only a code sniplet, but the problem might be somewhere else (i.e. variable definition, missing endless loop, ect.). I recommend that you single step through the program using the simulator. Reinhard
"I have not used this compiler before and some of the syntax is different." That's exactly why you should start by reading the Getting Started Guide - the clue is in the name! Read it, and work through the example projects in it.