initial commit
This commit is contained in:
		
							
								
								
									
										1
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| docs: https://www.instructables.com/id/AVR-High-voltage-programming-Fuses-rescue/ | ||||
							
								
								
									
										1
									
								
								code/Rescue.aps
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								code/Rescue.aps
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| <AVRStudio><MANAGEMENT><ProjectName>Rescue</ProjectName><Created>26-Sep-2009 19:22:26</Created><LastEdit>15-Feb-2010 19:08:26</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>26-Sep-2009 19:22:26</Created><Version>4</Version><Build>4, 14, 0, 589</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\Rescue.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>E:\code\AVR\Rescue\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>AVR Simulator</CURRENT_TARGET><CURRENT_PART>ATmega8.xml</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>Rescue.c</SOURCEFILE><OTHERFILE>default\Rescue.lss</OTHERFILE><OTHERFILE>default\Rescue.map</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega8</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>Rescue.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>0</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -std=gnu99 -DF_CPU=16000000UL -O1 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>D:\WinAVR\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>D:\WinAVR\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><ProjectFiles><Files><Name>E:\code\AVR\Rescue\Rescue.c</Name></Files></ProjectFiles><IOView><usergroups/><sort sorted="0" column="0" ordername="1" orderaddress="1" ordergroup="1"/></IOView><Files><File00000><FileId>00000</FileId><FileName>Rescue.c</FileName><Status>1</Status></File00000></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio> | ||||
							
								
								
									
										127
									
								
								code/Rescue.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										127
									
								
								code/Rescue.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,127 @@ | ||||
| #include <avr/io.h> | ||||
| #include <util/delay.h> | ||||
|  | ||||
| #define	HFUSE	0xDF	// Default for ATmega48/88/168, for others see | ||||
| #define	LFUSE	0x62	// http://www.engbedded.com/cgi-bin/fc.cgi | ||||
|  | ||||
| /* | ||||
| #define  DATA    PORTD // PORTD = Arduino Digital pins 0-7 | ||||
| #define  DATAD   DDRD  // Data direction register for DATA port | ||||
| #define  VCC     8		PB0 | ||||
| #define  RDY     12     PB4 // RDY/!BSY signal from target | ||||
| #define  OE      11		PB3 | ||||
| #define  WR      10		PB2 | ||||
| #define  BS1     9		PB1 | ||||
| #define  XA0     13		PB5 | ||||
| #define  XA1     18    	PC4	// Analog inputs 0-5 can be addressed as | ||||
| #define  PAGEL   19    	PC5	// digital outputs 14-19 | ||||
| #define  RST     14    	PC0	// Output to level shifter for !RESET | ||||
| #define  BS2     16		PC2 | ||||
| #define  XTAL1   17		PC3 | ||||
|  | ||||
| #define  BUTTON  15    	PC1	// Run button | ||||
| #define  LED     0 | ||||
| */ | ||||
|  | ||||
| // PORTB | ||||
| #define	_VCC	(1<<0) | ||||
| #define	_RDY	(1<<4) | ||||
| #define	_OE		(1<<3) | ||||
| #define	_WR		(1<<2) | ||||
| #define	_BS1	(1<<1) | ||||
| #define	_XA0	(1<<5) | ||||
|  | ||||
| // PORTC | ||||
| #define	_XA1	(1<<4) | ||||
| #define	_PAGEL	(1<<5) | ||||
| #define	_RST	(1<<0) | ||||
| #define	_BS2	(1<<2) | ||||
| #define	_XTAL1	(1<<3) | ||||
|  | ||||
| #define	_BUTTON	(1<<1) | ||||
|  | ||||
| void HardwareInit() | ||||
| { | ||||
| 	DDRB	= ~(_RDY);			// all outputs except RDY (PB4) | ||||
| 	PORTB	= 0x00;				// no pull-up | ||||
|  | ||||
| 	DDRC	= ~(_BUTTON);		// all outputs except BUTTON (PC1) | ||||
| 	PORTC	= (_BUTTON)|(_RST);	// pull-up and 12V off (PC0 = 1) | ||||
|  | ||||
| 	DDRD	= 0xff;				// all outputs | ||||
| 	PORTD	= 0x00; | ||||
| } | ||||
|  | ||||
| void sendcmd(unsigned char command) | ||||
| { | ||||
| 	PORTC |= _XA1; | ||||
| 	PORTB &= ~(_XA0|_BS1); | ||||
| 	 | ||||
| 	PORTD = command; | ||||
|  | ||||
| 	PORTC |= _XTAL1; | ||||
| 	_delay_ms(1); | ||||
| 	PORTC &= ~(_XTAL1); | ||||
| 	_delay_ms(1); | ||||
| } | ||||
|  | ||||
| void writefuse(unsigned char fuse, char highbyte) | ||||
| { | ||||
| 	PORTC &= ~(_XA1); | ||||
| 	PORTB |= _XA0; | ||||
| 	_delay_ms(1); | ||||
|  | ||||
| 	PORTD = fuse; | ||||
| 	PORTC |= _XTAL1; | ||||
| 	_delay_ms(1); | ||||
| 	PORTC &= ~(_XTAL1); | ||||
|  | ||||
| 	if (highbyte) | ||||
| 		PORTB |= _BS1; | ||||
| 	else | ||||
| 		PORTB &= ~(_BS1); | ||||
|  | ||||
| 	PORTB &= ~(_WR); | ||||
| 	_delay_ms(1); | ||||
| 	PORTB |= _WR; | ||||
| 	_delay_ms(100); | ||||
| } | ||||
|  | ||||
| int main() | ||||
| { | ||||
| 	HardwareInit(); | ||||
|  | ||||
| 	for (;;) | ||||
| 	{ | ||||
| 		while (PINC & _BUTTON) {}	// wait for button | ||||
|  | ||||
| 		// Initialize pins to enter programming mode | ||||
| 		PORTC &= ~(_PAGEL|_XA1|_BS2); | ||||
| 		PORTB &= ~(_XA0|_BS1); | ||||
| 	 | ||||
| 		// Enter programming mode | ||||
| 		PORTB |= _VCC|_WR|_OE; | ||||
| 		_delay_ms(1); | ||||
| 		PORTC &= ~(_RST); | ||||
| 		_delay_ms(1); | ||||
|  | ||||
| 		// Program HFUSE | ||||
| 		sendcmd(0b01000000); | ||||
| 		writefuse(HFUSE, 1); | ||||
|  | ||||
| 		// Program LFUSE | ||||
| 		sendcmd(0b01000000); | ||||
|   		writefuse(LFUSE, 0); | ||||
|  | ||||
| 		_delay_ms(1000);			// allow button to be released | ||||
|  | ||||
| 		// Exit programming mode | ||||
| 		PORTC |= _RST; | ||||
|  | ||||
| 		// Turn off outputs | ||||
| 		PORTD = 0x00; | ||||
| 		PORTB &= ~(_VCC|_WR|_OE|_XA0|_BS1); | ||||
| 		PORTC &= ~(_PAGEL|_XA1|_BS2); | ||||
| 	} | ||||
| } | ||||
|  | ||||
							
								
								
									
										30
									
								
								code/Rescue.hex
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								code/Rescue.hex
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| :1000000012C019C018C017C016C015C014C013C044 | ||||
| :1000100012C011C010C00FC00EC00DC00CC00BC06C | ||||
| :100020000AC009C008C011241FBECFE5D4E0DEBF5E | ||||
| :10003000CDBF64D0CAC0E4CF8FEE87BB18BA8DEFB6 | ||||
| :1000400084BB83E085BB8FEF81BB12BA0895A5E323 | ||||
| :10005000B0E09C9190619C93E8E3F0E090819D7DFD | ||||
| :10006000908382BB8C9188608C9320EA3FE0C90129 | ||||
| :100070000197F1F78C91877F8C93C9010197F1F774 | ||||
| :100080000895A5E3B0E09C919F7E9C93E8E3F0E0A7 | ||||
| :1000900090819062908320EA3FE0F9013197F1F777 | ||||
| :1000A00082BB8C9188608C93C9010197F1F78C9188 | ||||
| :1000B000877F8C93662331F0E8E3F0E080818260F3 | ||||
| :1000C000808305C0E8E3F0E080818D7F8083E8E3F2 | ||||
| :1000D000F0E080818B7F808380EA9FE00197F1F7D9 | ||||
| :1000E00080818460808328EE33E040E951E0CA01DA | ||||
| :1000F0000197F1F721503040D1F708956F927F9228 | ||||
| :100100008F929F92AF92BF92CF92DF92EF92FF9227 | ||||
| :100110000F931F93CF93DF938FDF0F2EF3E3CF2E39 | ||||
| :10012000DD24F02D05E310E00F2EF8E3EF2EFF2481 | ||||
| :10013000F02D0F2EF0EAAF2EFFE0BF2EF02D0F2E88 | ||||
| :10014000F0E18F2EF7E29F2EF02DC0E9D1E00F2EC7 | ||||
| :10015000F2E36F2E7724F02DF601808181FDFCCF34 | ||||
| :10016000F80180818B7C8083F70180818D7D808385 | ||||
| :1001700080818D608083C5010197F1F7F80180814E | ||||
| :100180008E7F8083C5010197F1F780E460DF8FEDFA | ||||
| :1001900061E077DF80E45BDF82E660E072DF94019C | ||||
| :1001A000CE010197F1F721503040D1F7F80180815D | ||||
| :1001B00081608083F3011082F7018081807D8083DC | ||||
| :0E01C000F80180818B7C8083C7CFF894FFCF3D | ||||
| :00000001FF | ||||
							
								
								
									
										1
									
								
								code/rescue.aws
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								code/rescue.aws
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| <AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATMEGA8"/><Files><File00000 Name="E:\code\AVR\Rescue\Rescue.c" Position="180 50 958 953" LineCol="122 0" State="Maximized"/></Files></AVRWorkspace> | ||||
							
								
								
									
										1960
									
								
								eagle/AVR-Rescue.brd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1960
									
								
								eagle/AVR-Rescue.brd
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										5470
									
								
								eagle/AVR-Rescue.sch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5470
									
								
								eagle/AVR-Rescue.sch
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										118
									
								
								eagle/LM78Lxx.lbr
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										118
									
								
								eagle/LM78Lxx.lbr
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,118 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <!DOCTYPE eagle SYSTEM "eagle.dtd"> | ||||
| <eagle version="6.5.0"> | ||||
| <drawing> | ||||
| <settings> | ||||
| <setting alwaysvectorfont="no"/> | ||||
| <setting verticaltext="up"/> | ||||
| </settings> | ||||
| <grid distance="0.1" unitdist="inch" unit="inch" style="lines" multiple="1" display="no" altdistance="0.01" altunitdist="inch" altunit="inch"/> | ||||
| <layers> | ||||
| <layer number="1" name="Top" color="4" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="2" name="Route2" color="1" fill="3" visible="no" active="yes"/> | ||||
| <layer number="3" name="Route3" color="4" fill="3" visible="no" active="yes"/> | ||||
| <layer number="4" name="Route4" color="1" fill="4" visible="no" active="yes"/> | ||||
| <layer number="5" name="Route5" color="4" fill="4" visible="no" active="yes"/> | ||||
| <layer number="6" name="Route6" color="1" fill="8" visible="no" active="yes"/> | ||||
| <layer number="7" name="Route7" color="4" fill="8" visible="no" active="yes"/> | ||||
| <layer number="8" name="Route8" color="1" fill="2" visible="no" active="yes"/> | ||||
| <layer number="9" name="Route9" color="4" fill="2" visible="no" active="yes"/> | ||||
| <layer number="10" name="Route10" color="1" fill="7" visible="no" active="yes"/> | ||||
| <layer number="11" name="Route11" color="4" fill="7" visible="no" active="yes"/> | ||||
| <layer number="12" name="Route12" color="1" fill="5" visible="no" active="yes"/> | ||||
| <layer number="13" name="Route13" color="4" fill="5" visible="no" active="yes"/> | ||||
| <layer number="14" name="Route14" color="1" fill="6" visible="no" active="yes"/> | ||||
| <layer number="15" name="Route15" color="4" fill="6" visible="no" active="yes"/> | ||||
| <layer number="16" name="Bottom" color="1" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="17" name="Pads" color="2" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="18" name="Vias" color="2" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="19" name="Unrouted" color="6" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="20" name="Dimension" color="15" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="21" name="tPlace" color="7" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="22" name="bPlace" color="7" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="23" name="tOrigins" color="15" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="24" name="bOrigins" color="15" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="25" name="tNames" color="7" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="26" name="bNames" color="7" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="27" name="tValues" color="7" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="28" name="bValues" color="7" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="29" name="tStop" color="7" fill="3" visible="no" active="yes"/> | ||||
| <layer number="30" name="bStop" color="7" fill="6" visible="no" active="yes"/> | ||||
| <layer number="31" name="tCream" color="7" fill="4" visible="no" active="yes"/> | ||||
| <layer number="32" name="bCream" color="7" fill="5" visible="no" active="yes"/> | ||||
| <layer number="33" name="tFinish" color="6" fill="3" visible="no" active="yes"/> | ||||
| <layer number="34" name="bFinish" color="6" fill="6" visible="no" active="yes"/> | ||||
| <layer number="35" name="tGlue" color="7" fill="4" visible="no" active="yes"/> | ||||
| <layer number="36" name="bGlue" color="7" fill="5" visible="no" active="yes"/> | ||||
| <layer number="37" name="tTest" color="7" fill="1" visible="no" active="yes"/> | ||||
| <layer number="38" name="bTest" color="7" fill="1" visible="no" active="yes"/> | ||||
| <layer number="39" name="tKeepout" color="4" fill="11" visible="yes" active="yes"/> | ||||
| <layer number="40" name="bKeepout" color="1" fill="11" visible="yes" active="yes"/> | ||||
| <layer number="41" name="tRestrict" color="4" fill="10" visible="yes" active="yes"/> | ||||
| <layer number="42" name="bRestrict" color="1" fill="10" visible="yes" active="yes"/> | ||||
| <layer number="43" name="vRestrict" color="2" fill="10" visible="yes" active="yes"/> | ||||
| <layer number="44" name="Drills" color="7" fill="1" visible="no" active="yes"/> | ||||
| <layer number="45" name="Holes" color="7" fill="1" visible="no" active="yes"/> | ||||
| <layer number="46" name="Milling" color="3" fill="1" visible="no" active="yes"/> | ||||
| <layer number="47" name="Measures" color="7" fill="1" visible="no" active="yes"/> | ||||
| <layer number="48" name="Document" color="7" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="49" name="Reference" color="7" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="51" name="tDocu" color="7" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="52" name="bDocu" color="7" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="91" name="Nets" color="2" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="92" name="Busses" color="1" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="93" name="Pins" color="2" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="94" name="Symbols" color="4" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="95" name="Names" color="7" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="96" name="Values" color="7" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="97" name="Info" color="7" fill="1" visible="yes" active="yes"/> | ||||
| <layer number="98" name="Guide" color="6" fill="1" visible="yes" active="yes"/> | ||||
| </layers> | ||||
| <library> | ||||
| <packages> | ||||
| <package name="TO92-EBC"> | ||||
| <wire x1="-3.81" y1="-1.905" x2="3.81" y2="-1.905" width="0.127" layer="21"/> | ||||
| <wire x1="-3.81" y1="-1.905" x2="3.81" y2="-1.905" width="0.127" layer="21" curve="-208.072487"/> | ||||
| <wire x1="-3.81" y1="-1.27" x2="3.81" y2="-1.27" width="0.127" layer="21"/> | ||||
| <text x="-1.905" y="1.27" size="1.27" layer="21">GND</text> | ||||
| <text x="-6.35" y="0" size="1.27" layer="21">VO</text> | ||||
| <text x="3.81" y="0" size="1.27" layer="21">VI</text> | ||||
| <pad name="1" x="-2.54" y="0" drill="0.8" shape="long" rot="R90"/> | ||||
| <pad name="2" x="0" y="0" drill="0.8" shape="long" rot="R90"/> | ||||
| <pad name="3" x="2.54" y="0" drill="0.8" shape="long" rot="R90"/> | ||||
| </package> | ||||
| </packages> | ||||
| <symbols> | ||||
| <symbol name="SYMBOL"> | ||||
| <description>LM78Lxx</description> | ||||
| <wire x1="-7.62" y1="2.54" x2="-7.62" y2="-5.08" width="0.254" layer="94"/> | ||||
| <wire x1="-7.62" y1="-5.08" x2="7.62" y2="-5.08" width="0.254" layer="94"/> | ||||
| <wire x1="7.62" y1="-5.08" x2="7.62" y2="2.54" width="0.254" layer="94"/> | ||||
| <wire x1="7.62" y1="2.54" x2="-7.62" y2="2.54" width="0.254" layer="94"/> | ||||
| <pin name="VI" x="-10.16" y="0" length="short"/> | ||||
| <pin name="GND" x="0" y="-7.62" length="short" rot="R90"/> | ||||
| <pin name="VO" x="10.16" y="0" length="short" rot="R180"/> | ||||
| </symbol> | ||||
| </symbols> | ||||
| <devicesets> | ||||
| <deviceset name="LM78L05"> | ||||
| <gates> | ||||
| <gate name="G$1" symbol="SYMBOL" x="0" y="0"/> | ||||
| </gates> | ||||
| <devices> | ||||
| <device name="EBC" package="TO92-EBC"> | ||||
| <connects> | ||||
| <connect gate="G$1" pin="GND" pad="2"/> | ||||
| <connect gate="G$1" pin="VI" pad="3"/> | ||||
| <connect gate="G$1" pin="VO" pad="1"/> | ||||
| </connects> | ||||
| <technologies> | ||||
| <technology name=""/> | ||||
| </technologies> | ||||
| </device> | ||||
| </devices> | ||||
| </deviceset> | ||||
| </devicesets> | ||||
| </library> | ||||
| </drawing> | ||||
| </eagle> | ||||
		Reference in New Issue
	
	Block a user