1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
<Comment>;********************************************************************</Comment><br/>
<Comment>;* LED flasher: LED will flash with a X on/off ratio at PD6</Comment><br/>
<Comment>;*</Comment><br/>
<Comment>;* </Comment><Alert Level 3>NOTE</Alert Level 3><Comment>: delay depends in the value of X, 1 is fast, 255 is slow</Comment><br/>
<Comment>;*</Comment><br/>
<Comment>;* No copyright ©1998 RES® * FREEWARE *</Comment><br/>
<Comment>;*</Comment><br/>
<Comment>;* </Comment><Alert Level 3>NOTE</Alert Level 3><Comment>: Connect a low current LED with a 1k resistor in serie from </Comment><br/>
<Comment>;* Vdd to pin 11 of the MCU. (Or a normal LED with a 330ohm)</Comment><br/>
<Comment>;* </Comment><br/>
<Comment>;* RES® can be reached by email: digitalaudio@mail.com </Comment><br/>
<Comment>;* or visit the website: http://home.wanadoo.nl/electro1/avr</Comment><br/>
<Comment>;*</Comment><br/>
<Comment>;* Version :1.0 </Comment><br/>
<Comment>;* Date :12/26/98</Comment><br/>
<Comment>;* Author :Rob's ElectroSoft®</Comment><br/>
<Comment>;* Target MCU :AT90S1200-12PI@4MHz </Comment><br/>
<Comment>;********************************************************************</Comment><br/>
<Normal Text></Normal Text><br/>
<Directive>.include</Directive><Normal Text> </Normal Text><String>"1200def.inc"</String><br/>
<Normal Text></Normal Text><br/>
<Normal Text> </Normal Text><Branch Instructions>rjmp</Branch Instructions><Normal Text> RESET </Normal Text><Comment>;reset handle</Comment><br/>
<Normal Text></Normal Text><br/>
<Normal Text></Normal Text><br/>
<Comment>;* Long delay </Comment><br/>
<Normal Text></Normal Text><br/>
<Comment>;* Register variables</Comment><br/>
<Normal Text></Normal Text><br/>
<Normal Text> </Normal Text><Directive>.def</Directive><Normal Text> T1 </Normal Text><Symbol>=</Symbol><Normal Text> r1</Normal Text><br/>
<Normal Text> </Normal Text><Directive>.def</Directive><Normal Text> T2 </Normal Text><Symbol>=</Symbol><Normal Text> r2</Normal Text><br/>
<Normal Text> </Normal Text><Directive>.def</Directive><Normal Text> temp </Normal Text><Symbol>=</Symbol><Normal Text> r19</Normal Text><br/>
<Normal Text></Normal Text><br/>
<Comment>;* Code</Comment><br/>
<Normal Text> </Normal Text><br/>
<Label>longDelay:</Label><Normal Text> </Normal Text><br/>
<Normal Text> </Normal Text><Keyword>clr</Keyword><Normal Text> T1 </Normal Text><Comment>;T1 used as delay 2nd count</Comment><br/>
<Normal Text> </Normal Text><Keyword>clr</Keyword><Normal Text> T2 </Normal Text><Comment>;T2 used as delay 3d count</Comment><br/>
<Label>delay_1:</Label><Normal Text> </Normal Text><br/>
<Normal Text> </Normal Text><Keyword>dec</Keyword><Normal Text> T2</Normal Text><br/>
<Normal Text> </Normal Text><Branch Instructions>brne</Branch Instructions><Normal Text> delay_1 </Normal Text><br/>
<Normal Text> </Normal Text><Keyword>dec</Keyword><Normal Text> T1</Normal Text><br/>
<Normal Text> </Normal Text><Branch Instructions>brne</Branch Instructions><Normal Text> delay_1 </Normal Text><br/>
<Normal Text> </Normal Text><Keyword>dec</Keyword><Normal Text> temp </Normal Text><Comment>;temp must be preset as </Comment><br/>
<Normal Text> </Normal Text><Branch Instructions>brne</Branch Instructions><Normal Text> delay_1 </Normal Text><Comment>; delay master count</Comment><br/>
<Normal Text> </Normal Text><Branch Instructions>ret</Branch Instructions><Normal Text> </Normal Text><br/>
<Normal Text></Normal Text><br/>
<Normal Text></Normal Text><br/>
<Comment>;* Resets the data direction register D</Comment><br/>
<Normal Text></Normal Text><br/>
<Comment>;* Defines</Comment><br/>
<Normal Text></Normal Text><br/>
<Normal Text> </Normal Text><Directive>.equ</Directive><Normal Text> led </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Decimal>6</Decimal><Normal Text> </Normal Text><Comment>;LED at PD6</Comment><br/>
<Normal Text></Normal Text><br/>
<Comment>;* Code</Comment><br/>
<Normal Text></Normal Text><br/>
<Label>RESET:</Label><br/>
<Normal Text> </Normal Text><Keyword>sbi</Keyword><Normal Text> DDRD</Normal Text><Symbol>,</Symbol><Normal Text> led </Normal Text><Comment>;connect LED to PORTD pin 6</Comment><br/>
<Normal Text> </Normal Text><br/>
<Normal Text></Normal Text><br/>
<Comment>;* Main program</Comment><br/>
<Normal Text></Normal Text><br/>
<Comment>;* This part will let the LED go on and off by X</Comment><br/>
<Normal Text></Normal Text><br/>
<Comment>;* Register variables</Comment><br/>
<Normal Text></Normal Text><br/>
<Normal Text> </Normal Text><Directive>.equ</Directive><Normal Text> X </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Decimal>10</Decimal><Normal Text> </Normal Text><Comment>;enter delaytime X</Comment><br/>
<Normal Text></Normal Text><br/>
<Label>flash:</Label><Normal Text> </Normal Text><br/>
<Normal Text> </Normal Text><Keyword>sbi</Keyword><Normal Text> PORTD</Normal Text><Symbol>,</Symbol><Normal Text> led </Normal Text><Comment>;LED on</Comment><br/>
<Normal Text> </Normal Text><Keyword>ldi</Keyword><Normal Text> temp</Normal Text><Symbol>,</Symbol><Normal Text> X </Normal Text><Comment>;X sec delay </Comment><br/>
<Normal Text> </Normal Text><Branch Instructions>rcall</Branch Instructions><Normal Text> longDelay </Normal Text><br/>
<Normal Text> </Normal Text><Keyword>cbi</Keyword><Normal Text> PORTD</Normal Text><Symbol>,</Symbol><Normal Text> led </Normal Text><Comment>;LED off </Comment><br/>
<Normal Text> </Normal Text><Keyword>ldi</Keyword><Normal Text> temp</Normal Text><Symbol>,</Symbol><Normal Text> X </Normal Text><Comment>;X sec delay</Comment><br/>
<Normal Text> </Normal Text><Branch Instructions>rcall</Branch Instructions><Normal Text> longDelay</Normal Text><br/>
<Normal Text> </Normal Text><Branch Instructions>rjmp</Branch Instructions><Normal Text> flash </Normal Text><Comment>;another run</Comment><br/>
<Normal Text></Normal Text><br/>
<Comment>/* other </Comment><br/>
<Comment>tests */</Comment><br/>
<Normal Text></Normal Text><br/>
<Directive>.org</Directive><Normal Text> LARGEBOOTSTART</Normal Text><br/>
<Comment>; the following sets up RAMPZ:Z to point to a FLASH data object, typically</Comment><br/>
<Comment>; for use with ELPM.</Comment><br/>
<Keyword>ldi</Keyword><Normal Text> ZL</Normal Text><Symbol>,</Symbol><Normal Text> </Normal Text><Function>low</Function><Normal Text> </Normal Text><Symbol>(</Symbol><Normal Text>cmdtable </Normal Text><Symbol>*</Symbol><Normal Text> </Normal Text><Decimal>2</Decimal><Symbol>)</Symbol><br/>
<Keyword>ldi</Keyword><Normal Text> ZH</Normal Text><Symbol>,</Symbol><Normal Text> </Normal Text><Function>high</Function><Normal Text> </Normal Text><Symbol>(</Symbol><Normal Text>cmdtable </Normal Text><Symbol>*</Symbol><Normal Text> </Normal Text><Decimal>2</Decimal><Symbol>)</Symbol><br/>
<Directive>.if</Directive><Normal Text> </Normal Text><Symbol>((</Symbol><Normal Text>cmdtable </Normal Text><Symbol>*</Symbol><Normal Text> </Normal Text><Decimal>2</Decimal><Symbol>)</Symbol><Normal Text> </Normal Text><Symbol>></Symbol><Normal Text> </Normal Text><Decimal>65535</Decimal><Symbol>)</Symbol><br/>
<Keyword>ldi</Keyword><Normal Text> r16</Normal Text><Symbol>,</Symbol><Normal Text> </Normal Text><Decimal>1</Decimal><br/>
<Keyword>sts</Keyword><Normal Text> RAMPZ</Normal Text><Symbol>,</Symbol><Normal Text> r16</Normal Text><br/>
<Directive>.endif</Directive><br/>
<Comment>; more code follows here</Comment><br/>
<Label>cmdtable:</Label><Normal Text> </Normal Text><Directive>.db</Directive><Normal Text> </Normal Text><String>"foo"</String><Symbol>,</Symbol><Normal Text> </Normal Text><Hex>0x0</Hex><br/>
<Directive>.db</Directive><Normal Text> </Normal Text><String>"Hello</String><String Char>\n</String Char><String>"</String><Normal Text> </Normal Text><Comment>// is equivalent to:</Comment><br/>
<Directive>.db</Directive><Normal Text> </Normal Text><Char>'H'</Char><Symbol>,</Symbol><Normal Text> </Normal Text><Char>'e'</Char><Symbol>,</Symbol><Normal Text> </Normal Text><Char>'l'</Char><Symbol>,</Symbol><Normal Text> </Normal Text><Char>'l'</Char><Symbol>,</Symbol><Normal Text> </Normal Text><Char>'o'</Char><Symbol>,</Symbol><Normal Text> </Normal Text><Char>'\\'</Char><Symbol>,</Symbol><Normal Text> </Normal Text><Char>'n'</Char><br/>
<Directive>.db</Directive><Normal Text> </Normal Text><Char>'\0'</Char><Symbol>,</Symbol><Normal Text> </Normal Text><Char>'\177'</Char><Symbol>,</Symbol><Normal Text> </Normal Text><Char>'\xff'</Char><br/>
<Directive>.db</Directive><Normal Text> </Normal Text><String>"</String><String Char>\n</String Char><String>x</String><String Char>\r</String Char><String>x</String><String Char>\a</String Char><String>x</String><String Char>\b</String Char><String>x</String><String Char>\f</String Char><String>x</String><String Char>\t</String Char><String>x</String><String Char>\v</String Char><String>x</String><String Char>\\</String Char><String>x</String><String Char>\000</String Char><String>0</String><String Char>\xff</String Char><String>f</String><String Char>\0\1</String Char><String>"</String><br/>
<Binary>0b10_111_</Binary><Normal Text>2 </Normal Text><Hex>0xaf3_4</Hex><Normal Text> </Normal Text><Octal>0_12</Octal><Normal Text> </Normal Text><Decimal>32_32</Decimal><Normal Text> </Normal Text><Hex>$32_3</Hex><br/>
<Normal Text></Normal Text><br/>
<Directive>.macro</Directive><Normal Text> m</Normal Text><br/>
<Keyword>ldi</Keyword><Normal Text> </Normal Text><Referred Macro Parameter>@0</Referred Macro Parameter><Symbol>,</Symbol><Normal Text> </Normal Text><Referred Macro Parameter>@1</Referred Macro Parameter><br/>
<Directive>.endm</Directive><Normal Text> m r16</Normal Text><Symbol>,\</Symbol><Normal Text> </Normal Text><Decimal>0</Decimal><br/>
<Normal Text></Normal Text><br/>
<Preprocessor>#define</Preprocessor><Normal Text> </Normal Text><Preprocessor>TEST</Preprocessor><Normal Text> </Normal Text><Symbol>\</Symbol><br/>
<Directive>.IF</Directive><Normal Text> </Normal Text><Preprocessor>val</Preprocessor><Normal Text> </Normal Text><Symbol>\</Symbol><br/>
<Directive>.DW</Directive><Normal Text> </Normal Text><Constant>__TIME__</Constant><Normal Text> </Normal Text><Symbol>\</Symbol><br/>
<Directive>.ELSE</Directive><Normal Text> </Normal Text><Symbol>\</Symbol><br/>
<Directive>.DW</Directive><Normal Text> </Normal Text><Decimal>1</Decimal><Normal Text> </Normal Text><Symbol>\</Symbol><br/>
<Directive>.ENDIF</Directive><br/>
<Normal Text></Normal Text><br/>
<Preprocessor>#</Preprocessor><Unknown Preprocessor>defi</Unknown Preprocessor><Normal Text> </Normal Text><Preprocessor>TEST</Preprocessor><br/>
|