Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/15/09 20:22
Read: times


 
#171637 - Learn the architecture, hardware, and instruction set
Responding to: ???'s previous message
Levente Trifonov said:
Hi Everybody,

I'm quite new in microcontrollers, and I have a bunch of basic questions.

I'm a university student, and we are learning about 8051 on Digital systems subject.

We are using AT89S52 mcu, and sadly, the education of the programming is so bad. We are using an old C-based IDE, and I'm not very good in C, but I'm using qbasic for a long time, so I started to use BASCOM for my 8052 at home.

BASCOM is not very close to QBASIC, though I'd be willing to believe a quite limited subset of QBASIC might correspond to most of the BASCOM syntax. I'm not a lover of 'C'-language for microcontrollers, and, hence, probably not as good at it as one should be, but though I'm quite old, I'm still learning ... I'd suggest, for your own benefit, that you spend some of your time improving your ability and confidence in 'C', simply because that's the direction in which the practice is moving.

Before you attempt to program anything on the 805x-series in any High-Level-Language (HLL), be it 'C' or BASIC, I'd recommend you gain considerable familiarity with the architecture and its specifics and then attempt some of the simple tasks of which there are examples on this site, in ASM. Microcontrollers gained their popularity before 'C' was popular and, while some tasks did work in BASIC, in order to exploit the features of any MCU, you must learn its assembly language instruction set and how it operates. In the 805x, what's important is that you know how the SFR's affect the operation of the on-chip peripherals, and how you use them to control those features. That's most easily understood from the ASM level, though some things are just as easy in a High-Level-Language. There are things, however, that you just simply can't do reliably in HLL, one such thing being precise timing in firmware.

I made led blinker and running light programs, but now I want more: using external signals to control the mcu.

So, I want to make basic programs,

By that, do you mean BASIC (Beginners' Algorithmic Symbolic Instruction Code) programs, or basic, meaning elementary, ones?

which should work something like this (for example): if I press a button which is connected to a port of the mcu, a led (connected to a port) lights up, when I press the button once again, it goes dark.

I wrote a program that made a led light up until I held the button pressed, but it sometimes worked, sometimes not and I don't know why.

So, I would like to know how to start writing a program which uses outer signal(s) to control program flow.

If anyone can help me, please let me know!

Thanks,

Levente Trifonov


You can help yourself a great deal by reading and thoroughly understanding the following text:

http://www.semiconductors.philips.com/acrobat/v...ARCH_1.pdf

http://www.semiconductors.philips.com/acrobat/v...UIDE_1.pdf

These refer to the most basic 805x types and are generally applicable across most 805x scions.

http://www.semiconductors.philips.com/acrobat/v...WARE_1.pdf

Good Luck!

RE



List of 26 messages in thread
TopicAuthorDate
BASCOM help            01/01/70 00:00      
   Debounced key?            01/01/70 00:00      
      problem mostly solved            01/01/70 00:00      
   Learn the architecture, hardware, and instruction set            01/01/70 00:00      
      BASIC - Acronym            01/01/70 00:00      
         depends on whom you ask, I guess            01/01/70 00:00      
            "all-purpose" isn't a new definition            01/01/70 00:00      
               What's in a name?            01/01/70 00:00      
                  Well, I never found it to be particularly "algorithmic"            01/01/70 00:00      
                     Indeed!            01/01/70 00:00      
                        Relic of the GOTO mayhem of original BASIC            01/01/70 00:00      
                           Wasn't that the order of the day back then?            01/01/70 00:00      
                              That wasn't its intent ...            01/01/70 00:00      
                                 possible to write spaghetti code in Pascal or in 'C'            01/01/70 00:00      
            From the horse's mouth!            01/01/70 00:00      
            A clear case of PCMCIA            01/01/70 00:00      
      Basics - in the "foundational" sense            01/01/70 00:00      
         Other programming languages are available            01/01/70 00:00      
         programming languages            01/01/70 00:00      
            Assembler            01/01/70 00:00      
            Focus!            01/01/70 00:00      
            How about MIDE-51?            01/01/70 00:00      
      thanks            01/01/70 00:00      
   Why is that "bad"?            01/01/70 00:00      
      That's not bad :-)            01/01/70 00:00      
         Not necessarily true            01/01/70 00:00      

Back to Subject List