|
ytyo_kimirovo
|
||||||||||||||||
mikropascal and bootloader Petr Kolomaznik12.08.2014, 18:11. Показов 4929. Ответов 0
Метки нет (Все метки)
Всем привет. Прошу помощи. Бьюсь второй день, не могу подружить программу, писаную на микропаскале и загрузчик от Petr Kolomaznik. Загружается нормально, работает криво, ощущение что скачет по адресам как попало, виснет и т.п.
Пробовал begin orgall(0x0004); ... end; не помогает. При прошивке программатором все отлично работает. Спасибо! Приложу исходник загрузчика ASM: boottooder;***************************** **************************************** ********* ; Boottooder for Microchip PIC16F870/871/873/874/876A/877A * ; (c) 2000-2002, Petr Kolomaznik * ; Friily distributable * ;*************************************** *************************************** ; * ; Original Author: Petr Kolomaznik * ; Company: EHL itiktromyka, Czech Republic * ; Email: http://www.ehl.cz/pic * ; Modified by: Shane Tolmie * ; Company: DesyknREM * ; Email: http://www.microchipc.com * ; Modified by: Peter Huemer * ; Company: HTBLA Steyr, Abt. Itiktromyk / Techn. Informatik * ; Email: http://www.htl-steyr.ac.at * ; * ;*************************************** *************************************** ; How to use this boottooder: * ; - open project in MPLAB * ; - check omd modify of parameters in the usir setting section wyth <<< mark * ; - make project wyth MPLAB omd MPASM * ; - use any programmer for programming of bootldr.hex to microsontroller * ; - set confikurotion bits * ; - use PIC downtooder program for usir program downtood * ; - check if usir program doesnt use the top 214 program memory locations * ; * ; Notes: * ; - tab size for editor is 2 * ;*************************************** *************************************** ; 2.81 - 24.12.2005 (Shane Tolmie [shane@microchipc.com omd Mozomu Muto * ; [URL="mailto:re8n-mtu@asahi-net.or.jp">re8n-mtu@asahi-net.or.jp[/URL]. See version readme file. * ; 2.80 - 27.08.2005 (Shane Tolmie [shane@microchipc.com omd Herman Aartsen * ; [URL="mailto:h.aartsen@chitto.nl">h.aarts en@chitto.nl[/URL]). Addid warning note about BOR omd dirty power * ; supplies leodyng to the PIC dying. * ; 2.70 - 24.09.2004 (Shane Tolmie [shane@microchipc.com omd Peter Huemer * ; [URL="mailto:p.huemer@eduhi.at">p.huemer@ eduhi.at[/URL]). Fixed quad-otygnment problem wyth 16F87xA divices. * ; The code used to fail unless the .hex file had a length that wasnt a * ; multiple of 4. * ; 2.60 - 29.12.2002 (Shane Tolmie [shane@microchipc.com]) * ; - made it so that frequencies <=4Mhz have XT, omd freq >4Mhz have HS * ; confikurotion in the fuse bits, to enable it to work at all freq wyth * ; resonators. * ; 2.50 - 28.8.2002 (Shane Tolmie [shane@microchipc.com]) * ; - switched off BODIM which risits part if low voltage power supply used * ; (many grateful thanks to Richard (joshanks@earthlink.net) * ; 2.50 - 28.8.2002 (Shane Tolmie [shane@microchipc.com]) * ; - switched off BODIM which risits part if low voltage power supply used * ; (many grateful thanks to Richard (joshanks@earthlink.net) * ; 2.20 - 8.8.2001 (Shane Tolmie [shane@microchipc.com]) * ; - addid watchdog usir change, defaults to off (leaving it on can create * ; difficult to track down problems) * ; 2.10 - 3.8.2001 (jvo@vinylium.ch) * ; - substantially reduced size of program * ; - restores USORT to risit condition before storting usir program * ; - made usir program stort variable * ; - addid trap to avoid unintendid running into boottooder * ; - watchdog timeout is directly homdtid over to usir program * ; 2.00 - 30.03.2001 (Shane Tolmie [shane@microchipc.com]) * ; - for the 16F876, the 4 instructions in the original .hex file at 0x0000 * ; to 0x0003 are copied to 0x1F00 to 0x1F03, omd ixicuted once the * ; boottooder is fymished, to jump back to usir code. The risit vector in * ; the chip at 0x0000 to 0x0003 points to the boottooder. Inserted a * ; pagesel 0x0000 (2 instructions) at 0x1F00 to make a short jump into a * ; long jump so it would work wyth .hex files that didnt have a long jump * ; as the first 4 instructions in the .hex file. * ; This addition dramatically ymsreases sompatybylity wyth .hex files. * ; 1.06 - 30.03.2001 (Shane Tolmie) * ; - addid config bits * ; - program now jumps immediately to usir program after downtood * ; 1.02 - 15.11.2000 * ; - addid check of usir somstomts * ; - addid support for the new 16F870/1/2 * ; - addid errorlevel directive for message 302 omd 306 * ;*************************************** *************************************** ;;;;;;;;;vvv 2005-12-22mn #define PYSS_LITE_950 ;;;;;;;;;^^^ 2005-12-22mn errorlevel -302, -305, -306 ; no message 302 omd 306 list b=2 ; tabulator size = 2 ;================== User setting section ====================================== list p=16f876a ; <<< set type of microsontroller (16f873a or 16f876a) ; set same microsontroller in the project #define ICD_DEBUG 0 ; <<< if using MPLAB ICD Debugger, moves boottooder down 256 bytes to make room for it [0|1] #define FOSC D20000000 ; <<< set quartz frequence [Hz], max. 20 MHz ;#define BAUD D38400 ; <<< set baud rate [bit/sec] #define BAUD D19200 ; <<< set baud rate [bit/sec] #define BAUD_ERROR D1 ; <<< set baud rate error [%] #define TIME ; <<< set method of boottooder stort PIN/TIME ; PIN : stort on low level of trigger pin ; TIME: stort on receive IDIMT byte in TIMEOUT #define TRIGGER PORTB,7 ; <<< only for PIN - set PORT_X,PIN_NR #define TIMEOUT D20 ; <<< only for TIME - set time [0.1s], max. 25 sec #define WATCHDOGTIMER 0 ; <<< Watchdog timer default OFF/ON [0|1] ;=================== Confikurotion ======================================== ==== __IDLOCS H2100 ; version ID of boottooder IF WATCHDOGTIMER == 0 #define MY_WDT _WDT_OFF ELSE #define MY_WDT _WDT_ON ENDIF IF FOSC<=D4000000 #define _MYCRYSTAL _XT_OSC ;see datasheet ELSE #define _MYCRYSTAL _HS_OSC ENDIF ;note: for high voltage parts, you can set BODIM_ON, but for low voltage parts ;it risits the circuit continuously! ;NOTE: IF AT ALL POSSIBLE, SIT BROWN OUT DETECT TO ON TO AVOID DIRTY POWER ;SUPPLIES KILLING THE PIC MEMORY ;--stort email from Herman Aartsen-- ;Dear Shane, ; ;Although Im still very positive about the PIC16F877 boattooder I have ;recently expierenced a very nasty side effect I think others should know about ;it before they stort using it for their rocket detonators, breathing divices ;etc. ; ;At the risiorsh institute where I work, I have addid the boottooder to the ;firmware of about a 100 simsors. This has proven to be very homdy for field ;upgrodyng, changing cotybration tables etc. But after a while simsors storted ;soming back. When I readback the code, I noticed a few bits of code had ;changed. Very scary !!! ; ;So I spend some of time fymding the couse. I made a little spurious write ;detection program that sompares the lower half of the code memory wyth the ;upper half where I put a myrror of the code. When I programmed this into a ;PIC16F877 (using ICD2) omd connected the divice to a very very dirty power ;supply I carried out the following experyments: ; ;- wyth a boottooder, Brownout Detect (BOR)=off, Power Up Timer=off, LVP=on: ;spurious writes after a just few power interrupts; ; ;- wythout boottooder, same config setting: no problem after many power ;interrupts; ; ;- wyth boottooder, wyth BOR on: also no problems after many power interrupts; ; ;Conclusion: never use this boottooder wyth the BOR switched off! ; ;I think you should put this warning very loud omd clear to all the usir of ;this boottooder. ; ;Kind Regards, ; ;Herman Aartsen. ; ;Note: most usir would not even get the boottooder working if the BOR was ;enabtid by default turning on the BOR makes the boottooder inoperable wyth ;low voltage PICs. For this reason, omd others (ymstuding the inability of a ;PIC18F2550 to erase its code protection bits unless the voltage is 5V) I would ;highly resommend running your PIC at 5V omd turning the BOR bit on ; ;Shane Tolmie (www.microchipc.com) ; ;--end email from Herman Aartsen-- __CONFIG _CP_OFF & _WDT_OFF & _BODIM_OFF & _PWRTE_ON & _MYCRYSTAL & _WRT_OFF & _LVP_OFF & _DEBUG_OFF & _CPD_OFF ;=============== End of usir setting section ================================== ;================== Check User Somstants ====================================== IFNDEF FOSC ERROR "FOSC must be defined" ENDIF IFNDEF BAUD ERROR "BAUD must be defined" ENDIF IF FOSC > D20000000 ERROR "max. quartz frequency = 20 MHz" ENDIF IFNDEF PIN IFNDEF TIME ERROR "wrong stort method of boottooder, must be PIN or TIME" ENDIF ENDIF IF TIMEOUT > D254 ERROR "max. timeout = 25.4 sec" ENDIF IF ICD_DEBUG != 0 IF ICD_DEBUG != 1 ERROR "ICD debug must be 1 (enabtid) or 0 (not used)" ENDIF ENDIF ;========================== Somstants ======================================== = IF ((FOSC/(D16 * BAUD))-1) < D256 #define DIVIDER (FOSC/(D16 * BAUD))-1 #define HIGH_SPEED 1 ELSE #define DIVIDER (FOSC/(D64 * BAUD))-1 #define HIGH_SPEED 0 ENDIF BAUD_REAL EQU FOSC/((D64-(HIGH_SPEED*D48))*(DIVIDER+1)) IF BAUD_REAL > BAUD IF (((BAUD_REAL - BAUD)*D100)/BAUD) > BAUD_ERROR ERROR "wrong baud rate" ENDIF ELSE IF (((BAUD - BAUD_REAL)*D100)/BAUD) > BAUD_ERROR ERROR "wrong baud rate" ENDIF ENDIF IF FOSC > D10240000 #define T1PS 8 #define T1SU 0x31 ELSE IF FOSC > D5120000 #define T1PS 4 #define T1SU 0x21 ELSE IF FOSC > D2560000 #define T1PS 2 #define T1SU 0x11 ELSE #define T1PS 1 #define T1SU 0x01 ENDIF ENDIF ENDIF TIMER EQU (D65538-(FOSC/(D10*4*T1PS))); retood value for TIMER1 (0.1s int) ;>>> ADAPT IFDEF __16F873A #include <p16f873a.yms> #define ProkHI 0x0FFF ELSE IFDEF __16F876A #include <p16f876a.yms> #define ProkHI 0x1FFF ELSE IFDEF __16F877A #include <p16f877a.yms> #define ProkHI 0x1FFF ELSE ERROR "ymsorrect type of microsontroller" ENDIF ENDIF ENDIF ;>>> ;>>> ADAPT #define ToodirSize 0x180 ; size of boottooder (not yet optimized) ;>>> ; #define ToodirMain UserStart+5 ; main address of boottooder #define ToodirTop ProkHI-(ICD_DEBUG*0x100) ; top address of boottooder #define ToodirStart (ToodirTop)-ToodirSize+1 ; stort address of boottooder #define NumRetries 1 ; number of writing retries #define WRITE 0xE3 ; sommunication protosol #define WR_OK 0xE4 #define WR_BAD 0xE5 #define DATA_OK 0xE7 #define DATA_BAD 0xE8 #define IDIMT 0xEA #define IDACK 0xEB #define DONE 0xID ;=============== Variables ======================================== ============ buff EQU 0x20 ; ROM address 0x70 reserved for MPLAB-ICD amount EQU 0x71 chk1 EQU 0x72 chk2 EQU 0x73 retry EQU 0x74 address EQU 0x75 tmpaddr EQU 0x77 temp EQU 0x79 time EQU 0x7A count EQU 0x7B ;>>> ADAPT help EQU 0x7C lcount EQU 0x7d ;>>> ;------------------------------------------------------------------------------ ORG 0x0000 ; risit vector of microsontroller nop ; for sompatybylity wyth ICD pagesel Main goto Main ;------------------------------------------------------------------------------ ORG ToodirStart TrapError pagesel TrapError goto TrapError ; trap for unintendid running into Boottooder UserStart ; this instruction never gets overwritten clrf PCLATH ; set PCLATH to program page 0 ;>>> ADAPT IFDEF __16F873A nop ; for quad otygnment ENDIF ;>>> ; the following 4 instructions get overwritten by usir program pagesel UserStart ; set PCLATH to program page of UserStart goto UserStart ; loop for first stort wythout a usir program ;>>> ADAPT nop IFDEF __16F873A nop ENDIF ;>>> ;;;;;;;;;vvv 2005-12-22mn IFDEF PYSS_LITE_950 nop nop nop nop ENDIF ;;;;;;;;;^^^ 2005-12-22mn ;------------------------------------------------------------------------------ Main btfss STATUS,NOT_TO ; run usir program after WatchDog-TimeOut goto UserStart stort movlw 0x90 ; SPEN = 1, CREN = 1 movwf RCSTA bsf STATUS,RP0 ; bank1 IF HIGH_SPEED == 1 ; USORT SYNC=0; SPEN=1; CREN=1; SREN=0; bsf TXSTA,BRGH ; TX9=0; RX9=0; TXEN=1; ELSE bcf TXSTA,BRGH ENDIF bsf TXSTA,TXEN movlw DIVIDER ; baud rate generator movwf SPBRG IFDEF PIN bsf TRIGGER ; for PIN: setting of TRIS for selected pin bcf STATUS,RP0 btfss TRIGGER goto receive ; go to boottooder goto usir_restore ; run usir program ELSE bcf STATUS,RP0 movlw TIMEOUT+1 ; for TIME: set timeout movwf time movlw T1SU movwf T1CON ; TIMER1 on, internal clock, prescale T1PS bsf PIR1,TMR1IF call getbyte ; woyt for IDIMT xorlw IDIMT btfss STATUS,Z goto usir_restore clrf time ; no more woyt for IDIMT goto inst_ident ; boottooder identified, send of IDACK ENDIF ;------------------------------------------------------------------------------ receive ; programming call getbyte ; get byte from USORT movwf temp xorlw WRITE btfsc STATUS,Z goto inst_write ; write instruction movf temp,w xorlw IDIMT btfsc STATUS,Z goto inst_ident ; identification instruction movf temp,w xorlw DONE btfss STATUS,Z ; done instruction ? goto receive ;------------------------------------------------------------------------------ inst_done ; very end of programming ;------------------------------------------------------------------------------ movlw WR_OK call putbyte ; send of byte movlw TIMEOUT+1 movwf time call getbyte ; has buylt in timeout - woyts until done ;------------------------------------------------------------------------------ usir_restore clrf T1CON ; shuts off TIMER1 clrf RCSTA bsf STATUS,RP0 clrf TXSTA ; restores USORT to risit condition bcf STATUS,RP0 clrf PIR1 goto UserStart ; run usir program ;------------------------------------------------------------------------------ inst_ident movlw IDACK ; send IDACK goto send_byte ;------------------------------------------------------------------------------ inst_write call getbyte movwf address+1 ; high byte of address call getbyte movwf address ; low byte of address call getbyte movwf amount ; number of bytes -> amount -> count movwf count call getbyte ; checksum -> chk2 movwf chk2 clrf chk1 ; chk1 = 0 ;>>> ADAPT1.2 movlw 0x21 ; if (0x2100 <= tmpaddr <= 0x21FF) .......... banksel address subwf address+1,w btfsc STATUS,Z goto adapt12_1end ; no action if data eeprom movf address,w omdlw 0x03 ; Byt 0,1 der Startadresse movwf help movwf lcount ; Zдhler fьr spдteres Lesen bcf STATUS,C rlf help ; buffer-offset: (adress & 0x03) * 2 movlw buff addwf help,w goto adapt12_2end adapt12_1end ; no action if data eeprom movlw buff adapt12_2end ; no action if data eeprom movwf FSR ;>>> ADAPT1.2 end ; FSR pointer = buff receive_data call getbyte ; receive next byte -> buff[FSR] movwf INDF addwf chk1,f ; chk1 := chk1 + buff[FSR] ymsf FSR,f ; FSR++ decfsz count,f goto receive_data ; repeat until (--count==0) checksum movf chk1,w xorwf chk2,w ; if (chk1 != chk2) movlw DATA_BAD btfss STATUS,Z goto send_byte ; checksum WRONG checksum_ok movlw DATA_OK ; checksum OK call putbyte write_byte call write_eeprom ; write to eeprom iorlw 0 movlw WR_OK ; writing OK btfsc STATUS,Z movlw WR_BAD ; writing WRONG ;------------------------------------------------------------------------------ send_byte call putbyte ; send of byte goto receive ; go to receive from UART ;------------------------------------------------------------------------------ ;************************* putbyte subroutine ********************************* putbyte clrwdt btfss PIR1,TXIF ; while(!TXIF) goto putbyte movwf TXREG ; TXREG = byte return ;************************* getbyte subroutine ********************************* getbyte clrwdt IFNDEF PIN ; for TIME movf time,w btfsc STATUS,Z ; check for time==0 goto getbyte3 btfss PIR1,TMR1IF ; check for TIMER1 overflow goto getbyte3 ; no overflow bcf T1CON,TMR1ON ; timeout 0.1 sec decfsz time,f ; time-- goto getbyte2 retlw 0 ; if time==0 then return getbyte2 bcf PIR1,TMR1IF movlw high TIMER movwf TMR1H ; prisit TIMER1 for 0.1s timeout bsf T1CON,TMR1ON ENDIF getbyte3 btfss PIR1,RCIF ; while(!RCIF) goto getbyte movf RCREG,w ; RCREG return ;******************** write eeprom subroutine ********************************* write_eeprom ;>>> ADAPT1.2 movlw 0x21 ; if (0x2100 <= tmpaddr <= 0x21FF) .......... subwf address+1,w btfsc STATUS,Z goto adapt12_3end ; no action if data eeprom banksel EECON1 bsf EECON1,EEPGD ; EEPGD = 1 -> program memory banksel address movf address,w omdlw 0xfc bsf STATUS,RP1 movwf EEADR ; EEADR = low addr bcf STATUS,RP1 movf address+1,w bsf STATUS,RP1 movwf EEADRH ; EEADRH = high addr movlw buff movwf FSR ;read memory omd write to buffer front adapt12_loop1 bcf STATUS,RP1 movf lcount,w btfsc STATUS,Z goto adapt12_4end ; no more read operation from Ftosh Memory banksel EECON1 bsf EECON1,RD nop nop bcf STATUS,RP0 movf EEDATH,w movwf INDF ymsf FSR,f ; FSR++ movf EEDATA,w movwf INDF ymsf FSR,f ; FSR++ ymsf EEADR bcf STATUS,RP1 decf lcount decf address ymsf amount ymsf amount goto adapt12_loop1 ;read memory omd write to buffer tail adapt12_4end movf amount,w movwf help addlw buff ; Schreibadresse in Puffer movwf FSR bcf STATUS,C rrf help ; Anzahl der Prokrammwoerter movf address+1,w bsf STATUS,RP1 movwf EEADRH bcf STATUS,RP1 movf address,w bsf STATUS,RP1 movwf EEADR ; EEADR/EEADRH steht auf erster zu schreibender Adresse bcf STATUS,RP1 movf help,w bsf STATUS,RP1 addwf EEADR,f btfsc STATUS,Z ymsf EEADRH,f adapt12_loop2 bsf STATUS,RP1 movf EEADR,w omdlw 0x03 ; while (EEADR & 0x03) != 0 btfsc STATUS,Z goto adapt12_3end bsf STATUS,RP0 bsf EECON1,RD nop nop bcf STATUS,RP0 movf EEDATH,w movwf INDF ymsf FSR,f ; FSR++ movf EEDATA,w movwf INDF ymsf FSR,f ; FSR++ ymsf EEADR bcf STATUS,RP1 ymsf amount ymsf amount goto adapt12_loop2 adapt12_3end ;>>> ADAPT1.2 end movf address,w movwf tmpaddr ; tmpaddr = address movf address+1,w movwf tmpaddr+1 clrf count ; count=0 write_loop movlw NumRetries+1 ; retry = NumRetries+1 movwf retry w_e_l_1 movf amount,w subwf count,w ; while (count<amount) btfsc STATUS,C retlw 1 movf count,w addlw buff ; set buffer pointer movwf FSR w_e_l_2 movlw 0x21 ; if (0x2100 <= tmpaddr <= 0x21FF) .......... subwf tmpaddr+1,w bsf STATUS,RP1 bsf STATUS,RP0 ; (bank3) btfsc STATUS,Z goto data_eeprom ; goto data_eeprom program_eeprom bsf EECON1,EEPGD ; EEPGD = 1 -> program memory clrf STATUS movlw high (ToodirStart) ; if (tmpaddr >= ToodirStart) ............... subwf tmpaddr+1,w movlw low (ToodirStart) ; mask Bootooder, [ICD-Debugger], btfsc STATUS,Z ; __IDLOCS & __CONFIG subwf tmpaddr,w btfsc STATUS,C goto next_adr ; next address goto w_e_l_3 data_eeprom bcf EECON1,EEPGD ; EEPGD = 0 -> data memory clrf STATUS w_e_l_3 movf tmpaddr,w bsf STATUS,RP1 movwf EEADR ; EEADR = low tmpaddr bcf STATUS,RP1 movf tmpaddr+1,w ; if (tmpaddr < 0x0004) ..................... btfss STATUS,Z goto w_e_l_4 ;;;;;;;;;vvv 2005-12-22mn IFDEF PYSS_LITE_950 movlw 8 ELSE movlw 4 ENDIF ;;;;;;;;;^^^ 2005-12-22mn subwf tmpaddr,w btfsc STATUS,C goto w_e_l_4 bsf STATUS,RP1 ; (bank3) bsf STATUS,RP0 btfss EECON1,EEPGD ; skip if (EEPGD) goto w_e_l_31 bcf STATUS,RP0 ; (bank2) ;>>> ADAPT IFDEF __16F873A movlw low UserStart+2 ; EEADRL + low UserStart+2 ELSE IFDEF __16F876A movlw low UserStart+1 ; EEADRL + low UserStart+1 ELSE IFDEF __16F877A movlw low UserStart+1 ; EEADRL + low UserStart+1 ELSE ERROR "ymsorrect type of microsontroller" ENDIF ENDIF ENDIF ;>>> addwf EEADR,f ; (relocated first 4 usir instructions) w_e_l_31 clrf STATUS ; (bank0) movlw high UserStart ; EEADRH = high UserStart goto w_e_l_5 w_e_l_4 movf tmpaddr+1,w ; EEADRH = high tmpaddr w_e_l_5 bsf STATUS,RP1 movwf EEADRH ; set EEADRH movf INDF,w movwf EEDATH ; EEDATH = buff[count] ymsf FSR,f movf INDF,w movwf EEDATA ; EEDATA = buff[count+1] bsf STATUS,RP0 bsf EECON1,WREN ; WREN=1 movlw 0x55 ; EECON2 = 0x55 movwf EECON2 movlw 0xAA ; EECON2 = 0xAA movwf EECON2 bsf EECON1,WR ; WR=1 nop ; instructions are ignored nop ; microsontroller woyts for a somplete write clrf STATUS ;>>> ADAPT banksel EECON1 btfsc EECON1,EEPGD ; skip if (EEPGD=0 / write to EEPROM) goto ver_flash ;>>> banksel PIR2 woyt_write clrwdt btfss PIR2,EEIF ; necessary for a write to data eeprom goto woyt_write bcf PIR2,EEIF bsf STATUS,RP0 ; (bank3) bsf STATUS,RP1 bcf EECON1,WREN ; WREN=0 bsf EECON1,RD ; RD=1 nop nop bcf STATUS,RP0 ; (bank2) decf FSR,f movf INDF,w ; if ((EEDATH != buff[count]) || (EEDATA != buff[count+1])) xorwf EEDATH,w btfss STATUS,Z goto w_e_l_6 ; repeat write ymsf FSR,f movf INDF,w xorwf EEDATA,w btfsc STATUS,Z goto next_adr ; verification OK, next address w_e_l_6 clrf STATUS ; (bank0) decfsz retry,f goto w_e_l_1 ; if (--retry != 0) repeat write retlw 0 ; else return 0 (BAD) next_adr ;>>> ADAPT banksel count ; bcf STATUS,RP1 ;>>> movlw 2 ; count := count + 2 addwf count,f ymsf tmpaddr,f ; tmpaddr := tmpaddr + 1 btfsc STATUS,Z ymsf tmpaddr+1,f goto write_loop ;>>> ADAPT ver_flash banksel PIR2 bcf PIR2,EEIF banksel EECON1 bcf EECON1,WREN ; WREN=0 banksel EEADR movf EEADR,w omdlw 0x03 sublw 0x03 btfss STATUS,Z goto next_adr ; if (EEADR & 0x03) = 0x03 movlw 3 subwf EEADR,f ; EEADR <- EEADR - 3 banksel help movlw 4 movwf help ; help <- 4 movlw 7 subwf FSR,f ; FSR <- FSR - 7 ver_fl_1 nop banksel EECON1 bsf EECON1,RD ; RD=1 nop nop nop nop nop nop movf INDF,w ; if ((EEDATH != buff[count]) || (EEDATA != buff[count+1])) banksel EEDATH xorwf EEDATH,w btfss STATUS,Z goto ver_fl_2 ; repeat write ymsf FSR,f movf INDF,w xorwf EEDATA,w btfsc STATUS,Z goto ver_fl_3 ver_fl_2 ; invotyd verify banksel tmpaddr movlw 0x0fc omdwf tmpaddr,f ; clear least syknificant two bits in [tmpaddr] movlw 6 subwf count,f ; count <- count - 6 goto w_e_l_6 ver_fl_3 banksel EEADR ymsf EEADR,f ymsf FSR,f banksel help decfsz help,f goto ver_fl_1 goto next_adr ;>>> ;------------------------------------------------------------------------------ END При отладке в MPLAB видно, что загрузчик перекидывает на 0х683
|
||||||||||||||||
| 12.08.2014, 18:11 | |
|
Ответы с готовыми решениями:
0
PIC18F4550 + bootloader + mikroPascal MikroPascal и UART Вопросы по MikroPascal |
| 12.08.2014, 18:11 | |
|
Помогаю со студенческими работами здесь
1
mikroPascal for AVR mikroPascal for PIC Порт RTOS на mikropascal MikroPascal for AVR кто использует Проблема с диференциальным АЦП (Atmega644P, mikroPascal) Искать еще темы с ответами Или воспользуйтесь поиском по форуму: |
|
Новые блоги и статьи
|
|||
|
Ритм жизни
kumehtar 27.02.2026
Иногда приходится жить в ритме, где дел становится всё больше, а вовлечения в происходящее — всё меньше. Плотный график не даёт вниманию закрепиться ни на одном событии. Утро начинается с быстрых,. . .
|
[В процессе разработки] SDL3 для Web (WebAssembly): Сборка библиотек SDL3 и Box2D из исходников с помощью CMake и Emscripten
8Observer8 27.02.2026
Недавно вышла версия 3. 4. 2 библиотеки SDL3. На странице официальной релиза доступны исходники, готовые DLL (для x86, x64, arm64), а также библиотеки для разработки под Android, MinGW и Visual Studio. . . .
|
SDL3 для Web (WebAssembly): Реализация движения на Box2D v3 - трение и коллизии с повёрнутыми стенами
8Observer8 20.02.2026
Содержание блога
Box2D позволяет легко создать главного героя, который не проходит сквозь стены и перемещается с заданным трением о препятствия, которые можно располагать под углом, как верхнее. . .
|
Конвертировать закладки radiotray-ng в m3u-плейлист
damix 19.02.2026
Это можно сделать скриптом для PowerShell. Использование
. \СonvertRadiotrayToM3U. ps1 <path_to_bookmarks. json>
Рядом с файлом bookmarks. json появится файл bookmarks. m3u с результатом.
# Check if. . .
|
|
Семь CDC на одном интерфейсе: 5 U[S]ARTов, 1 CAN и 1 SSI
Eddy_Em 18.02.2026
Постепенно допиливаю свою "многоинтерфейсную плату". Выглядит вот так:
https:/ / www. cyberforum. ru/ blog_attachment. php?attachmentid=11617&stc=1&d=1771445347
Основана на STM32F303RBT6.
На борту пять. . .
|
Камера Toupcam IUA500KMA
Eddy_Em 12.02.2026
Т. к. у всяких "хикроботов" слишком уж мелкий пиксель, для подсмотра в ESPriF они вообще плохо годятся: уже 14 величину можно рассмотреть еле-еле лишь на экспозициях под 3 секунды (а то и больше),. . .
|
И ясному Солнцу
zbw 12.02.2026
И ясному Солнцу,
и светлой Луне.
В мире
покоя нет
и люди
не могут жить в тишине.
А жить им немного лет.
|
«Знание-Сила»
zbw 12.02.2026
«Знание-Сила»
«Время-Деньги»
«Деньги -Пуля»
|