Home
Manual de Utilização do SMART PIC
Contents
1. og o E tu Es Open Checksum ELBE l set Active Project K Quickbuild no asm File M Build Versior cean Build Options Find im Project Files save Project Save Project fis amp dd Files to Project Remove File From Project K Select Language Taulsuibe Set Language Tool Locations version Control 17 Manual de Utilizacao do SMART PIC 3 1 2 Clique em Next Project Wizard Welcome This wizard helps vou create and configure a new MPLAB project To continue click Next lt Back Cancel Hep 18 Manual de Utilizacao do SMART PIC 3 1 3 Selecione o PIC correto para o seu projeto clique em Next ithe LE Se E Project Wizard Step One Select 4 device Device lt Back Nen Camel Hep 3 1 4 Clique em Next 19 Manual de Utilizacao do SMART PIC w PIPLAE IDE v5 60 7 a B x E Project Wizard Step Two Select a language toolsuite Active Toolsuite p Toalsuite Contents MPASM As sem bler mpasrnwiri exe MPLIME Object Linker mplink exe MPLIB Librarian mplib exe Location C Program Files MPLAB IDESMICHIP_T ools mpasmwin exe l E POSE Help My Suite Isn t Listed Show all installed toolsuites PICiBF873 mm E banko E uod 20 Manual de Utilizacao do SMART PIC 3 1 5 D um nome ao seu projeto s
2. Linker Scr EE fib Other File Save Project ama e utilizado para o teste de Save Project As Smart Fic Add Files to Project p Remove File From Project K deu E E K uyu su yk hukuy 3 kuku EE ee T E uuu Select Language Toolsuite Set Language Tool Locations Version Control p 1l6 873 lt list directive to define proces finclude pl amp tfS73 inc processor specific variable def errorlevel 3 z errorlevel 305 CONFIG CP OFF WDT_ OFF BODEN DN PURTE ON HE DSC 4 qr SA SOE NT A NE E RU REE NET use SO ES ONT MEM TN UE UNAS hob e reco esc eb oe ae A Se Z Declaracao das variaveis da Port ANA equ h n lt ENTRADA ANALOGICA ne k PIC16F873 Wen z dc c banko Ln20 Coll NS WR 29 Manual de Utilizacao do SMART PIC Capitulo 4 Pinagem do 16F873 A MCLRiVpp 1 PB RB7 PGD RAD ANO 7 L 2 27 RBS PGC RA1 AN1 26 RBS RA2 AN2 VREF ate RA3 AN3 VREF RA4 T0CKIw 23 4 RB2 RAS AN4 SS Vss 21L RBO INT OSC1 CLKIN 3e9 OSC2 CLKOUT 10 RCO T1OSO T1CKI we 11 18 4 RCT RX DT RCA T1OSI CCP2 4 12 17C RCG TX CK RC2 CCP1 9 13 RC3 SCK SCL 14 PIC16F876 873 ES JJ x 15L w RCA SDI SDA Pinagem do 16F84 A PDIP SOIC 17 L ae RAO aq USU TKI 15 L a OSC
3. Nota importante Quando for utilizar as entradas pelo conector DB retirar o jumper J1 Para utilizar as entradas remotas basta colocar uma chave NA normal aberta fechando GND com a entrada desejada Pin Out DB9 Entrada Anal gica RAO pino 2 do PIC 16F873 A Importante nunca coloque neste pino uma tens o maior que 5Vcc CCP capture compare pino 13 dol16F873 A Quando utilizar este pino retirar o jumper J4 e entao este pino se tornar uma entrada Importante n o se esqueca de configurar corretamente o PORT para entrada 7 4 Conector CN3 conector de sa das remotas e comunicacao serial JRBOpino22 9 2 PJ JRB4pio25 3 JRBOpinoZl JRB3pino24 RB2pim23 RB5pino26 RB pino27 Z3 16 JRB7pio28 1471819 Nep 20 21 270023 GND 24 RR Comunica o serial RS232 25 TR Comunica o serial RS232 5 RB4 pino 10 RC4 pino 15 14 Manual de Utilizacao do SMART PIC 7 5 Configuracao dos Jumpers Jumper JI Desabilita Habilita entradas digitais modo local Se J1 inserido seleciona modo local se nao CH1 CH5 seleciona modo remoto J2 Seleciona entrada anal gica local remota Se inserido fechando os pinos mais acima anal gica modo local Se inserido fechando os pinos mais abaixo anal gica modo remoto pelo conector CN2 pino 7 J3 Seleciona entrada para comunica o RS232 ou Se in
4. counter is loaded from the top of REILW 01H W e retorna the stack the return address This is a two cycle instruction Words Cycles 2 Example CALL TABLE W contains table offset value TABLE WW now has table value ADDWEPC W offset RETLYk1 Begin table RETLW k2 RETLW kn End of table Before Instruction W Ox0f After Instruction W Value 0T KB 47 RETURN Syntax Operands Operation Status Affected Encoding Description Words Cycles Example RLF Syntax Operands Operation Status Affected Encoding Description Words Cycles Example Manual de Utilizacao do SMART PIC Return from Subroutine label RETURN None TOS PC None Return from subroutine The stack is POPed and the top of the stack TOS is loaded into the program counter This is a two cycle Instructor e ra FETURH After Interrupt PC TOS Rotate Left f through Carry abel RLF fd O lt fs 127 de 0 1 see description below C The contents of register T are rotated one bit to the left through the very Flag If dis O the result is placed in the W register If d is 1 the result is stored back in reg ister T Mona ELLE a 1 1 ELF REGl 0 Before Instruction REG 1 1110 0110 E C After Instruction REG1 1110 0110 W 1100 1100 5 1 Esta Instru o usada para retorno de subrotina O endereco de retorno recuperado no STACK Ex MOVLW
5. DD NOT ACCEPT Microchip MPLAB amp IDE Cancel 1 4 Selecione o diret rio que ser instalado o MPLAB 3 MPLAB 6 60 Installation 8 x 2 MPLAB v6 60 Installation Select Destination Directory Please select the directory where the MPLAB vb EU files are to be installed C Program Filest4PLAB IDE Browse Microchip MPLAB amp IDE Cancel 1 5 Se voc desejar criar atalhos para o MPLAB selecione YES E MPLAB 6 60 Installation 8 x LN 2 MPLAB 6 60 Installation Add to Start Menu Do you want to create shortcuts to access the installed files Microchip MPLAB IDE 1 6 Caso voc deseje que o icone do MPLAB apareca no desktop selecione YES E MPLAB 6 60 Installation 8 x LN JA MPLAB v6 60 Installation F Add to Desktop Do you want to create a shortcut for MPLAB IDE and place it on the desktop Microchip MPLAB IDE 1 7 Se voc estiver pronto para instalar clique em Next caso contr rio de Back e altere as opcoes pr selecionadas E MPLAB 6 60 Installation 8 x J3 MPLAB v6 60 Installation Ready to Instali TOU are now ready to install the MPLAB v6 60 Press the Next button to begin the installation ar the Back button to reenter the installation information Microchip MPLAB IDE 1 8 Se voc tiver outras instala es do MPLAB e quiser que esta in
6. J xtras F a5 Shortcut to Compact Disc PRR k n kk k x SEER EET File name progi asm list p include pli ae as type Assembly Source Files asr as inc s Cancel Encoding ANSI errorlevel CERES errorlevel A CONFIG cpl REE ke EERE EERE EERE EEE ERE RE REE E EERE EEE ko bk b kk RE REE koe RE REE EEE ERE REESE z Declaracao das variaveis da Port A ANA ega h ENTPADA ANALOGICA lt T oomen OS hn Prive Thank n lin 1 cal 1 MS MR 26 Manual de Utilizacao do SMART PIC 3 2 3 Adicionando o programa ao seu projeto Clique com o bot o direito no mouse em SORCE FILES e depois com o bot o esquerdo clique em ADD FILES M MPLAB IDE v6 60 File Edit View Project Debugger Programmer Tools Configure window Help Oem im Checksum Ox 2bff LCDi progi asm I E nj I PEE KK KK KK bk REESE KK KK Ki KK K KK KK KK K KEE K EE EERE KXKKKKKKKKKKKZKKEKJ Linker Scripts Other Files Smart Pic Este programa utilizado para o teste de todo o Kit Smart Pic pk ke ek ek OD koe koe Rok o ke ko koe ko eo b E ko d ko ek ko kc Eo ko E ko Ek Ek ek e koe ke ke list p 1l16 873 lt list directive to define proces finclude lt p1l16 S73_ ine gt processor specific variable def errorlevel 3 z errorlevel 305 CONFIG CP OFF amp WDT OFF BODEN DN PURTE ON HE DSC 4 qu Lee ee EE URC MES ar o ue T MT RN EA Me sup eS REE oso ROY MCR R Z Declaracao das variav
7. Zero bit Z Is Set 1 1 CLEW Before Instruction W OXA After Instruction W GOO Z 1 Clear Watchdog Timer label CLRWDT None 00h WDT U WDT prescaler TO CLRWDT instruction resets the Watchdog Timer It also resets the prescaler of the WDT Status bits O and PD are set 1 1 CLRWDT Before Instruction WOT counter After Instruction WOT counter Ox ULU WOT prescaler PD 1 Esta Instru o zera o registrador W Ex Temos com exemplo antes W estava igual a 02H Antes da Instru o W 02H CLRW Depois da instru o W ficar igual a Zero e o bit Z de STATUS ficar igual a 1 Esta instru o reseta o Watch Dog Ex O registro de Watch Dog ser zerado assim como o registro do prescaler se estiver direcionado ao Watch Dog BITS TO e PD s o setados CLRWDT Ap s a instru o o registro de Watch Dog que estava contando volta a zero O e se estiver usando prescaler seu registro tamb m ser zerado Importante Se o Watch Dog estiver habilitado esta Instru o dever ser executada de tempos em tempos pelo programa para evitar o Time Out do registro do Watch Dog e conseq entemente o reset do sistema 38 Manual de Utilizacao do SMART PIC COMF Complement f Syntax abel COMF fd Esta instru o Inverte os bits de f Operands s o E Ex Todos os bits de f um a um ser o invertidos _ E O que era O ficar 1 e vice versa Operati
8. 16H move 16H para W NOP perde 1 ciclo RETURN retorna da subrotina Importante Stack total de oito n veis Esta instruc o rotaciona esquerda pelo carry O valor no registro de f rotacionado em um bit para a esquerda passando pelo carry OBS Bit afetado C Se d 1 o resultado ser salvo em f Se d 0 o resultado ser salvo em W Ex VALOR 00110011 e C 1 RLF VALOR Ap s a Instru o VALOR 01100111 e C 0 48 Manual de Utilizacao do SMART PIC RRF Rotate Right f through Carry Syntax label RRF fd Operands 1 I lt 127 0 1 Operation ee description below Status Affected C Encoding 1100 The contents of register T are rotated one bitto the right through the Carry Flag If d is 0 the result is placed in the VY register If J is 1 the result is placed back in req ister T Description E x Register f Words Cycles Example REF REts1 U Before Instruction REG1 1110 6119 D After Instruction REG 1 1110 0110 W D111 0011 E D SLEEP Syntax label SLEEP Operands None Operation 00h WDT WDT prescaler 12 TO U PD Status Affected TO PD Encoding opoo 0110 0011 Description The power down status bit PD is cleared Time out status bit TO is set Watchdog Timer and its den aler are cleared he processor is put into SLEEP mode with the oscillator stopped Words Cycles Example SLEEP Esta instru o r
9. A MPLAB IDE v6 60 File Edit view Project Debugger Programmer Tools Configure Window Help 8 x 0 Ctrl M Cri Open Close Save cras Save is En Save All Open Workspace Save Workspace Save Workspace As Close Workspace Import Export Print EIER Recent Files Recent Workspaces Exit Do icieravs Fr hekol I F 24 Manual de Utilizacao do SMART PIC 3 2 Digite aqui o seu programa A MPLAB IDE v6 60 File Edit View Project Debugger Programmer Tools Configure Window Help D m mas l Dh up E Checksum Ox 2bff Em Smartpic mce El smartpic mcp Source Files Header Files Object Files Library Files Linker Scripts HE her Files o m Untitled e digite o seu programa 25 Manual de Utilizacao do SMART PIC 3 2 2 Ap s digitar o programa selecione salvar como selecione a pasta correta e d um nome ao programa m MPLAB IDE v6 60 File Edit view Project Debugger Programmer Tools Configure Window Help Oa 2 a Checksum x2bff El smartpic mcp Source Files Header Files Object Files E Library Files Save As 3 x Linker Scripts MESS remm Other Files imi Untitled Save in Cy CD gt da f PERE k kk k koe k EEE ET E cursos e apostilas A e books Ld Z Este program programas todo o Kit Sr trabalhos escolares E Smart Pic
10. If dis 1 the result is placed in register T Words Cycles Example SWAPF REG 0 Before Instruction REG1 OAS After Instruction REGA UYA W Ox5A XORLW Exclusive OR Literal with W Syntax label xoRLW k Operands O k 255 Operation W XOR k W status Affected z Encoding Description Words Cycles Example The contents of the VY register are XOR ed with the eight bit lit eral k The result is placed in the Ww register XORLW xAF Before Instruction W xB5 After Instruction W OXTA Esta instru o troca os nibles de f O registro de f tem seus bits trocados do 7 ao 4 trocados pelos do 3 ao 0 Se d 1 o resultado ser salvo em f Se d 0 o resultado sera salvo em W Ex Temos VALOR 25H SWAPF VALOR O 52H resultar VALOR Esta instru o XOR entre o conte do de W e f Se d 1 o resultado sera salvo em f Se d 0 o resultado sera salvo em W Ex Temos VALOR 52H W 52H XORWE VALOR O resultar em W 0 92 XORWF Syntax Operands Operation Status Affected Encoding Description Words Cycles Example Manual de Utilizacao do SMART PIC Exclusive OR W with f label XORWF fd Esta instru o XOR entre o conte do de W e o 0 lt f lt 127 conte do de uma constante K d 0 1 WW XOR T dest Z 00 dfff FEEL Exclusive OR the contents of the XORLW 3AH resultar em W 97H W register with r
11. MUST read In order to install the device driver for ce2UDU you need to follow the instructions that will be displayed by executing D dinst2k htm in the explorer window that has been opened during Ehis installation Microchip MPLAB amp IDE 13 1 12 Clique em NEXT clique em NEXT 79 MPLAB 6 60 Installation 2 O EI e THEM ee FO n vYFNTCIDUIS ZUL USB Driver Installation Please read In order to install the USE device driver For MPLAB ICE 4000 vou need to follow the instructions that will be displayed by executing ezicedk htm in the explorer window that has been opened during this installation The installation Is automatic when the MPLAB ICE 4000 is connected to the USB port The instructions are for reference Microchip MPLAB amp IDE 14 1 13 Instalacao OK clique em FINISH 8 x E MPLAB 6 60 Installation installation Compieted The MPLAB v6 60 has been successtully installed fou will need to install the Hardware driver for the parallel port After this installation Explorer will be opened with HTML help to assist wou Please follow the directions provided IF vou require and can support USB vou will be prompted automatically ta install the driver when you connect your device You may follow the instructions provided from the html files that will now be digplayed provided the system supports USE windows 38 Window
12. Skip if Syntaxe label DECFSZ fd Esta instru o diminui em 1 a quantidade T ang ss armazenada em f E se f O pula a pr xima Pe oe de Di instruc o se n o executa a pr xima instruc o Operation f 1 desti skipif result lt 0 Ex Temos com exemplo antes f estava igual a 01H c ETE S s j Status Affected Mone Se d 1 o resultado ser salvo em f Encoding dfff ffff Se d 0 o resultado ser salvo em W Description The contents of register T are decremented If d is O the result Antes da instru o is placed in the W register If d is 1 the result is placed back in reg ister T f VALOR If the result is O the next instruc tion which is already fetched is _ discarded A NOP is executed VALOR 01H instead making it a two cycle Instruction decfsz VALOR I valor valor 1 Words 1 goto Mais como valor 0 pula Cycles 1 2 goto Menos executa esta instru o Example HERE DECFSZ CNT 1 _ l Soro pez Se usarmos decfsz VALOR O a opera o ser W CONTINUE VALOR 1 e o resultado ser salvo em W Before Instruction PC address HERE After Instruction CANT CNT 1 ifCNT D PG E address CONTINUE if CMT PG address HERE 1 40 Manual de Utilizacao do SMART PIC GOTO Unconditional Branch Syntax label GOTO k Operands O k 2047 Operation k PC lt 10 0 gt Status Affected Encoding Description Words Cycles Example INCF Syntax O
13. f dest Z AND the W register with register T If d is O the result is stored in the VV register If d is 1 the result is stored back in register f ANDWF FER 1 Before Instruction W Dir FSR UY L 2 After Instruction W Oxi FSR Dw02 Esta instru o efetua a opera o l gica AND E entre uma literal o valor no registrador W Vamos supor que o valor de W no momento seja OxA3 Antes da Instru o W 0xA3 ANDLW 0x5F Ap s a Instru o W 0x03 Vamos fazer a opera o em bin rio W A3 10100011 ape 01011111 AND W 03 00000011 Esta instru o efetua a opera o l gica AND E entre uma vari vel registrador f e o registrador W Se d for 0 o resultado enviado para W Se dor 1 o resultado enviado para f Vamos supor que o valor de W no momento seja 0x17 e a vari vel CONTA declarada anteriormente no programa seja OxC2 Exemplo com d 0 Antes da Instru o W 0x17 CONTA 0xC2 ANDWF CONTA 0 lt aqui est o d Ap s a Instru o W 0x02 CONTA C2 Exemplo com d 1 Antes da instru o W 0x 177 CONTA 0xC2 ADDWE CONTA 1 lt aqui est o d Ap s a Instru o W 0x17 CONTA 02 Vamos fazer a opera o em bin rio W 17 00010111 er 11000010 AND W 02 00000010 33 Manual de Utilizacao do SMART PIC BSF Bit Set f Syntax label BSF fb Operands sTts 127 zbz Operation feb Status Affected None E
14. k W None The eight bit literal k is loaded into W register The don t cares will assemble as O s MOVLW Ox5A After Instruction W OKBA Move f label MOVF fd a ES 127 de 0 1 f dest z The contents of register f are moved to a destination dependant upon the status of d If d O des tination is VV register If d 1 the destination is file register f itself d 11s useful to test a file register since status flag Z is affected MO VPE FER U After Instruction W value in FSR register Esta instru o move o conte do da constante K para W Ex Temos 16H como constante MOVLW 16H Resultar em W 16H Esta instru o move o conte do de f para o destino d Se d 1 o resultado ser salvo em f Se d 0o resultado ser salvo em W Ex Temos W 96H VALOR 16H MOVF VALOR O Resultar em W 16H 44 MOVWF Syntax Operands Operation Status Affected Encoding Description Words Cycles Example NOP Syntax Operands Operation Status Affected Encoding Description Words Cycles Example Manual de Utilizacao do SMART PIC Move W tof label MOVW f zfz12 Move data from VV register to reg ister T 1 1 MOVWF OPTION Before Instruction OPTION Che FF W Dx4F After Instruction OPTION Ox4F W Ox4F No Operation abe NOP None No operation None No operation Esta Instru o
15. move o conte do de W para f P W Ex Temos 16H em W MOVWF VALOR Resultar em VALOR 16H Esta instru o de nenhuma opera o apenas perde um ciclo de m quina Ex MOVLW 16H move 34h para W NOP perde 1 ciclo MOVF VALOR O W VALOR 45 RETFIE syntax Operands Operation Status Affected Encoding Description Words Cycles Example Manual de Utilizacao do SMART PIC Return from Interrupt label RETFIE Mone TOS gt PC gt GIE None Return from Interrupt Stack is POPed and Top of Stack TOS is loaded in the PC Interrupts are enabled by setting Global Inter rupt Enable bit GIE UINTCON lt gt This is a two cycle Instruction RETFIE After Interrupt PO TO GE 1 un Esta instruc o usada para fazer um retorno de interrupc o O endereco de retorno recuperado no STACK e o bit GIE setado Ex MOVLW 16H move 34h para W NOP perde 1 ciclo RETFIE Retorno de Interrup o 46 Manual de Utilizacao do SMART PIC RETLW Return with Literal in W Syntax label RETLW k Esta instruc o usada para retorno de subrotina com Operands O lt k lt 255 W K constante Operation k W O endere o de retorno recuperado no STACK TOS PC Status Affected None Ex Encoding S MOVLW 16H move 16H para W Description The W register is loaded with the NOP perde 1 ciclo eight bit literal k The program
16. 1 da vari vel conta esta em 0 PC address HERE After Instruction _ l if FLAG lt 1 gt 0 BTFSC pula a instru o imediatamente abaixo PG address TRUE portanto se o PORTA bit 1 pino 3 estiver em 0 o IF FLAG lt 1 gt 1 or B ou programa ir pular a instru o Goto Bot o apertado e ir diretamente para a instruc o Goto Botao_solto BTFSC pula a instru o imediatamente abaixo portanto se a vari vel CONTA bit 1 estiver em 0 o programa ir pular a instru o Goto bit 1 da vari vel conta esta em 1 e ira diretamente para a Instru o Goto bit 1 da vari vel conta esta em 0 35 BTFSS Syntax Operands Operation status Affected Encoding Description Adee gt E Words a n Cycles Example Manual de Utilizacao do SMART PIC Bit Test f Skip if Set label BTFSS fb 0 lt f lt 127 O lt b lt 7 skip if if lt b gt 1 None It bit b in register fis 1 then the next instruction is skipped If bit bois T then the next instruc tion fetched during the current instruction execution is discarded and a NOP is executed instead making this a 2 cycle instruction 1 1 2 HERE BTFSS FLAG FALSE coro PROCESS CO TRUE DE a Before Instruction o address HERE After Instruction If FLAtis lt 1 gt 0 PC address FALSE If FLAts lt 1 gt 1 PC address TRUE BTFSS Testa um Bit de um PORT ou de uma vari vel e pula a instru o imediatamente abaixo caso o bit es
17. ALL THER E Before Instruction PC Address HERE After Instruction PC Address THERE TOS Address HERE 1 CLRF Clear f Syntax label CLRF f Operands zfz127 Operation Status Affected Encoding Description Words Cycles Example OOh f 15 Z z The contents of register T are cleared and the Z bit is set i i CLEF FLAG REG Before Instruction FLAG REG Che BA After Instruction FLAG REG Fi Ox OC 1 Esta instru o efetua chamada de subrotina Ex O programa desviado para o endere o indicado e somado ao Apontador para o retorno da subrotina Call LER EEPROM supondo que esteja no endere o 19H ent o ser salvo no Apontador 20H que ser a linha de retorno da subrotina LER EEPROM Return Subrotina chamada retorno da subrotina OBS O retorno de subrotina sera estudado adiante Esta instru o zera o registro f Ex Temos um f declarado como VALOR Antes da Instru o VALOR FAH CLRF VALOR Depois da instru o VALOR ficar igual a Zero e o bit Z de STATUS ficar igual a 1 37 Manual de Utilizacao do SMART PIC CLRW Clear W Syntax label CLRW Operands None Operation 00h W l a Z Status Affected 2 Encoding Description N EI ra Words ra m Cycles Example CLRWDT Syntax Operands Operation Status Affected Encoding Description Words Cycles Example W register is cleared
18. DDLW 0x15 Ap s a instru o W 0x25 Nota a nomenclatura 0x15 indica que o valor ser fornecido em hexadecimal ou tamb m poderia ser escrito 15H Para fornecer o valor em decimal coloque um ponto na frente Exemplo 15 O valor 0x15 diferente do 15 Esta instru o adiciona soma o conte do do registrador W com o registrador f Se d for 0 o resultado enviado para W Se d for 1 o resultado enviado para f Vamos supor que o valor de W no momento seja 0x17 e a vari vel CONTA declarada anteriormente no programa seja 0xC2 Exemplo com d 0 Antes da instru o W 0x17 CONTA 0xC2 ADDWE CONTA 0 lt aqui est o d Ap s a instru o W 0xD9 CONTA C2 Exemplo com d 1 Antes da instru o W 0x17 CONTA 0xC2 ADDWF CONTA 1 lt aqui est o d Ap s a instru o W 0x17 CONTA D9 32 ANDLW Syntax Operands Operation Status Affected Encoding Description Words Cycles Example ANDWF Syntax Operands Operation Status Affected Encoding Description Words Cycles Example Manual de Utilizacao do SMART PIC And Literal with W label ANDLW k U k 255 VV LAND k W Z The contents of VV register are AND ed with the eight bit literal k The result is placed in the W reg ister 1 ANDLW OxSF Before Instruction W OKAS After Instruction W 0x03 AND W with f label ANDWF fd Osis 127 de 0 1 VV LAND
19. FF FF FF FF FF FF 0038 FF FF FF FF FF FF FF FF 0040 FF FF FF FF FF FF FF FF Hw Conectado Pronto 55 Manual de Utilizacao do SMART PIC 6 2 Ap s o programa ter sido carregado clique em Op es e em gravar o PIC ou use a tecla de atalho Arquiva Opc es Info Fi A s s 2 wl Endere o C digo fonte Configura o 2806 3FFF 3FFF 3FFF 2806 Dispositivo 0008 1303 1683 300E 009F 30FF 0085 3000 0086 PIC16F873 0010 3000 0087 F0DF 0081 1283 3081 009F 0135 Oscilador 0018 0186 0187 01M2 281C 3000 380F 0086 212A 0020 30FC 0087 213D 2027 20B3 20FC 281C 1387 0028 2134 1307 2134 1287 2134 1207 2134 1187 Prote o de c digo 0030 2134 1107 2134 1507 2134 1587 2134 1607 CP OFF 0038 Tum och A arn r rara r sane r nnn 0050 Ei a D60 Por favor aguarde us DEBUGGER Config r2 22222222 2 22222222 22222222 22222222 22222222 2 22222222 2 2292222222 2292222222 Pronto Ap s a grava o aparecer a mensagem de PIC programado com sucesso 56 Manual de Utilizacao do SMART PIC Capitulo 7 7 Conhecendo a placa Ao ligar a chave principal o LED D1 devera permanecer aceso kill kh at dba cae bad dd Eg k EIIIII 1m b diiida III AIT LIII zi jm k BBB SMART E dn isa RE u n oo N TE ES ERES Era k E Eq Bum 5 91 E EESTI pR a miim sm see ii m s Quando estiver programando o LED D8
20. Manual de Utilizacao do SMART PIC Manual do SMART PIC II ay pup S Manual de Utilizacao do SMART PIC Cap tulos Instalando o MPLAB Software de desenvolvimento de projetos Instalando o Programador SmartPic Software de grava o do PIC Abrindo um novo projeto 3 1 Abrindo um novo projeto para linguagem assembler 3 2 Criando um Novo Programa 3 3 Compilando o programa Pinagem no PIC 16F873 A e 16F84 A Conhecendo os mneum nicos do PIC Apenas 35 instru es para aprender Gravando o programa no microcontrolador PIC Conhecendo a placa 7 1 Configura o das PORTAS de entrada e sa da para o PIC 16F84 A 7 2 Configura o das PORTAS de entrada e sa da para o PIC 16F873 A 7 3 Conector CN2 conector de entradas remotas 7 4 Conector CN3 conector de sa das remotas e comunica o serial 7 5 Configura o dos Jumpers 7 6 Conex o do KIT com o computador 1 Instalando o MPLAB 1 1 Abra a CD no diret rio MPLAB e clique no arquivo MPLAB66000 EXE 8 xj E MPLAB 6 60 Installation Welcome This installation program will install the MPLAB vB BU It is preferable to run this installation program from a re boot prior to running any other applications This will ensure the minimum amount of system dlls that may be loaded into memory TOU may try to close all other applications before continuing but it iz nat guaranteed that some dlls may not already be loaded inta m
21. Operands Q lt f lt 127 f E se f O pula a pr xima instru o se n o executa de 0 1 a pr xima instru o Operation f 1 dest skip if result 0 Status Affected None RA Temos com a wu f T igual a FFH e d 1 o resultado ser salvo em f Encoding DO 1111 dfft ELE T 4e MUR See MESE Se d 0 o resultado ser salvo em W Description The contents of register T are incremented If d is 0 the result _ is placed in the W register If d is Antes da instru o 1 the result is placed back in reg ister T If the result is 0 the next instruc f VALOR tion which is already fetched is discarded A NOP Is executed V ALOR FFH Instead making ita two cycle Instruction incfsz VALOR I valor valor 1 Words 1 goto Mais como valor 0 pula iss cc PY l vycles He goto Menos executa esta instru o Example HERE INCFZZ CNT 1 aoTo LOOP CONTINUE Se usarmos decfsz VALOR O a opera o ser W VALOR 1 e o resultado ser salvo em W Before Instruction PC address HERE After Instruction CAT ONT 14 if CN T U PC E address CONTINUE if CNT Z U PG address HERE 1 42 IORLW Syntax Operands Operation Status Affected Encoding Description Words mc Cycles Example IORWF Syntax Operands Operation Status Affected Encoding Description Words Cycles Example Manual de Utilizacao do SMART PIC Inclusive OR Litera
22. ZICLKOLIT uU e c co I gt 121 RBG 10 L RES 30 Manual de Utilizacao do SMART PIC Capitulo 5 5 Conhecendo os mneum nicos do PIC Apenas 35 instru es para aprender Vamos come ar apresentando uma tabela de acesso rapido as instru es do PIC nas pr ximas p ginas iremos detalhar uma a uma Inemearnic A SLs Operands saal Affected BYTE ORIENTED FILE REGISTER OPERATIONS 2111 AFTI TITE 0101 dffrf TITE 2001 jfrrr FEFE OO01 xxx xxx LOO dfrfr EIEE OOll arrr TTIE 1511 dfrfrrf TETE L510 dffrf frre 1111 4frr rte 0100 AFIT TITE L00 dffrfI FFFE OOOO JETT TETE 0000 DxxD 000 0 1101 dfff rte 1100 AFI Frrr 2010 dffrI TIIE 1110 dffrf rrre 2110 AFITE ELLE WF d Ark Ve and T AND YY with T Gear f Clear Ve Complement f Dercremert f Decrement f Skip If Increment 1 Increment T Skip IT Indwe OR Ve with T Mova Mowe YY bo f Ha Operation Rotate Lett through Carry Rotate Right T through Carry Subtract YY fram 1 Swap nibbles In f Exclusm e OR W with T d L K 2 m oO C TT eua a emt s ou um Rome mM Bil Clear T EEEE ETE Bit Sat 1 EEEIEI EITE Bit Test f Skip IT Clear HETE frre Bil Test f Skip SA bert EEEE AH liea and ve AMD leal with v Call subroutine Clear Vwalthdog Timer Go k address Indushe OR lile al with Ve Mave ile ral To Wy Fertur from interrupt Return wi literal in ve RETURH Return from Subroutine SLEEP Go into standby m
23. dever estar aceso Os PICs 16F84 16F84A 16F628 devem ser conectados ao ponto MIC3 Os PICs 16F873 e 16F873A devem ser conectados ao ponto MIC2 Os PICs 16F877 e 16F877A devem ser conectados ao ponto MICI NUNCA LIGUE DOIS UMA MAIS PICs SIMULTANEAMENTE Os PICs 16F84 16F877 e 16F877A apenas gravam as entradas e sa das n o funcionam com estes PICs 57 Manual de Utilizacao do SMART PIC 7 1 Configura o das PORTAS de entrada e sa da para o PIC 16F84 A PORT PINO Configura o RBO Entrada Digital BTS CH5 est no INT interrup o do 16F84 A RB2 08 Sa da Digital LED3 DII RB3 09 Sa da Digital LED2 DIO _ RB4 RB5 RB6 RB7 7 2 Configura o das PORTAS de entrada e sa da para o PIC 16F873 A PORT PINO Configura o Se voc quer enviar para o displayl o valor 2 em decimal selecione o display atrav s dos bits RBO at RB3 0001 e 06 Entrada Digital BT4 CH4 envie o valor 2 em bin rio atrav s dos bits RB4 at RB7 0010 Resumo ee 0001 seleciona display 1 0010 seleciona display 2 ee ee 1000 seleciona display 4 ae 0000 envia 0 decimal para o display seleccionado 0001 envia I decimal para o display seleccionado 0010 envia 2 decimal para o display seleccionado 001 1 envia 3 decimal para o display seleccionado e assim sucessivamente 58 Manual de Utilizacao do SMART PIC 7 3 Conector CN2 conector de entradas remotas
24. egister T If dl is 0 the result is stored in the VV register If d is 1 the result is stored back in register T 1 1 XORWF REG 1 Ex Temos W 10101101 Before Instruction REG US AE W OxBS After Instruction REG One 1A W OBS 53 Manual de Utilizacao do SMART PIC Capitulo 6 6 Ao abrir o Programador Smart PIC selecione o PIC correto para a gravac o em Dispositivo na tela principal Programador Smart PIC Arquiva Op es ZINI sss tu 2 io Endere o C digo fonte Pronto 229222222 229222222 2292222222 2292222222 2292222222 2292222222 2292222222 2292222222 Osciladar XT Frotec o de c digo CP OFF WDT v PART BODEN LvP CPD v WRT DEBUGGER Contig Ee 54 Manual de Utilizacao do SMART PIC 6 2 Abrindo um HEX para a grava o Clique em Arquivo Abrir e selecione o diret rio que contenha o arquivo que dever ser gravado no PIC Ap s isto clique em OPEN Programador Smart PIC I xl Arquivo Op es a 6 86 9818 uu 2 mal Endere o C digo fonte Configura o 3FFF 3FFF 3FFF 3FFF 3FFF 3FFF 3FFF 3FFF a Dispositivo 3FFF 3FFF 3FFF 3FFF 3FFF 3FFF 3FFF 3FFF PIC16F873 9 k D Endet File name prog HE 000a Files of type Hex Files hex Cancel 0016 j 0018 FF FF FF FF FF FF FF FF ID 0020 FF FF FF FF FF FF FF FF 0028 FF FF FF FF FF FF FF FF asss s 0030 FF FF
25. eis da Port ANA equ h n FENTEADA ANALOGICA an PTCrieFa7a pipas 21 Manual de Utilizacao do SMART PIC 3 2 4 Adicionando um programa ao projeto Selecione o arquivo e clique em Open m MPLAB IDE v5 60 File Edit View Project Debugger Programmer Tools Configure window Help DSR gt m 2 cia Bb ap Se Checksum Ox 2bff El smartpic mcp E Source Files Header Files Object Files Library Files Fd d eee dl t u Linker Scripts um ST Other Files o mer in Cx CM gt 4 Este Jcursos e apostilas todo J e books programas rar see 2 trabalhos escolares list fino Brrormng erron File name progi asm Open cor Files of type Assembly Source Files 7 asm Cancel cock Bos E Z Declaracao das variaveis ort ANA equ h n lt ENTRADA ANMAL GCICA pris o iwo EkEdc F FI hak l F WR 28 Manual de Utilizacao do SMART PIC 3 3 Compilando o programa Ap s a conclus o do programa clique em PROJECT e em BUILD ALL para compilar o programa as MPLAB IDE v5 50 C Project Wizard Nem Checksum Cos set Active Project Quickbuila no asm File EL smartpic m ER Source Fi Clean ue Build All Chrl F1i0 Object Fil Build Options E Lib Fi END FF MGR MGR MGR MG sN M M S T X M Sh ak rik KG MB sp SR B nk BG B unku B Ru s nk ry e Library REX E Find in Project Files
26. elecione a pasta e clique em Next 4 MPLAB IDE 66 B 28i xi e Project Wizard Step Three Mame your prajec Z p Project Directory r Project Name x smartpio x Cancel Help PICI amp FB873 mm z dc c Thank n jen HSS 21 Manual de Utilizacao do SMART PIC 3 1 6 Selecione um arquivo asm somente se quiser usar um j existente sen o clique em Next como no exemplo m ag t n ubl P m x lt Project Wizard Step Four Add any existing files to your project 8 faread hex AAABFEA TMP Add gt gt DISPLAY HES exemplos HEX UE INSTALL LOG Ea x e install status log Izle ese FDOXLISRS MET Polog txt PallSt tet a elo FwwL20040528 1545 E F wL20040528 1 546 v Check the box to copy the file to the project directory lt Back Nen Camel Hep 22 Manual de Utilizacao do SMART PIC 3 1 7 Clique em Finish w PIPLAB IDE v5 60 BR jejx e Project Wizard Summary Click Finish ta create the project with these parameters Project Parameters Device PICIBFSTS Toolsuite Microchip MPASM Toolsuite File CCD Ssmartpic mcp A new workspace will be created and the new project added to that workspace PIC16F873 its lp dc c banka I si 23 3 2 Criando um Novo Programa Clique em File e em New
27. emory There are system dlle that may require updating and can not be replaced if in use Press the Nest button to start the installation ou can press the Cancel button now IF you do not want to Install the MPLAB v6 60 at this time Microchip MPLAB IDE Cancel 1 2 clique em NEXT 8 x E MPLAB 6 60 Installation YOU MUST ACCEPT THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT TO RECEIVE A LICENSE FOR THE ACCOMPANYING SOFTWARE TO ACCEPT THE TERMS OF THIS LICENSE CLICK I ACCEPT OR OPEN THIS PACKAGE AND PROCEED WITH THE DOWNLOAD OR INSTALL IF YOU DO NOT ACCEPT THESE LICENSE TERMS CLICK I DO NOT ACCEPT OR D NOT OPEN THIS PACKAGE DOWNLOAD OR INSTALL THIS SOFTWARE MPLAB IDE LICENSE L ACCEPT Print t DD NOT ACCEPT Microchip MPLAB amp IDE Cancel ere 1 3 Selecione I AGREE e clique em NEXT 8 x E MPLAB 6 60 Installation YOU MUST ACCEPT THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT TO RECEIVE A LICENSE FOR THE ACCOMPANYING SOFTWARE TO ACCEPT THE TERMS OF THIS LICENSE CLICK I ACCEPT OR OPEN THIS PACE AGE AHD PROCEED WITH THE DOWNLOAD OR INSTALL IF YOU DO NOT ACCEPT THESE LICENSE TERMS CLICK I DO NOT ACCEPT OR D NOT OPEN THIS PACKAGE DOWNLOAD OR INSTALL THIS SOFTWARE MPLAB IDE LICENSE Es ACCEPT Print C
28. gando um led lt vamos supor que temos ligado um led no PORTC pino 18 RC7 vamos desligar este led Antes da Instru o PORTC 1000 0000 BSF PORTC 7 Depois da instru o PORTC 0000 0000 Exemplo resetando um bit de uma vari vel CONTA Antes da Instru o CONTA 1000 1010 Ox8A BSF CONTA 7 Depois da instru o CONTA 0000 1010 0x0A Manual de Utilizacao do SMART PIC li Ca BTFSC Testa um Bit de um PORT ou de uma Syntax abe BTFSC fb vari vel e pula a instruc o imediatamente abaixo Operands Q lt f lt 127 caso o bit esteja em O muito utilizada para testar se U lt bsf um bot o esta apertado ou n o Operation skip if f b gt O Status Affected None Exemplo testando um botao lt vamos supor que temos um botao ligado no PORTA pino 3 RAI Encoding 01 Lobb bfff ffff K EM QM pub BS HE vamos testar se o bot o esta apertado neste exemplo Description H bit b in register fis O then the bot o apertado 5v e solto 0v next Instruction is skipped IF bit b is 0 then the next instruc tion fetched during the current BTFSC PORTA instruction execution Is discarded and a NOP is executed instead Goto botao_apertado making this a 2 cycle instruction Goto bot o solto Words Cycles T Example HEREC mene REND Sie Exemplo testando um bit de uma vari vel CONTA FALSE Goto PROCESS CO TRUE DE BTFSC CONTA I i Goto bit 1 da vari vel conta esta em 1 before Instruction Goto bit
29. l with W label lIORLW k O k 255 W OR k gt W z The contents of the W register are OR ed with the eight bit literal k The result is placed in the W reg ister 1 IORLW 0x35 Before Instruction W OK9A After Instruction W BF z E 1 Inclusive OR W with f label IORWF fd U lt T lt 127 de 9 1 W OR f dest z Inclusive OR the W register with register T If d is 0 the result is placed in the W register If d is 1 the result is placed back in regis ter T 1 1 IORWF RESULT O Before Instruction RESLILT x13 W 0x91 After Instruction RESULT 0x13 W Ox 03 z 1 Esta instru o realiza a opera o OR entre o conte do de W e uma constante K Ex Temos W 96H A intru o IORLW 17H resultar em W 97H W 96H 100100110 OR 17H 00010111 10010111 Esta instru o realiza a opera o OR entre o conte do de W e o conte do de f Se d 1 o resultado ser salvo em f Se d 0 o resultado ser salvo em W Ex Temos W 96H VALOR 16H A intruc o IORLW VALOR resultar em W 9EH W 96H 100100110 OR 18H 00011000 10011110 43 MOVLW Syntax Operands Operation Status Affected Encoding Description Words Cycles Example MOVF Syntax Operands Operation Status Affected Encoding Description Words Cycles Example Manual de Utilizacao do SMART PIC Move Literal to W label MOVLW k O k 255
30. ncoding Description Bit b in register T is set Words Cycles 1 Example BEF FLAG REG 7 Before Instruction FLAG REG Ox0A After Instruction FLAG REG OxBA BCF Bit Clear f Syntax label BCF fb Operands zfz127 U lt b gt Operation U f b gt Status Affected None Encoding 01 Description Bit bin register f is cleared Words Cycles 1 Example BCF FLAG REG 7 Before Instruction LAG REG xC f After Instruction FLAG REG 0x47 Esta instru o uma das mais importantes pois ela pode atuar diretamente nos PORTS no PIC portanto ela pode ligar ou desligar algo que esteja ligado no pino do PIC Esta instruc o pode ainda atuar em uma vari vel declarada anteriormente no programa CONTA supondo CONTA 0x08 Exemplo ligando um led lt vamos supor que temos ligado um led no PORTC pino 18 RC7 vamos ligar este led Antes da Instru o PORTC 0000 0000 BSF PORTC 7 Depois da instruc o POR TC 1000 0000 Exemplo setando um bit de uma vari vel CONTA Antes da Instru o CONTA 0000 1010 0x0A BSF CONTA 7 Depois da instru o CONTA 1000 1010 Ox8A Esta instru o faz exatamente o oposto da Instru o anterior muito importante tamb m pois ela pode atuar diretamente nos PORTS no PIC portanto ela pode ligar ou desligar algo que esteja ligado no pino do PIC Esta instru o pode ainda atuar em uma vari vel declarada anteriormente no programa CONTA supondo CONTA 0x08 Exemplo desli
31. ode SUBLW 1 5ublract W Tram tteral XORUN k Exclustee OR Ibaral with WW L11x KEKE Lood KKKK KER KEKE 2200 2100 L KE KEKE LO D EEKE O Cock K KKK oon 1001 Dl EKEK aon Do 1000 nonu 0011 110x KEKR LOLO KEKE ORLY MOVES RETFIE RETL A k i b Fj Fl BJ Lh ho Pol hk MJ Bh ek 31 Manual de Utilizacao do SMART PIC ADDLW Add Literal and W Syntax label ADDLVV k Operands zkz255 Operation W k W Status Affected C DG Z Description Words Cycles Example ADDWF Syntax Operands Operation Status Affected Encoding Description AA Words Fh ara Cycles Example The contents of the W register are added to the eight bit literal k and the result is placed in the WW regis ter ADDLW 0X15 Before Instruction W 0x10 After Instruction W UX 25 Add W and f abe ADDVVF fd O lt f lt 127 de 0 1 VV ID dest C DG Z Add the contents of the VV register with register T If dis 0 the result is stored in the W register If dis 1 the result is stored back in reg Ister T ADDWF FSR Before Instruction W Oxi FSR Ox After Instruction W Ox Do FSR OGZ Esta instru o adiciona soma uma literal ao registrador W o valor em W antes da instru o perdido pois o resultado sobrescrito em W Vamos supor que o valor de W no momento seja 0x10 Exemplo Antes da instru o W 0x10 A
32. on f desti CLRWDT Status Affected Z Encoding Ap s a instru o o registro de Watch Dog que Description The contents of register T are estava contando volta a zero 0 e se estiver usando complemented If d is O the prescaler seu registro tamb m ser zerado result is stored in VV fd is 1 the result is stored back in register f Importante Se o Watch Dog estiver habilitado esta Words instruc o dever ser executada de tempos em tempos Cycles pelo programa para evitar o Time Out do registro Example OMF REGl 0 do Watch Dog e conseq entemente o reset do Before Instruction sirem REG1 0x13 After Instruction REG 13 W OxEC DECF Decrement f Syntax label DECF fd Esta instru o diminui em 1 a quantidade Operands O lt f lt 127 armazenada em f de 0 1 Operation f 1 dest Ex Temos com exemplo antes f estava 1gual a 04H Se d 1 o resultado ser salvo em f Se d 0 o resultado ser salvo em W Status Affected Encoding Z oo11 atte errr Description Decrement register T If d is 0 the result is stored in the W regis ter If dis 1 the result is stored Antes da Instru o back in register T f VALOR Words i ee VALOR 04H Cycles Example DECF CNT 1 deet VALOR 1 Before Instruction C Oxo a RO a 2 S S o Depois da Instru ao f ficara igual a 03H After Instruction CAT ox o0 z 39 Manual de Utilizacao do SMART PIC DECFSZ Decrement f
33. otaciona direita pelo carry O valor no registro de f rotacionado em um bit para a direita passando pelo carry OBS Bit afetado C Se d 1 o resultado ser salvo em f Se d O o resultado ser salvo em W EX VALOR 001 10011 e C 1 RLF VALOR Ap s a Instru o VALOR 10011001 e C 1 Esta instruc o SLEEP o oscilador para e o Watch Dog e o Prescaler sao zerados Ex SLEEP Esta instru o muito utilizada quando se necessita de baixo consumo do sistema pois nessa condi o o micro consume na ordem de micro amp res 49 Manual de Utilizacao do SMART PIC SUBLW Subtract W from Literal Syntax label SUBLW k Esta instruc o utilizada quando se deseja Subtrair Operands O lt k 255 W de uma constante K s ER yazan ae A W K W Operation k W W status G DC Z I Affected Registros afetados C DC Z Encoding kkkk kkkk Ex 1 Description The W register is subtracted 2 s Temos W 1H complement method from the eight u bit literal k The result is placed In SUBLW 2H resultar W 2 1 1 C 1 the W register Ex 2 Words 1 Temos W 23H eee SUBLW 2H resultar W 2 3 C 0 bat NY Le i Example 1 SUBLW nx02 Before Instruction W E 7 After Instruction W 1 C JT result is positive Example 2 Before Instruction W 2 C F After Instruction W C 1 result is zero Example 3 Before Instruction GS o q After Instruction W OFF GC U
34. perands Operation Status Affected Encoding Description Words Cycles Example PCLATH lt 4 3 gt PCG lt 12 11 gt None GOTO is an unconditional branch The eleven bit immediate value is loaded into PC bits 10 0 The upper bits of PC are loaded fram PCLATH lt 4 3 gt GOTO Is a two cycle instruction 1 2 GOTO THERE After Instruction Address THERE Increment f label IMCF fd O lt f lt 127 de 0 1 1 idest Fa The contents of register T are incremented If d is O the result Is placed in the VV register If d is 1 the result is placed back in reg Ister T 1 1 INCF CNT Before Instruction OXFF z U After Instruction CNT Che UU z 1 Esta instru o desvia para o endere o K Este um desvio incondicional indicado por K ou seja n o depende de nenhuma condi o Ex Temos o trecho de programa abaixo Inicio MOVLW 10H move 10h para W Limpa desvia para Limpa limpa W Inicio desvia para Inicio Esta instru o soma 1 a quantidade armazenada em f Ex fP Cf 1 Temos com exemplo antes f estava igual a 04H Se d 1 o resultado ser salvo em f Se d 0 o resultado ser salvo em W Antes da Instru o f VALOR VALOR 04H INCF VALOR 1 Depois da instru o f ficar igual a 05H 41 Manual de Utilizacao do SMART PIC INCFSZ Increment f Skip if Syntax label INCFSZ fd Esta instru o soma 1 a quantidade armazenada em
35. result is nega tive 50 Manual de Utilizacao do SMART PIC SUBWE Subtract W from f Syntax abel SUBWF fd Esta instru o utilizada quando se deseja Subtrair Operands sfz127 W de um regitro f de 0 1 W f W Operation fi W dest E M stahis C DC Z egistros aletados C sis Affected Ex 1 Encoding 0010 df ff fff soga os Lon wr ee Temos W 1H e VALOR 0 Description subtract 2 s complement method W SUBWF VALOR 1 gt pana Wet lt i register from register T If d is 0 the i result is stored in the VV register If d C 0 is 1 the result is stored back in regis ter T Ex 2 Words Temos W 0H e VALOR FFH Cycles 1 SUBWF VALOR I resultar W ff 0 ff Example 1 SUBWF REG1 1 C 1 Before Instruction REG1 3 W 9 F After Instruction REG1 1 W 2 C 1 result is positive Example 2 Before Instruction REG1 Z W 2 After Instruction REGI U W d results zero Example 3 Before Instruction REG 1 W 2 After Instruction REC Chg FF W 2 C resulis negative 51 SWAPF Syntax Operands Operation Status Affected Manual de Utilizacao do SMART PIC Swap Nibbles in f srt SWAPF fa He 127 0 1 mta dest lt 7 4 gt Fe7 4 gt dest 3 07 None Encoding d ff EEEF Description The upper and lower nibbles of register f are exchanged If d is 0 the result is placed in W regis ter
36. s ME Windows 2000 and Windows sP Press the Finish button to exit this installation Microchip MPLAB IDE Cancel 15 Manual de Utilizacao do SMART PIC 2 Instalando o Programador SmartPic software de grava o do PIC Copie todos os arquivos do CD no diret rio ProgramadorSmartPic para seu hard disk deve ter 4 arquivos Se voc n o visualizar o arquivos mude as op es de visualiza o dos arquivos do EXPLORER D duplo clique no arquivo Programadorsmartpic exe deve aparecer a imagem abaixo N o esque a de selecionar o dispositivo coerente Smart PIC Programmer a x Arquivo Op es Ajuda Suaj e e e ml 2 a Endere o C digo fonte Configura o Dispositivo FICTEF8 3 Osciladar Prote o de c digo CP OFF WDT Iv PWwRT BODEN LvP CPD I WRT DEBUGGER Config 3F31 2222222322 2222222322 2222222322 2292222222 2292222222 2292222222 2292222222 2292222222 Pronto Manual de Utilizacao do SMART PIC Capitulo 3 3 1 Abrindo um novo projeto para linguagem assembler Copie o arquivo comp_ass asm para o diret rio onde foi instalado o MPLAB Caso voc instalou no diret rio recomando c arquivos de programas MPLAB 3 1 1 Rode o programa MPLAB clique no Project e sem seguida em New Project MPLAB IDE v5 50 File Edit view Project Debugger Programmer Tools Configure Window Help
37. serido mais a direita seleciona entrada sa da digital para comunica o serial RC7 pino 18 PIC 16F873 A Se inserido mais esquerda seleciona sa da digital J4 Seleciona entrada capture compare Se inserido sa da digital sen o seleciona como entrada para Capture Compare conector CN2 pino 8 5 J Desligar ligar o display 7 segmentos Se inserido liga o display 7 segmentos senao o mant m desligado Importante Sempre que for utilizar as sa das que comandam o display para comutar cargas remotas retire este jumper para n o sobrecarregar o circuito 60 Manual de Utilizacao do SMART PIC 7 6 Conexao do KIT com o computador O cabo que acompanha o kit SMART PIC II deve ser conectado ao CNI e o lado DB25 deve ser conectado na porta paralela do computador figura abaixo 61
38. stala o seja a padr o clique em YES at o update de register E MPLAB 6 60 Installation 8 x Update Tool Path The MPLAB IDE install script has installed MPASM under its current installation Would you like the install script to update the default Tool path ta paint to this installation No Cancel 10 1 9 Se voc quiser ler os readme files clique em YES caso contr rio selecione NO 15 gt E MPLAB 6 60 Installation View README Files MPLAB IDE has associated README files that contains important information such as device support and known ISSUES Would you like to view these files now Yes No Please review these files Microchip MPLAB IDE Cancel 11 1 10 Clique em YES E MPLAB 6 60 Installation 8 x mu er TTT nue FO YY Iria US SUP USB Driver Installation Please read J3 MPLAB v6 60 Installation on In order to install the USB device driver for MPLAB ICDS vou need to follow the instructions that will be displayed by executing ezied htm in the explorer window that has been opened during this installation The installation i automatic when the MPLAB ICD is connected to the USB port The instructions are for reference Microchip MPLAB IDE 12 1 11 Clique em NEXT 79 MPLAB 6 60 Installation 8 x Driver Installation You
39. teja em 1 muito utilizada para testar se um bot o esta apertado ou n o Exemplo testando um botao lt vamos supor que temos um bot o ligado no PORTA pino 3 RAI vamos testar se o bot o esta apertado neste exemplo bot o apertado 5v e solto Ov BTFSS PORTA 1 Goto bot o solto Goto botao_apertado Exemplo testando um bit de uma variavel CONTA BTFSS CONTA 1 Goto bit 1 da vari vel conta esta em O Goto bit 1 da vari vel conta esta em 1 BTFSS pula a instru o imediatamente abaixo portanto se o PORTA bit 1 pino 3 estiver em 1 o programa ir pular a instru o Goto Bot o solto e ir diretamente para a Bot o apertado BTFSS pula a instru o imediatamente abaixo portanto se a vari vel CONTA bit 1 estiver em 0 o programa ir pular a instru o Goto bit 1 da vari vel conta esta em O e ira diretamente para a Instru o Goto bit 1 da vari vel conta esta em 1 instru o Goto 36 Manual de Utilizacao do SMART PIC CALL Call Subroutine Syntax abe CALL k Operands O lt k 2047 Operation PC 1 TOS Status Affected k PC lt 10 0 gt PCLATH lt 4 3 gt PC lt 12 11 gt None Encoding Description Call Subroutine First return address PC 1 is pushed onto the stack The eleven bit immedi ate address is loaded into PC bits 10 07 The upper bits of the PC are loaded fram PCLATH CALL is a two cycle instruction Words 1 Cycles 2 Example HERE C
Download Pdf Manuals
Related Search
Related Contents
BM-7700PLDVD manual.cdr Bedienungsanleitung Instructions for use Manuel d 取扱説明書<応用操作編>(PDF形式、771Kバイト) 同意して取扱説明書をダウンロード Silabario - Prof. Carlos Rodríguez Sánchez User Manual Addendum, Part 3 Manuel de l`opérateur Starter Kit:SainSmart LCD2004+Sainsmart UNO+SainSmart Sensor User Manual for wireless Copyright © All rights reserved.
Failed to retrieve file