





















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






















































Introduction to PIC Instruction Set Architecture Part I
There should be place for the following:
PIC Instruction Set Architecture ( Summary ) ° Machine Environment Target ° Instruction Categories Load/Store Computational W PC Registers Data
Harvard Architecture ° Data memory is separate from Program memory. ° (Intel et.al, have von Neumann integrated memory.) ° Allows data and program information to move separately and so is faster than von Neumann.
Review C Operators/operands
C Operators/operands
Assembly Operators/instructions ° How to do the following C statement? a = b + c + d - e; ° Break into multiple instructions ° To right of semicolon (;) is a comment terminated by end of the line. Applies only to current line. ° C comments have format /* comment */ , can span many lines
Assembly Operators/instructions ° Note: Unlike C (and most other HLLs), each line of assembly contains at most one instruction add a,b,c add d,e,f WRONG add a,b,c add d,e,f RIGHT
Compilation -- Summary ° C statement (5 operands, 3 operators): f = (g + h) - (i + j); ° Becomes 3 assembly instructions (6 unique operands, 3 operators): ° In general, each line of C produces many assembly instructions One reason why people program in C vs. Assembly; fewer lines of code Other reasons? (many!)
These are the 35 instructions available on some PIC processors.
A Simple First Program The goal is to do a loop 256 times **org 0x Counter db 0 clrf Counter Loop: decfsz Counter goto Loop
----** New Instructions: clrf decfsz goto
New Instructions: clrf decfsz goto
New Instructions: clrf decfsz goto
New Instructions: clrf decfsz goto Related Instructions: clrw incfsz decf incf