/Designs/Measuring_instruments/AWS01A/SW/PIC16F887/bootloader887/bloader.PJT
49,10 → 49,10
1=bloader.c
2=bloader.h
3=..\common\bloader_defs.h
4=..\..\..\..\..\..\..\..\..\..\Program Files\PICC\devices\16F887.h
5=..\..\..\..\..\..\..\..\..\..\Program Files\PICC\drivers\string.h
6=..\..\..\..\..\..\..\..\..\..\Program Files\PICC\drivers\stddef.h
7=..\..\..\..\..\..\..\..\..\..\Program Files\PICC\drivers\ctype.h
8=
9=bloader.lst
4=
5=C:\Program Files (x86)\PICC\Devices\16F887.h
6=C:\Program Files (x86)\PICC\Drivers\string.h
7=C:\Program Files (x86)\PICC\Drivers\stddef.h
8=C:\Program Files (x86)\PICC\Drivers\ctype.h
9=
10=
/Designs/Measuring_instruments/AWS01A/SW/PIC16F887/bootloader887/bloader.c
9,7 → 9,7
echo uf > /dev/ttyUSB$1
ascii-xfr -s -v -l 100 ./bltest.hex > /dev/ttyUSB$1
Or add "uf\n\r" and add some dummy characters at end or begin of each line (for 100 ms delay) and use:
Or add "uf\n\r" and add some dummy characters at the end or begin of each line (for 100 ms delay) and use:
cp ./bltest.hex > /dev/ttyUSB0
For adding characters you can use this:
16,6 → 16,10
sed -i 's/^/pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp/' ./bltest.hex
sed -i 1i"uf" ./bltest.hex
Windows script:
echo uf > com1
ping 1.1.1.1 -n 1 -w 100 > nul
FOR /F "tokens=1*" %%i in (bltest.hex) do @echo %%i > com1 & ping 1.1.1.1 -n 1 -w 100 > nul
*/
 
#define ID "$Id$"
111,7 → 115,7
{
if(Condition)
{
putchar('E');
putchar('e');
putchar(ErrorCode+'0');
reset_cpu();
}
158,9 → 162,9
} data;
 
disable_interrupts(GLOBAL);
/*
 
putchar('@'); //Start Erase
 
/*
//Erase program memory is not necessary.
{
int8 i;
192,15 → 196,15
putc(buffer[buffidx]);
} while ( (buffer[buffidx++] != '\r') && (buffidx < BUFFER_LEN_LOD) );
assert(buffidx == BUFFER_LEN_LOD, ERR_BUFFER_OVERRUN); // Error 1 - Buffer Overrun
buffidx--;
//---WDT
restart_wdt();
 
checksum = 0; // Sum the bytes to find the check sum value
for (i=0; i<(buffidx); i+=2)
for (i=0; i<(buffidx-3); i+=2)
{
checksum += atoi_b16 (&buffer[i]);
//!!! printf(".%x",checksum);
}
assert(checksum != 0, ERR_CHECKSUM); // Error 2 - Bad CheckSum
 
230,8 → 234,8
for (i=0,next_addr=addr;i<8;i++)
data.i16[i]=read_program_eeprom(next_addr++);
// Loops through all of the data and stores it in data
// The last 2 bytes are the check sum, hence buffidx-2
for (i=8,dataidx=0; i < (buffidx-2); i += 2)
// The last 2 bytes are the check sum, hence buffidx-4
for (i=8,dataidx=0; i < (buffidx-5); i += 2)
data.i8[dataidx++]=atoi_b16(&buffer[i]);
 
if (addr == 0)
242,7 → 246,7
putchar('%');
}
else
if ( (addr > 7) && (addr <= (LOADER_RESERVED-16)) ) // Do not overwrite BootLoader
if ( (addr >= FLASH_BLOCK_SIZE) && (addr <= (LOADER_RESERVED-16)) ) // Do not overwrite BootLoader
{
// Write program
write_program_memory(addr, &data.i8[0], 16); // It works only with 16 !!!
/Designs/Measuring_instruments/AWS01A/SW/PIC16F887/bootloader887/bloader.hex
1,4 → 1,4
:080000001F308A005C2F000094
:080000001F308A00602F000090
:10002000FF00030E8301A1000A08A0008A01040852
:10003000A2007708A3007808A4007908A5007A0830
:10004000A600831383128C308400801E29288C1A0A
56,48 → 56,48
:100380006430AE003A30AF002030B0006230B100CF
:100390006C30B2006F30B3006130B4006430B5002F
:1003A0006530B6007230B7002E30B8006330B90047
:1003B0002030BA003230BB003830BC003130BD00D4
:1003C0003730BE002030BF003230C0003030C100B6
:1003B0002030BA003230BB003830BC003430BD00D1
:1003C0003830BE002030BF003230C0003030C100B5
:1003D0003130C2003330C3002D30C4003030C5008E
:1003E0003330C6002D30C7003130C8003030C9006E
:1003F0002030CA003130CB003030CC003A30CD0054
:100400003530CE003630CF003A30D0003430D10015
:10041000D2005A30D3002030D4006B30D500613088
:10042000D6006B30D7006C30D8002030D900243093
:10043000DA00DB01DF012C30DE009420013078028D
:100440002C3E840083130008243C031D312ADF0165
:100450002C30DE009420013078022C3E840083137F
:100460008001523003178D0000308F000313B2203B
:1004700023300C1E392A9900303084008313800801
:100480000319552ADF010408DE005F10831B5F1487
:1004900000080C1E492A99005E08840083135F1827
:1004A0008317840A0319850A3F2A0D300C1E562A29
:1004B00099000A300C1E5A2A9900633003178D00E8
:1004C00000308F0003100C300313AC00FA20103002
:1004D00084000330AD001030AC004B210D300C1EF9
:1004E0006F2A99000A300C1E732A99006C3003178A
:1004F0008D0000308F00031014300313AC00FA207D
:1005000010308400AD012030AC004B210D300C1EAA
:10051000872A99000A300C1E8B2A9900793003171C
:100520008D0000308F00031014300313AC00FA204C
:1005300010308400AD01AC004B210D300C1E9E2A02
:1005400099000A300C1EA22A9900863003178D00EC
:1005500000308F000313B22083168C16C030831234
:100560008B042B08AB0AAC002C08AD001B30AE008E
:100570002D08AF006430B000A4217708AD007808E2
:100580003030031DCA2AAE1CD22AAE19D22A2E1A26
:100590002030CD2AAE112E122E14F80778080C1E2A
:1005A000CF2A99002D08AF000A30B000A4217708A7
:1005B000AD0078083030031DE32AAE19E82A2E1C5E
:1005C000E82A2E1A2030F80778080C1EE52A990030
:1005D0003030AD072D080C1EEB2A99007C300C1E24
:1005E000EF2A99006430AC002C308400831300089B
:1005F0000319072B0230F800F701F70BFD2AF80B5F
:10060000FC2A9730F700F70B032B800BFA2AB12A4C
:060610008A150A16F32C06
:1003E0003330C6002D30C7003230C8003130C9006C
:1003F0002030CA003030CB003830CC003A30CD004D
:100400003130CE003630CF003A30D0003430D10019
:100410003930D2005A30D3002030D4006B30D500B0
:100420006130D6006B30D7006C30D8002030D90056
:100430002430DA00DB01DF012C30DE0094200130B3
:1004400078022C3E840083130008243C031D322ACA
:10045000DF012C30DE009420013078022C3E840035
:1004600083138001523003178D0000308F00031377
:10047000B22023300C1E3A2A9900303084008313B6
:1004800080080319562ADF010408DE005F10831B71
:100490005F1400080C1E4A2A99005E08840083132A
:1004A0005F188317840A0319850A402A0D300C1E31
:1004B000572A99000A300C1E5B2A990063300317F3
:1004C0008D0000308F0003100C300313AC00FA20B5
:1004D000103084000330AD001030AC004B210D30E3
:1004E0000C1E702A99000A300C1E742A99006C3078
:1004F00003178D0000308F00031014300313AC007D
:10050000FA2010308400AD012030AC004B210D30BA
:100510000C1E882A99000A300C1E8C2A990079300A
:1005200003178D0000308F00031014300313AC004C
:10053000FA2010308400AD01AC004B210D300C1EB0
:100540009F2A99000A300C1EA32A990086300317AF
:100550008D0000308F000313B22083168C16C0303C
:1005600083128B042B08AB0AAC002C08AD001B30A7
:10057000AE002D08AF006430B000A4217708AD00B4
:1005800078083030031DCB2AAE1CD32AAE19D32AEB
:100590002E1A2030CE2AAE112E122E14F80778080B
:1005A0000C1ED02A99002D08AF000A30B000A421FB
:1005B0007708AD0078083030031DE42AAE19E92A27
:1005C0002E1CE92A2E1A2030F80778080C1EE62A7D
:1005D00099003030AD072D080C1EEC2A99007C30B4
:1005E0000C1EF02A99006430AC002C308400831378
:1005F00000080319082B0230F800F701F70BFE2A58
:10060000F80BFD2A9730F700F70B042B800BFB2A21
:08061000B22A8A150A16F32C28
:0C39E0000A128A11B9290A168A1508007B
:103A00008C1E002D1808A7001A08F800A71C0A2D04
:103A10001812181608008316B10803191F2D453017
:103A10001812181608008316B10803191F2D6530F7
:103A200083120C1E112D9900303083163207B3001B
:103A300083120C1E192D99008A0100288316831207
:103A400008008316B601B7013708013C031C552D49
122,79 → 122,79
:103B7000C92D043CF900FF308C008E0083160C1513
:103B800083120313592503178D0A03198F0AF90BA2
:103B9000BB2D03130800E001DF010B138B138B1BFC
:103BA000CE2D21300C1ED22D99008C1AD92D6400F7
:103BB000D52D0D300C1EDA2D99000A300C1EDE2D8D
:103BC0009900002578083A3C0319E82D6400E12D9E
:103BD0003A300C1EE92D9900AB012C302B078400E4
:103BE0008313EC010408EB006C10831B6C1400259C
:103BF0006B08840083136C188317780880002C30BE
:103C00002B07840083130008E90069080C1E062EA8
:103C100099002B08AB0A2C3E8400831300080D3C4E
:103C20000319162E2B082D3C0318ED2D2B082E3CC6
:103C300003191C2E00301D2E0130E9008316B1003F
:103C40000130B20083120B25AB036400DA01E801F6
:103C50002B0868020318402E2C306807E900EA019F
:103C60000318EA0A6A088316B500831269088316E6
:103C7000B400831221257808DA070230E807282EDD
:103C8000DA08031D452E0030462E0130E900831668
:103C9000B1000230B20083120B258316B5012E301D
:103CA000B400831221257808E9008316B50130306D
:103CB000B400831221256908DE007808DD00831630
:103CC000B5013230B400831221257808DC00831658
:103CD000B5012C30B400831221257808DB005B0885
:103CE000103C031C752E0030762E0130E90083163F
:103CF000B1000330B20083120B255D08E1005E08BD
:103D0000E2000310E20CE10C5C0B8C2E23300C1E45
:103D1000872E99008A010028DC08031D912E0030AF
:103D2000922E0130E9008316B1000430B2008312F4
:103D30000B25E801E601E5016208E4006108E30003
:103D40006808073C031CD02E0310680DA03E8400B9
:103D500083136608FA006508F9006408F800630830
:103D6000F7000130E3070318E40A0319E50A031911
:103D7000E60A7A08EE00770803178D000313780827
:103D800003178F0083168C170C1400000000831299
:103D90000C088000840A0E0880000313E80AA02E95
:103DA0000830E800E70102302B0268020318FC2EFD
:103DB0006708E70AA03EF800FA010318FA0A780833
:103DC000E9007A08EA002C306807EB00EC010318E0
:103DD000EC0A6C088316B50083126B088316B400D6
:103DE000831221256908840083136A1883177808D1
:103DF00080000230E807D32EE108031D1B2FE208E4
:103E0000031D1B2F1C30E200F030E1006208031795
:103E10008F000313610803178D00A0308400831303
:103E2000103083160313B00083126D2525300C1E4D
:103E3000172F9900452FE208031D222F6108073C28
:103E40000318412F62081C3C031C412F031D2C2F1B
:103E50006108E03C031C412F620803178F00031325
:103E6000610803178D00A03084008313103083167F
:103E70000313B00083126D2524300C1E3D2F9900D2
:103E8000452F2E300C1E422F99000D300C1E462F50
:103E900099000A300C1E4A2F99006400E12D080099
:103EA000AC01AB012B0F572F2C0F572F5B2FAB0AF9
:103EB0000319AC0A522F0800840183131F308305B5
:103EC000713083168F000F08031787110C3003130E
:103ED0009900A2309800903083129800831603173F
:103EE00087110C3003139900A23098009030831290
:103EF0009800831603170908C039890003131F129D
:103F00009F120030031788008312870188018901FE
:103F10000313A701A801A9010B138B138B1B8D2F72
:103F20000930031785000F30F7000313810181303A
:103F3000840083130008F03907388000640000080B
:103F4000F739F719F0397704800083160317090849
:103F5000C039890003131F129F1200300317880015
:103F6000831203131F1083160108C7390838810014
:103F7000831290010030F800920000308316920006
:103F800083120317870188018901831603139701A0
:103F900071308F000F088312AA012A0FD02FF42F3F
:103FA0008C1EE42F00257808753C031DE32F2A3072
:103FB0000C1ED82F990000257808663C031DE22FBF
:103FC0006400CB25E42FF42F75300C1EE52F9900EB
:103FD00066300C1EE92F99003F300C1EED2F990022
:103FE00050276400AA0ACD2F64001C308A00F030EC
:043FF00082006300E8
:103BA000CE2D40300C1ED22D990021300C1ED62D6A
:103BB00099008C1ADD2D6400D92D0D300C1EDE2DE0
:103BC00099000A300C1EE22D9900002578083A3C35
:103BD0000319EC2D6400E52D3A300C1EED2D9900F3
:103BE000AB012C302B0784008313EC010408EB009D
:103BF0006C10831B6C1400256B08840083136C18F5
:103C00008317780880002C302B078400831300086A
:103C1000E90069080C1E0A2E99002B08AB0A2C3EFD
:103C20008400831300080D3C03191A2E2B082D3C29
:103C30000318F12D2B082E3C0319202E0030212EC5
:103C40000130E9008316B1000130B20083120B2568
:103C50006400DA01E80103302B0268020318442EE5
:103C60002C306807E900EA010318EA0A6A0883169B
:103C7000B500831269088316B400831221257808E1
:103C8000DA070230E8072B2EDA08031D492E003030
:103C90004A2E0130E9008316B1000230B2008312CF
:103CA0000B258316B5012E30B40083122125780828
:103CB000E9008316B5013030B4008312212569086C
:103CC000DE007808DD008316B5013230B4008312BF
:103CD00021257808DC008316B5012C30B40083124E
:103CE00021257808DB005B08103C031C792E00308E
:103CF0007A2E0130E9008316B1000330B20083123E
:103D00000B255D08E1005E08E2000310E20CE10C07
:103D10005C0B902E23300C1E8B2E99008A010028FC
:103D2000DC08031D952E0030962E0130E900831625
:103D3000B1000430B20083120B25E801E601E50171
:103D40006208E4006108E3006808073C031CD42E05
:103D50000310680DA03E840083136608FA0065080E
:103D6000F9006408F8006308F7000130E30703185E
:103D7000E40A0319E50A0319E60A7A08EE0077084F
:103D800003178D000313780803178F0083168C1711
:103D90000C140000000083120C088000840A0E0836
:103DA00080000313E80AA42E0830E800E70105307C
:103DB0002B0268020318002F6708E70AA03EF800EC
:103DC000FA010318FA0A7808E9007A08EA002C30A8
:103DD0006807EB00EC010318EC0A6C088316B500C9
:103DE00083126B088316B4008312212569088400AE
:103DF00083136A188317780880000230E807D72EEB
:103E0000E108031D1F2FE208031D1F2F1C30E200D5
:103E1000F030E100620803178F00031361080317F5
:103E20008D00A03084008313103083160313B0007C
:103E300083126D2525300C1E1B2F9900492FE20897
:103E4000031D262F61080F3C0318452F62081C3CF8
:103E5000031C452F031D302F6108E03C031C452F38
:103E6000620803178F000313610803178D00A03049
:103E700084008313103083160313B00083126D2562
:103E800024300C1E412F9900492F2E300C1E462F36
:103E900099000D300C1E4A2F99000A300C1E4E2F2F
:103EA00099006400E52D0800AC01AB012B0F5B2FDE
:103EB0002C0F5B2F5F2FAB0A0319AC0A562F08009B
:103EC000840183131F308305713083168F000F0820
:103ED000031787110C3003139900A230980090301B
:103EE000831298008316031787110C30031399006F
:103EF000A2309800903083129800831603170908A7
:103F0000C039890003131F129F1200300317880065
:103F100083128701880189010313A701A801A90160
:103F20000B138B138B1B912F0930031785000F3058
:103F3000F700031381018130840083130008F039F6
:103F40000738800064000008F739F719F039770462
:103F50008000831603170908C039890003131F1254
:103F60009F12003003178800831203131F1083165B
:103F70000108C73908388100831290010030F80029
:103F80009200003083169200831203178701880184
:103F9000890183160313970171308F000F08831274
:103FA000AA012A0FD42FF82F8C1EE82F002578089D
:103FB000753C031DE72F2A300C1EDC2F99000025CD
:103FC0007808663C031DE62F6400CB25E82FF82F08
:103FD00075300C1EE92F990066300C1EED2F9900EC
:103FE0003F300C1EF12F990054276400AA0AD12FEC
:0C3FF00064001C308A00F0308200630086
:1000080000000000000000000000000000000000E8
:080018000000000000000000E0
:04400E00FD2CFF3F47
:00000001FF
;PIC16F887
;CRC=3DD3 CREATED="21-3-13 09:15"
;CRC=8712 CREATED="09-IV-13 22:40"