collapse

* Posts Recentes

O que é isto ? por SerraCabo
[12 de Abril de 2024, 14:20]


Amplificador - Rockboard HA 1 In-Ear por almamater
[11 de Abril de 2024, 20:46]


Emulador NES em ESP32 por dropes
[10 de Abril de 2024, 15:30]


Meu novo robô por josecarlos
[29 de Março de 2024, 18:30]


Bateria - Portátil por almamater
[25 de Março de 2024, 22:14]


Escolher Osciloscópio por jm_araujo
[06 de Fevereiro de 2024, 23:07]


TP4056 - Dúvida por dropes
[31 de Janeiro de 2024, 14:13]


Leitura de dados por Porta Serie por jm_araujo
[22 de Janeiro de 2024, 14:00]


Distancia Cabo por jm_araujo
[08 de Janeiro de 2024, 16:30]


Laser Engraver - Alguém tem? por almamater
[16 de Dezembro de 2023, 14:23]

Autor Tópico: bootloader para pic16f876A  (Lida 34466 vezes)

0 Membros e 1 Visitante estão a ver este tópico.

Offline jp_

  • Mini Robot
  • *
  • Mensagens: 188
Re:bootloader para pic16f876A
« Responder #15 em: 23 de Junho de 2009, 11:31 »
Olá JP

Em anexo vários .hex e bootloader para PICS, ok?

Ailton


Olá Ailton

obrigado, esses ficheiros vem com o Mcloader certo?

jp_

Offline ailtonfacanha

  • Mini Robot
  • *
  • Mensagens: 53
  • Trabalho e robótica estão juntos em minha vida.
Re:bootloader para pic16f876A
« Responder #16 em: 23 de Junho de 2009, 16:06 »
Olá JP

É isso mesmo, todos os arquivos(br) ou ficheiros(pt) acompanham o McLoader.
Eu utilizo o McLoader com vários softwares e não tenho tido problemas. ok?

Ailton

Offline jp_

  • Mini Robot
  • *
  • Mensagens: 188
Re:bootloader para pic16f876A
« Responder #17 em: 26 de Junho de 2009, 11:09 »
olá pessoal.

Gostava de saber se alguém testou o Mcloader que Ailton colocou aqui e se funcionou?

Pelo seguinte como eu até já referi aqui atrás eu estava a fazer testes para usar o mcloader com o ldmicro e estava tudo a funcionar.

Mas reparei que a versão do mcloader que o Ailton colocou aqui era mais recente e toca a trocar.

Deu qualquer coisa errado porque deixou de programar...

o erro é este:

http://picasaweb.google.pt/lh/photo/i6dXjDblaGC3mhxu8ZAnWw?feat=directlink

Bém eu já fiz de tudo:

Voltei a prog. o bootloader; programei num pic novo; troquei o max232in; troquei o cabo

serie; etc, etc

mesmo voltando a desinstalar o Microcode studio plus da Mecanique e instalei de novo

usando a versão anterior do MCloader dá  erro só varia a posição onde quer escrever.

Não sei mais o que fazer.

Alguma ideia?? :-[ :-[

obrigado

 jp_

Novos Dados


Verifiquei o seguinte:


este é o ficheiro do bootloader em asm para o pic16f876A_4Mhz que eu programei com o

ICprog:

Código: [Seleccione]
; Generated by WinDis84, (c) Nigel Goodwin 1998.

            LIST      P=16F84, F=INHX8M
            include "P16FXX.inc"
            ORG     0x0000

            NOP
            MOVLW   0x1F
            MOVWF   PCLATH
            GOTO    Label_0001
Label_0002
Label_0004
Label_0001
Label_0005
Label_0006
Label_000F
Label_0009
Label_0013
Label_0011
Label_000A
Label_000B
Label_0016
Label_0018
Label_001C
Label_001B
Label_000C
Label_000D
Label_000E
Label_0015
Label_001D
Label_0014
Label_001A
Label_0003
Label_0008
Label_0007
Label_0017
Label_0012
Label_0019
Label_0010
            ORG     0x1F00
            GOTO    Label_0002
            CLRF    0x10
            CLRF    0x18
            BSF     STATUS    , RP0
            CLRF    0x18
            BCF     STATUS    , RP0
            CLRF    0x0C
            CLRF    PCLATH
            NOP
            NOP
            NOP
            NOP
            GOTO    Label_0002
            BCF     INTCON    , GIE
            MOVLW   0x0C
            CALL    Label_0003
            MOVLW   0x30
            MOVWF   0x10
            CLRF    0x0E
            CLRF    0x0F
            BCF     0x0C      , 00
            BSF     0x10      , 00
            CLRWDT
            BTFSC   0x0C      , 00
            GOTO    Label_0004
            BTFSS   0x0C      , 05
            GOTO    Label_0005
            MOVF    0x1A      , W
            BCF     0x10      , 00
            XORLW   0xF0
            BTFSC   STATUS    , Z
            GOTO    Label_0006
            GOTO    Label_0004
            MOVLW   0xA0
            CALL    Label_0007
            CALL    Label_0008
            MOVWF   0x22
            MOVLW   0xA0
            CALL    Label_0007
            MOVF    0x22      , W
            XORLW   0xA1
            BTFSC   STATUS    , Z
            GOTO    Label_0009
            MOVF    0x22      , W
            XORLW   0xA2
            BTFSC   STATUS    , Z
            GOTO    Label_000A
            MOVF    0x22      , W
            XORLW   0xA3
            BTFSC   STATUS    , Z
            GOTO    Label_000B
            MOVF    0x22      , W
            XORLW   0xA4
            BTFSC   STATUS    , Z
            GOTO    Label_000C
            MOVF    0x22      , W
            XORLW   0xFF
            BTFSC   STATUS    , Z
            GOTO    Label_0004
            MOVF    0x22      , W
            XORLW   0xF1
            BTFSC   STATUS    , Z
            GOTO    Label_000D
            MOVF    0x22      , W
            XORLW   0xF2
            BTFSC   STATUS    , Z
            GOTO    Label_000E
            GOTO    Label_000F
            CALL    Label_0008
            MOVWF   0x23
            CALL    Label_0010
            MOVWF   0x29
            CALL    Label_0008
            MOVWF   0x24
            MOVF    0x24      , W
            XORWF   0x29      , f
            BTFSC   STATUS    , Z
            GOTO    Label_0011
            MOVF    0x23      , W
            BSF     STATUS    , RP1
            MOVWF   0x0D
            BCF     STATUS    , RP1
            MOVF    0x24      , W
            BSF     STATUS    , RP1
            MOVWF   0x0C
            BSF     STATUS    , RP0
            BCF     0x0C      , 07
            BSF     0x0C      , 02
            CALL    Label_0012
            BTFSC   0x0C      , 01
            GOTO    Label_0013
            BCF     0x0C      , 02
            BCF     STATUS    , RP0
            BCF     STATUS    , RP1
            CALL    Label_0010
            CALL    Label_0007
            GOTO    Label_000F
            CALL    Label_0008
            MOVWF   0x23
            CALL    Label_0010
            CALL    Label_0007
            GOTO    Label_000F
            CALL    Label_0014
            CALL    Label_0015
            MOVLW   0x08
            MOVWF   0x21
            MOVLW   0x2D
            MOVWF   FSR
            CALL    Label_0008
            MOVWF   INDF
            INCF    FSR       , f
            DECFSZ  0x21      , f
            GOTO    Label_0016
            MOVLW   0x2D
            MOVWF   FSR
            MOVLW   0x04
            MOVWF   0x21
            CALL    Label_0017
            BSF     STATUS    , RP1
            MOVF    INDF      , W
            MOVWF   0x0C
            INCF    FSR       , f
            MOVF    INDF      , W
            MOVWF   0x0E
            INCF    FSR       , f
            BSF     STATUS    , RP0
            BSF     0x0C      , 07
            BSF     0x0C      , 02
            CALL    Label_0012
            NOP
            NOP
            BCF     0x0C      , 02
            BCF     STATUS    , RP0
            INCF    0x0D      , f
            BCF     STATUS    , RP1
            DECFSZ  0x21      , f
            GOTO    Label_0018
            BCF     STATUS    , RP1
            MOVLW   0x04
            MOVWF   0x21
            CALL    Label_0019
            CALL    Label_001A
            INCFSZ  0x28      , f
            GOTO    Label_001B
            INCFSZ  0x27      , f
            DECFSZ  0x21      , f
            GOTO    Label_001C
            GOTO    Label_000F
            CALL    Label_0014
            CALL    Label_0015
            CALL    Label_0019
            CALL    Label_001A
            GOTO    Label_000F
            MOVLW   0x14
            CALL    Label_0007
            MOVLW   0x0F
            CALL    Label_0007
            MOVLW   0x12
            CALL    Label_0007
            GOTO    Label_000F
            CALL    Label_0008
            CALL    Label_0003
            GOTO    Label_000F
            MOVF    0x27      , W
            BTFSS   STATUS    , Z
            GOTO    Label_001D
            MOVLW   0xFC
            ADDWF   0x28      , W
            BTFSC   STATUS    , C
            GOTO    Label_001D
            MOVF    0x28      , W
            ADDLW   0x08
            MOVWF   0x28
            MOVLW   0x1F
            MOVWF   0x27
            RETURN
            CALL    Label_0008
            MOVWF   0x28
            CALL    Label_0008
            MOVWF   0x27
            RETURN
            MOVF    0x26      , W
            CALL    Label_0007
            MOVF    0x25      , W
            CALL    Label_0007
            RETURN
            BSF     STATUS    , RP0
            BCF     STATUS    , RP1
            MOVWF   0x19
            MOVLW   0xA6
            MOVWF   0x18
            BCF     STATUS    , RP0
            BSF     0x18      , 07
            BSF     0x18      , 04
            RETURN
            CLRWDT
            BTFSS   0x0C      , 05
            GOTO    Label_0008
            MOVF    0x1A      , W
            RETURN
            CLRWDT
            BTFSS   0x0C      , 04
            GOTO    Label_0007
            MOVWF   0x19
            RETURN
            MOVF    0x27      , W
            BSF     STATUS    , RP1
            MOVWF   0x0F
            BCF     STATUS    , RP1
            MOVF    0x28      , W
            BSF     STATUS    , RP1
            MOVWF   0x0D
            RETURN
            MOVLW   0x55
            MOVWF   0x0D
            MOVLW   0xAA
            MOVWF   0x0D
            BSF     0x0C      , 01
            RETURN
            CALL    Label_0017
            BSF     STATUS    , RP0
            BSF     0x0C      , 07
            BSF     0x0C      , 00
            NOP
            NOP
            BCF     STATUS    , RP0
            MOVF    0x0C      , W
            BCF     STATUS    , RP1
            MOVWF   0x26
            BSF     STATUS    , RP1
            MOVF    0x0E      , W
            BCF     STATUS    , RP1
            MOVWF   0x25
            RETURN
            MOVF    0x23      , W
            BSF     STATUS    , RP1
            MOVWF   0x0D
            BSF     STATUS    , RP0
            BCF     0x0C      , 07
            BSF     0x0C      , 00
            BCF     STATUS    , RP0
            MOVF    0x0C      , W
            BCF     STATUS    , RP1
            RETURN
 
            ORG     0x2000
            DATA    0x0F
            DATA    0x0F
            DATA    0x0F
            DATA    0x0F
 
            ORG     0x2007
            DATA    0x12
 
            ORG     0x2100
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF

            END


jp_
« Última modificação: 26 de Junho de 2009, 16:45 por jp_ »

Offline jp_

  • Mini Robot
  • *
  • Mensagens: 188
Re:bootloader para pic16f876A
« Responder #18 em: 26 de Junho de 2009, 16:25 »
Desculpem eu estar a postar outra mensagem mas, não cabia o resto na anterior:

Mas continuando:

Depois de uma tentativa falhada de programar este com o Mcloader:




Código: [Seleccione]
; Generated by WinDis84, (c) Nigel Goodwin 1998.

            LIST      P=16F84, F=INHX8M
            include "P16FXX.inc"
            ORG     0x0000

            NOP
            NOP
            NOP
            GOTO    Label_0001
            NOP
            NOP
            NOP
            NOP
Label_0001  MOVLW   0x28
            MOVWF   FSR
            MOVLW   0x58
            MOVWF   0x20
Label_0002  CLRF    INDF
            INCF    FSR       , f
            DECFSZ  0x20      , f
            GOTO    Label_0002
            MOVLW   0x10
            MOVWF   0x15
            MOVLW   0x27
            MOVWF   0x16
            MOVLW   0x00
            MOVWF   0x0E
            MOVLW   0x00
            MOVWF   0x0F
            MOVLW   0x01
            MOVWF   0x10
            MOVLW   0x0B
            MOVWF   0x17
            BSF     STATUS    , RP0
            MOVLW   0x86
            MOVWF   0x1F
            BCF     STATUS    , RP0
            BSF     STATUS    , RP0
            MOVLW   0xFF
            MOVWF   TRISA
            BCF     STATUS    , RP0
            BSF     STATUS    , RP0
            MOVLW   0x7F
            MOVWF   TRISB
            BCF     STATUS    , RP0
            BSF     STATUS    , RP0
            MOVLW   0xFF
            MOVWF   0x07
            BCF     STATUS    , RP0
Label_0003  BTFSS   0x0C      , 02
            GOTO    Label_0003
            BCF     0x0C      , 02
            CLRWDT
            BSF     0x29      , 01
            BTFSC   0x29      , 01
            BSF     0x29      , 02
            BTFSS   0x29      , 01
            BCF     0x29      , 02
            BTFSS   PORTB     , 07
            GOTO    Label_0004
            BCF     0x29      , 02
Label_0004  BTFSC   0x29      , 03
            GOTO    Label_0005
            MOVLW   0x31
            MOVWF   0x2A
            MOVLW   0x00
            MOVWF   0x2B
Label_0005  BSF     0x29      , 03
            BTFSC   0x29      , 02
            GOTO    Label_0006
            MOVLW   0x00
            SUBWF   0x2B      , W
            BTFSC   STATUS    , Z
            GOTO    Label_0007
            MOVWF   0x20
            COMF    0x20      , W
            ANDWF   0x2B      , W
            XORWF   0x20      , f
            BTFSC   0x20      , 07
            GOTO    Label_0008
            GOTO    Label_0009
Label_0007  MOVLW   0x31
            SUBWF   0x2A      , W
            BTFSS   STATUS    , C
            GOTO    Label_0008
            GOTO    Label_0009
Label_0008  INCFSZ  0x2A      , f
            GOTO    Label_000A
            INCF    0x2B      , f
Label_000A  BSF     0x29      , 02
Label_0009  GOTO    Label_000B
Label_0006  MOVLW   0x00
            MOVWF   0x2A
            MOVLW   0x00
            MOVWF   0x2B
Label_000B  BTFSS   0x29      , 02
            GOTO    Label_000C
            MOVLW   0x00
            SUBWF   0x2D      , W
            BTFSC   STATUS    , Z
            GOTO    Label_000D
            MOVWF   0x20
            COMF    0x20      , W
            ANDWF   0x2D      , W
            XORWF   0x20      , f
            BTFSC   0x20      , 07
            GOTO    Label_000E
            GOTO    Label_000F
Label_000D  MOVLW   0x31
            SUBWF   0x2C      , W
            BTFSS   STATUS    , C
            GOTO    Label_000E
            GOTO    Label_000F
Label_000E  INCFSZ  0x2C      , f
            GOTO    Label_0010
            INCF    0x2D      , f
Label_0010  BCF     0x29      , 02
Label_000F  GOTO    Label_0011
Label_000C  MOVLW   0x00
            MOVWF   0x2C
            MOVLW   0x00
            MOVWF   0x2D
Label_0011  BTFSC   0x29      , 02
            BSF     PORTB     , 07
            BTFSS   0x29      , 02
            BCF     PORTB     , 07
            CLRF    PCLATH
            GOTO    Label_0003
 
            ORG     0x2000
            DATA    0x0F
            DATA    0x0F
            DATA    0x0F
            DATA    0x0F
 
            ORG     0x2007
            DATA    0x12
 
            ORG     0x2100
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF

            END

Voltei a ler o pic e

Mas detectei que foi alterado o bootloader e não devia.

Porque será que isto está a acontecer???

Alguma ideia??

desculpa a extensão e obrigado por teres lido até aqui...


« Última modificação: 26 de Junho de 2009, 16:47 por jp_ »

Offline jp_

  • Mini Robot
  • *
  • Mensagens: 188
Re:bootloader para pic16f876A
« Responder #19 em: 26 de Junho de 2009, 16:43 »
Mas como vou levar raspanete e vou o melhore é postar o resto porque se não ninguém vai poder ajudar... :(

este foi o que eu li do pic depois da tentactiva de programar um pequeno codigo para fazer piscar o RB7

Código: [Seleccione]
; Generated by WinDis84, (c) Nigel Goodwin 1998.

            LIST      P=16F84, F=INHX8M
            include "P16FXX.inc"
            ORG     0x0000

            NOP
            MOVLW   0x1F
            MOVWF   PCLATH
            GOTO    Label_0001
Label_0003
Label_0002
Label_0005
Label_0001
Label_0006
Label_0007
Label_0010
Label_000A
Label_0014
Label_0012
Label_000B
Label_000C
Label_0017
Label_0019
Label_001D
Label_001C
Label_000D
Label_000E
Label_000F
Label_0016
Label_001E
Label_0015
Label_001B
Label_0004
Label_0009
Label_0008
Label_0018
Label_0013
Label_001A
Label_0011
            ORG     0x1F00
            GOTO    Label_0002
            CLRF    0x10
            CLRF    0x18
            BSF     STATUS    , RP0
            CLRF    0x18
            BCF     STATUS    , RP0
            CLRF    0x0C
            CLRF    PCLATH
            GOTO    Label_0003
            ORG     0x1F0C
            GOTO    Label_0002
            BCF     INTCON    , GIE
            MOVLW   0x0C
            CALL    Label_0004
            MOVLW   0x30
            MOVWF   0x10
            CLRF    0x0E
            CLRF    0x0F
            BCF     0x0C      , 00
            BSF     0x10      , 00
            CLRWDT
            BTFSC   0x0C      , 00
            GOTO    Label_0005
            BTFSS   0x0C      , 05
            GOTO    Label_0006
            MOVF    0x1A      , W
            BCF     0x10      , 00
            XORLW   0xF0
            BTFSC   STATUS    , Z
            GOTO    Label_0007
            GOTO    Label_0005
            MOVLW   0xA0
            CALL    Label_0008
            CALL    Label_0009
            MOVWF   0x22
            MOVLW   0xA0
            CALL    Label_0008
            MOVF    0x22      , W
            XORLW   0xA1
            BTFSC   STATUS    , Z
            GOTO    Label_000A
            MOVF    0x22      , W
            XORLW   0xA2
            BTFSC   STATUS    , Z
            GOTO    Label_000B
            MOVF    0x22      , W
            XORLW   0xA3
            BTFSC   STATUS    , Z
            GOTO    Label_000C
            MOVF    0x22      , W
            XORLW   0xA4
            BTFSC   STATUS    , Z
            GOTO    Label_000D
            MOVF    0x22      , W
            XORLW   0xFF
            BTFSC   STATUS    , Z
            GOTO    Label_0005
            MOVF    0x22      , W
            XORLW   0xF1
            BTFSC   STATUS    , Z
            GOTO    Label_000E
            MOVF    0x22      , W
            XORLW   0xF2
            BTFSC   STATUS    , Z
            GOTO    Label_000F
            GOTO    Label_0010
            CALL    Label_0009
            MOVWF   0x23
            CALL    Label_0011
            MOVWF   0x29
            CALL    Label_0009
            MOVWF   0x24
            MOVF    0x24      , W
            XORWF   0x29      , f
            BTFSC   STATUS    , Z
            GOTO    Label_0012
            MOVF    0x23      , W
            BSF     STATUS    , RP1
            MOVWF   0x0D
            BCF     STATUS    , RP1
            MOVF    0x24      , W
            BSF     STATUS    , RP1
            MOVWF   0x0C
            BSF     STATUS    , RP0
            BCF     0x0C      , 07
            BSF     0x0C      , 02
            CALL    Label_0013
            BTFSC   0x0C      , 01
            GOTO    Label_0014
            BCF     0x0C      , 02
            BCF     STATUS    , RP0
            BCF     STATUS    , RP1
            CALL    Label_0011
            CALL    Label_0008
            GOTO    Label_0010
            CALL    Label_0009
            MOVWF   0x23
            CALL    Label_0011
            CALL    Label_0008
            GOTO    Label_0010
            CALL    Label_0015
            CALL    Label_0016
            MOVLW   0x08
            MOVWF   0x21
            MOVLW   0x2D
            MOVWF   FSR
            CALL    Label_0009
            MOVWF   INDF
            INCF    FSR       , f
            DECFSZ  0x21      , f
            GOTO    Label_0017
            MOVLW   0x2D
            MOVWF   FSR
            MOVLW   0x04
            MOVWF   0x21
            CALL    Label_0018
            BSF     STATUS    , RP1
            MOVF    INDF      , W
            MOVWF   0x0C
            INCF    FSR       , f
            MOVF    INDF      , W
            MOVWF   0x0E
            INCF    FSR       , f
            BSF     STATUS    , RP0
            BSF     0x0C      , 07
            BSF     0x0C      , 02
            CALL    Label_0013
            NOP
            NOP
            BCF     0x0C      , 02
            BCF     STATUS    , RP0
            INCF    0x0D      , f
            BCF     STATUS    , RP1
            DECFSZ  0x21      , f
            GOTO    Label_0019
            BCF     STATUS    , RP1
            MOVLW   0x04
            MOVWF   0x21
            CALL    Label_001A
            CALL    Label_001B
            INCFSZ  0x28      , f
            GOTO    Label_001C
            INCFSZ  0x27      , f
            DECFSZ  0x21      , f
            GOTO    Label_001D
            GOTO    Label_0010
            CALL    Label_0015
            CALL    Label_0016
            CALL    Label_001A
            CALL    Label_001B
            GOTO    Label_0010
            MOVLW   0x14
            CALL    Label_0008
            MOVLW   0x0F
            CALL    Label_0008
            MOVLW   0x12
            CALL    Label_0008
            GOTO    Label_0010
            CALL    Label_0009
            CALL    Label_0004
            GOTO    Label_0010
            MOVF    0x27      , W
            BTFSS   STATUS    , Z
            GOTO    Label_001E
            MOVLW   0xFC
            ADDWF   0x28      , W
            BTFSC   STATUS    , C
            GOTO    Label_001E
            MOVF    0x28      , W
            ADDLW   0x08
            MOVWF   0x28
            MOVLW   0x1F
            MOVWF   0x27
            RETURN
            CALL    Label_0009
            MOVWF   0x28
            CALL    Label_0009
            MOVWF   0x27
            RETURN
            MOVF    0x26      , W
            CALL    Label_0008
            MOVF    0x25      , W
            CALL    Label_0008
            RETURN
            BSF     STATUS    , RP0
            BCF     STATUS    , RP1
            MOVWF   0x19
            MOVLW   0xA6
            MOVWF   0x18
            BCF     STATUS    , RP0
            BSF     0x18      , 07
            BSF     0x18      , 04
            RETURN
            CLRWDT
            BTFSS   0x0C      , 05
            GOTO    Label_0009
            MOVF    0x1A      , W
            RETURN
            CLRWDT
            BTFSS   0x0C      , 04
            GOTO    Label_0008
            MOVWF   0x19
            RETURN
            MOVF    0x27      , W
            BSF     STATUS    , RP1
            MOVWF   0x0F
            BCF     STATUS    , RP1
            MOVF    0x28      , W
            BSF     STATUS    , RP1
            MOVWF   0x0D
            RETURN
            MOVLW   0x55
            MOVWF   0x0D
            MOVLW   0xAA
            MOVWF   0x0D
            BSF     0x0C      , 01
            RETURN
            CALL    Label_0018
            BSF     STATUS    , RP0
            BSF     0x0C      , 07
            BSF     0x0C      , 00
            NOP
            NOP
            BCF     STATUS    , RP0
            MOVF    0x0C      , W
            BCF     STATUS    , RP1
            MOVWF   0x26
            BSF     STATUS    , RP1
            MOVF    0x0E      , W
            BCF     STATUS    , RP1
            MOVWF   0x25
            RETURN
            MOVF    0x23      , W
            BSF     STATUS    , RP1
            MOVWF   0x0D
            BSF     STATUS    , RP0
            BCF     0x0C      , 07
            BSF     0x0C      , 00
            BCF     STATUS    , RP0
            MOVF    0x0C      , W
            BCF     STATUS    , RP1
            RETURN
 
            ORG     0x2000
            DATA    0x0F
            DATA    0x0F
            DATA    0x0F
            DATA    0x0F
 
            ORG     0x2007
            DATA    0x12
 
            ORG     0x2100
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF
            DATA    0xFF

            END

Porque será que isto está a acontecer???

Alguma ideia??

desculpa a extensão e obrigado por teres lido até aqui...

jp_


« Última modificação: 26 de Junho de 2009, 16:48 por jp_ »

Offline ailtonfacanha

  • Mini Robot
  • *
  • Mensagens: 53
  • Trabalho e robótica estão juntos em minha vida.
Re:bootloader para pic16f876A
« Responder #20 em: 26 de Junho de 2009, 22:17 »
Olá JP

Olha coisa semelhante, mas não igual, já me  aconteceu. Depois de muitos erros e tentativas de acerto, descobri que o problema residia no software de gravação do ICPROG, isto é, pelos menos o que eu conclui. Qdo utilizei o o PicProg Development Programmer 1.0.1.5(utilizando o mesmo JDM), não tive nenhum problema. Vi no seu código uma dado estranho, assim, seu código aparece como LIST   P=16F84 é nomal esse retorno ou é bug do dissambler


Ailton

Offline Sérgio_Sena

  • Administrator
  • Mini Robot
  • *****
  • Mensagens: 1.649
    • Electronic Gear for Musicians
Re:bootloader para pic16f876A
« Responder #21 em: 27 de Junho de 2009, 12:05 »
Com esses programas que vocês estão a usar, não se dá para fazer isso, mas no MPLAB, quando se usa bootloader, dá pra dizer ao assemblador ou compilador, para reservar espaços de memória e não lhes tocar.

O que está a acontecer com esses programas é que, quando foram compilados, não lhes foi dito que a área de memória do bootloader é reservada só para este.



Offline ailtonfacanha

  • Mini Robot
  • *
  • Mensagens: 53
  • Trabalho e robótica estão juntos em minha vida.
Re:bootloader para pic16f876A
« Responder #22 em: 27 de Junho de 2009, 21:41 »
Olá Sena/JP

Sena, não entendi a tua colocação!!! Assim, onde vc viu, no programa do JP esse detalhe?

Veja, eu uso esse tipo de bootloader e  não tenho problemas. O Mcloader é utilizado com o PIC BASIC da Melabs e com o PROTON+ e funciona muito bem. O mesmo bootloader eu uso com arquivos .hex gerados pelos softwares da Mikroelektronika para PIC e o C da CCS e sem problemas...

Realmente não sei o que ocorreu no PIC do JP.

JP se vc ainda não conseguiu solucionar esse problema nos deixe avisado. Posso até te enviar um PIC16F876 gravado com o bootloader e funcionando. Me informe se na hora de vc selecionar o bootloader para o 16F876A, por acaso vc não trocou o clock ou pegou 16F876 ou alguma coisa parecida...

Aguardando tua resposta.

Ailton

Offline Sérgio_Sena

  • Administrator
  • Mini Robot
  • *****
  • Mensagens: 1.649
    • Electronic Gear for Musicians
Re:bootloader para pic16f876A
« Responder #23 em: 28 de Junho de 2009, 01:01 »
Sena, não entendi a tua colocação!!! Assim, onde vc viu, no programa do JP esse detalhe?
Ailton


Já me deparei muitas vezes com esse problema: quando o compilador não sabe que existe um bootloader já na memória do PIC, não proibe esse espaço de memória de ser usado pelo programa, e aí, na gravação, vai gravar por cima, causando destrução do bootloader e do programa.



Offline jp_

  • Mini Robot
  • *
  • Mensagens: 188
Re:bootloader para pic16f876A
« Responder #24 em: 28 de Junho de 2009, 12:35 »
Em primeiro lugar Obrigado pela disponibilidade.

Citar
JP se vc ainda não conseguiu solucionar esse problema nos deixe avisado. Posso até te enviar um PIC16F876 gravado com o bootloader e funcionando. Me informe se na hora de vc selecionar o bootloader para o 16F876A, por acaso vc não trocou o clock ou pegou 16F876 ou alguma coisa parecida...

Sobre a possibilidade de ter trocado o 16f876A_4Mhz pelo 16f876_Mhz já reflecti e não, até para ter a certeza programei em três pic o 16f876a_4Mhz.

Mas sim desconfio também do Icprog  mas até agora tenho usado para programar por ISCP com este programador

http://www.olimex.com/dev/pic-pg1.html

 e não tive problemas (é claro que até agora não tinha testado com bootloader).

bom mas detectei duas novos erros que cometi no circuito:

eu estou a usar um RS232in e resolvi usar um prog. de teste da porta serie usando o

 http://www.etc.ugal.ro/cchiculita/software/picbootloader.htm

e  programei num dos pics o programa de teste do circuito de comunicação, que envia um Big string para o terminal e como já tinha foto isto antes reparei que algo não estava bem, a comunicação nem sempre se efectuava na totalidade.

Resolvi verificar de novo o circuito rs232 e detectei que os 12 e -12 da saída do tx na verdade eram 10 -10 no rx os valores estavam

bém.

O outro erro que detectei foi um dos pic que eu estava a usar é 16LF876A.

Ainda não fui ler o Datasheet e não sei qual a diferença entre o 16LF876A e o 16f876A, mas tenho a ideia

que tem a ver com a tensão de funcionamento se for esse o caso pode ter ido à vida...

Relativamente ao Problema do Valor da  tensão do rs232 vou voltar a montar o circuito com material novo.

Volto mais logo com novidades.

Até já,

jp_





Offline msaleiro

  • Mini Robot
  • *
  • Mensagens: 691
    • Blog
Re:bootloader para pic16f876A
« Responder #25 em: 28 de Junho de 2009, 13:11 »
Quanto à diferença entre os PICxxFxxx e os PICxxLFxxx penso que é os LF não terem chumbo (Lead-Free). Supostamente o funcionamento e requisitos deveriam ser exactamente iguais. contudo li nalguns foruns que em alguns casos podem existir pequenas diferenças..
msaleiro - Mário Saleiro
UAlg FCT-DEI / VisLab - Instituto de Sistemas e Robótica / eLab Hackerspace
http://thebitbangtheory.com

Offline jp_

  • Mini Robot
  • *
  • Mensagens: 188
Re:bootloader para pic16f876A
« Responder #26 em: 28 de Junho de 2009, 20:44 »
Citar
que é os LF não terem chumbo (Lead-Free)

Essa de não terem chumbo é boa, mas continuo na de trabalhar a partir dos 3V até aos 5V e

deve de haver  qualquer coisa sobre a tensão de programação. Mas vou ler o Datasheet.

jp_


Offline ailtonfacanha

  • Mini Robot
  • *
  • Mensagens: 53
  • Trabalho e robótica estão juntos em minha vida.
Re:bootloader para pic16f876A
« Responder #27 em: 28 de Junho de 2009, 23:46 »
Olá Sena

Já me deparei muitas vezes com esse problema: quando o compilador não sabe que existe um bootloader já na memória do PIC, não proibe esse espaço de memória de ser usado pelo programa, e aí, na gravação, vai gravar por cima, causando destrução do bootloader e do programa.

Me corrija se eu estiver errado. Qdo se usa um bootloader, utiliza-se o mesmo para escrever diretamente na memória de programa do PIC sem a necessidade de se usar um programador ICSP. Assim , quem gerencia a escrita dos dados é o  próprio bootloader através dos dados enviados via serial. O bootloader é apenas  um programa residente na memória do PIC que foi gravado por um programador do tipo ICSP. Se existe um bootloader ele evita que um programa enviado sobreescreva na sua área.

Outra coisa, a maioria dos programadores, antes de gravar um novo arquivo.hex, apaga inicialmente o PIC e em seguida inicia a nova programação.

Por isso, é que eu não entendi a sua colocação.

Ailton

Offline Sérgio_Sena

  • Administrator
  • Mini Robot
  • *****
  • Mensagens: 1.649
    • Electronic Gear for Musicians
Re:bootloader para pic16f876A
« Responder #28 em: 29 de Junho de 2009, 10:27 »
Quanto à diferença entre os PICxxFxxx e os PICxxLFxxx penso que é os LF não terem chumbo (Lead-Free). Supostamente o funcionamento e requisitos deveriam ser exactamente iguais. contudo li nalguns foruns que em alguns casos podem existir pequenas diferenças..


Caros amigos, a diferença entre F e LF, está apenas na tensão de alimentação:

F :: 2.0-5.5V

LF :: 2.0-3.5V


Low Power Flash


Offline Sérgio_Sena

  • Administrator
  • Mini Robot
  • *****
  • Mensagens: 1.649
    • Electronic Gear for Musicians
Re:bootloader para pic16f876A
« Responder #29 em: 29 de Junho de 2009, 10:31 »
Olá Sena
Se existe um bootloader ele evita que um programa enviado sobreescreva na sua área.
Ailton


Correcto!

Mas... o bootloader não corrige o programa escrito por nós.

Ex.:
se eu tenho um GOTO, ou instrução em C com o mesmo trabalho, que me salta para uma posição de memória que está ocupada pelo Bootloader, então o programa entra em crash.

No assemblador/compilador eu devo indicar que zona da memória é proibida (que está a ser ocupada pelo Bootloader). Assim, o programa nunca salta/corre na área destinada ao Bootloader.