I am interested in learning microcontroller. And pic10f200 instruction in assembly language caught my attention. But I don't have access to this microcontroller. But other series such as 12f, 16f and 18f are available. I want to know if I can use other series instead of 10f. Without changing the content of the training? (I am a complete beginner in this field). In the meantime, I am very grateful to anyone who answers and guides.
CodePudding user response:
Most assembly languages have a few things in common.
Physical resources instead of logical variables. In high level languages we have logical variables that have names, types, and hold values. In assembly language, we have the physical resources of the processor, namely CPU registers and memory, and instructions that can access these physical resources. It is up to the assembly programmer or the compiler to map logical variables of algorithms to the physical resources (and instructions) of the processor.
Simple control structures based on if-goto-label instead of structured statements. In high level language we have if statements, while statements, for loops, and functions. In assembly language we have unconditional branches and conditional branches. It is up to the assembly programmer (or compiler) to map the control structure of algorithms into the labels, unconditional and conditional branches of assembly language.
It would probably be best to understand the above with a simple instruction set like LC-3, which has a number of tutorials and online simulators. Other possibilities are MIPS & RISC V, which mostly keep things simple to learn.
Once you understand physical resources and control structures, you can fairly easily learn any assembly language. Different processors have different registers, different ways of doing various kinds of branches, different instructions to refer to the physical resources.
Assembly languages tend to favor usage of pointers over array references, so understanding those is also beneficial. C# has pointers if you use the unsafe subset, but C is the traditional way.
A microcontroller will offer a specific way to interact with devices more-or-less directly, while other processors will use characters for basic input & output, not too complicated either way, though helpful if you understand binary and binary operations like AND, OR, SHIFT, as these are often used in microcontroller IO — instead of character I/O like on other simple processors, microcontrollers will have pins that you will want to read for input and write for output.
And lastly, some microcontrollers have interrupt capabilities that affect the way we can program. Interrupts stop processing in mid stream to handle input and/or output. Mixing interrupt handling with more normal code requires a discipline and understanding of the concept.
As to your pic10, seems like pic12 is pretty close. Though there's no reason to use these specific processors to learn the general concepts of assembly language as there's lots of other options and simulators. You might even start with the most modern of their processors, some based on MIPS as these offer a more regular environment. Older processors bring in concepts like bank switching and other complications that just aren't necessary for learning the basics.
CodePudding user response:
The 8-bit family has four categories:
- Baseline (12-bit wide program memory) (like your PIC10)
- Mid-Range (14-bit wide program memory)
- Enhanced Mid-Range (Enhanced 14-bit wide program memory)
- High End (16-bit wide program memory)
For more information see here. All controller from one family have the same assembler instructions. Even if you want to switch between two families the differences are quite small.