PIC16F684 Part 013 - Assembly Code Basics: Directives and more PIC16F684 datasheet: ww1.microchip....
Пікірлер: 3
@DerekDavis213Ай бұрын
Wouldn't writing C code be much easier, and almost as fast as assembly?
@2bit661Ай бұрын
You are correct. C language is much easier. However, C language is a higher level language. In C, there isn't always an intuitive understanding of how your programming is affecting the hardware components inside the chip. For instance, in Assembly, there is setting the timers for delay routines, setting bits in the special function registers, and manipulation of data memory locations. In C language, you can use the delay instruction to create delays, whereas in Assembly, you need to develop a delay routine using counters and possibly the internal timers. In C language, you can declare variables and the assembler automatically assigns variables to a memory location so you don't have to. In Assembly you have to designate memory locations and pay attention to the memory map (although, there is the CBlock directive). Here is another example. In C, you can create a "for loop." for (i = 1; i
@DerekDavis213Ай бұрын
@@2bit661 You make a lot of good points! Once you master assembly, you can write very fast programs in the small memory space on a $1 pic chip. Back in the days of Commodore 64 and Apple //e, game programmers had to use assembly language to make a fast complex game in a small memory space.