Training program: Mechanic - electrotechnician Program name: Digital processing - microprocessors III. class Microcontrollers Elaborated by: Vlastimil Vlček Projekt Anglicky v odborných předmětech, CZ.1.07/1.3.09/ je spolufinancován Evropským sociálním fondem a státním rozpočtem České republiky.
Numeral systems DecimalHexadecimalBinary A B C D E F
Use of numeral systems, rules of notation NoteType of the numeral systemSyntax of the notationExample 1.Binaryb’binary number’b’ ’ B’ ’ 2.Decimald’decimal number’.decimal number d’100’ D’100’ Hexadecimalh’hexadecimal number’ 0xhexadecimal number h’9F’ H’9F’ 0x9F 4.OctalO’octal number’O’777’ o’777’ 5.ASCIIA’character’ ‘character’ A’C’ a’C’ ‘C’ Binary system: work with the ports and SFRs Decimal system: counters, arithmetic Hexadecimal system: memory addressing ASCII set: work with the text strings Octal system: exceptionally (electric musical instruments)
The PIC16F833A instruction set The instruction set contains 33 instructions divided into the groups: Byte-oriented instructions Bit-oriented instructions Control instructions Work with the constants Examples of simple instructions: NOP Syntax:NOP Description: No Operation Example:NOP MOVWF Syntax:MOVWF f Description:Transfers data from the w register to the f register This instruction transfers data from the W working register to the register labelled (in the instruction) with the f symbol. For this symbol, we can then substitute any existing register or user variable which we created in the data memory area before. Examples:MOVWF PORTA MOVWF COUNTER MOVWF MY_CAT_LIZ
The PIC16F833A instruction set - continuation MOVLW Syntax:MOVLW,k Description: The k constant is inserted in the W working register. Example: MOVLW.110 GOTO Syntax:GOTOaddress Description: Program run control is transferred to the address in the program memory which is stated in the command parameter (0x2C, table). This is so-called unconditional jump – it is carried out in any case. Example:GOTO0x2C GOTOtable INCF Syntax:INCF f,d Description: The contents of the „f“ register is increased by 1. Example: INCF counter DECF Syntax:DECF f,d Description: The contents of the „f“ register is decreased by 1. Example: DECF counter
The PIC16F833A instruction set – overview
Summary of the subject matter What numeral systems which are used in electronics do you know ? Why to use different numeral systems? When is it more suitable to use a binary system and when, on the other hand, a decimal system? What is an ASCII character?
Summary of the subject matter What is the difference between a bit-oriented instruction and a byte-oriented instruction? When to use bit-oriented instructions and when, on the other hand, byte-oriented instructions? What is the sense of using NOP instructions?
Datasheet Microchip PIC16F882/883/884/886/887 DS41291E ( References