Why debugging "continue" jump out of forever while( 1 ) {}loop ?

Go To Last Post
24 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sir./Madam,

Could you please help me in reviewing the following to find the reason why debugging "continue" button always jumps out of the while loop to hit the break point.

Is it IRS related ?

Sincerely,
Liu Wang

int main(void)
{
...
_delay_us( 2000 );

//Read PSU FRU data
for ( i = 0x00; i < 0x100; i++ )
{
_delay_us( 8 );
read_bytes( &( superMicroI2CFRU2[ i ] ), 1, 0x72, i );
}

HeartBeatInit();//Stub a Break point here.
TWI_initializeBPN_SAS3_827HQ();
PWMInit( );
TACHOInit( );
TempInit( );

while (1)
{
PWMMonitorAndControl();
}
return 1;
}

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Maybe the device does a reset and starts over? Do you use watchdog or any external reset sources?

/Jakob Selbing

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What version of Atmel Studio are you running?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

liu wang wrote:
Is it IRS related ?

 

Sorry we can't solve your TAX problems here.

 

Could you have enabled an interrupt for which you don't have an ISR handler for it?

 

Jim

 

 

Keys to wealth:

Invest for cash flow, not capital gains!

Wealth is attracted, not chased! 

Income is proportional to how many you serve!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What does PWMMonitorAndControl() do?  It may have been optimized away.  

Greg Muth

Portland, OR, US

Xplained/Pro/Mini Boards mostly

 

Make Xmega Great Again!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My question re version of Studio is because we found out the other day that there is a bug in binutils in the toolchaibn that comes with current (7.0.1417) Studio 7. It has to do with "linker relaxation" making debug info "skewed" w r t generated code. ("Linker relaxation" is a "late optimization").

 

A temporary solution might be to turn off linker relaxation. There is a setting for it in Atmel Studios settings for GCC projects.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
My question re version of Studio is because we found out the other day...

 

At this point, my comments are just anecdotal.  I'll typically only use GCC and Studio Simulator for issues posted here, creating tiny test programs.

 

I also have [anecdotally] noticed the simulator cursor disappearing inside the infinite loop.  This includes empty while(1){}.  Disassembly view shows the RJMP to itself.

 

I haven't looked into the relax settings, but it seems strang that the linker is involved in heavy stuff to "improve" a trivial program.

 

I'll have to confirm, but I thoght that 6.x whould show the cursor on the while and step-step-step.

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Since time immemorial the yellow arrow has always disappeared into the RJMP of a while(1).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
I haven't looked into the relax settings, but it seems strang that the linker is involved in heavy stuff to "improve" a trivial program.

 

As I said, "relaxation" is a link time optimization. As I understand it, it replaces e.g.JMPs with RJMPs. I could envision that happening to a very simple program. Since the debug info is created before the linker does it's deed, it has to be compensated for this  - either beforehand or after the fact (I don't know which).

 

As I understand the reported bug, it is in binutils and somehow causes the debug info to be offset w.r.t the generated code. E.g. linker replaces JMP with RJMP, all code after that is "relocated -1 byte", debug info is not compensated (or badly compensated) to reflect this fact. Net effect is that the "current position" while debugging is constantly ahead/behind what is actually executed.

 

I didn't claim every "strange" debugging experience was to be blamed on this. But the bug is a fact and confirmed by people with great authority on the matter. It is a fact that moving from AS6 to AS7 in some cases makes the debugging experience degenerate considerably. It is a fact that turning off relaxation has been proven to better the debug experience for some of these cases.

 

It's OK to be a surly curmudgeon, but don't be anecdotal. Anecdotes are of your infamous "infinite value" since they cost nothing to emit. ;-)

 

Read for yourself: http://www.circuitvalley.com/201... . See especially #28 for what converts this from a fuzzy roumor or noob false speculation into a fact.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Sun. Jul 30, 2017 - 03:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
Anecdotes are of your infamous "infinite value" since they cost nothing to emit.

[surly curmudgeon mode]  Indeed, another apparent example of infinite-value toolchain.

 

clawson wrote:
Since time immemorial ...

I just love those superlatives...

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Sun. Jul 30, 2017 - 04:16 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Whether tis superlative kind of depends on how good your memory is. Alcohol deadens mine ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
 There is a setting for it in Atmel Studios settings for GCC projects.

That must be the optimization level -Og - Optimize Debugging Experience?  

 

Why do I keep thinking about going back to AS6.2

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MarkThomas wrote:
Why do I keep thinking about going back to AS6.2

What difference would it make?

clawson wrote:
Since time immemorial the yellow arrow has always disappeared into the RJMP of a while(1).

Can't wait to get back to the office... ;)  Easier there than with PCanywhere.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MarkThomas wrote:
JohanEkdahl wrote:  There is a setting for it in Atmel Studios settings for GCC projects.

 

That must be the optimization level -Og - Optimize Debugging Experience?  

 

No, there's a setting specifically for relaxation. As Cliff explains in the thread I linked to, that is there because both the compiler and the linker needs to know if relaxation is to be done or not. If one gets it and the other doesn't then thing will go sour. 

 

Why not go read the thread and then decide if you still want to jump the gun? [rolls eyes]

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Back on Windows.. Here's the setting - in project Properties, select Toolchain, then under AVR/GNU Common, select General and there is a check-box for branch relaxation:

 

 

In the thread I linked to above some users have had better debug experiences after un-checking this option.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In my installation of VS7 (7.0.1417) that box is unchecked by default.  

 

For debugging, do we choose optimization -O0, which seems to be the usual default choice for debugging, or the -Og:  Optimize Debugging Experience?  I guess -Og would be the obvious choice.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oops.  Wrong again.  If I choose Debug the optimization changes to -O1.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MarkThomas wrote:
For debugging, do we choose optimization -O0 [...]?

 

No, -O0 is more or less meaningless since the generated code is very far from what any of the other optimization settings will produce. Highly inefficient code. Call it de-generated code if you like.

 

I see no golden setting that fits all when it comes to the most pleasant debugging experience. You have to tinker with settings, and be aware of what consequences this tinkering has.

 

  • If the debugging experience in Atmel Studio 7 gets better when unchecking the relaxation setting then probably leave it like that until the bug in binutils is integrated in a new build of the toolchain.
  • Possibly fiddle with optimization levels, but stay away from -O0.

 

The choice of optimization ultimately does not end with debugging. What optimization is best for you when building the final firmware (e.g. for production)? I speculate that -Os is the best fit many situations, but it just might be that -O3 produces faster code at the expense of higher flash/RAM consumption. AFAIK there's no other way than to try the alternatives out and decide in each individual project. If the -O1 makes for the most pleasant debug experience, then by all means set that one in the "Debug" build configuration. Another choice might be wiser/better for the "Release" build configuration, though.

 

But stay away from -O0. It has been said that it is nothing but a (non-)optimization level that only the compiler developers has any use of. The code generated is horrible.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My installation of VS6.2 has the relaxation box checked by default.  I never use -O0, and like -Os for release builds.  I tend to use the default value for debugging (-O1 in this case), figuring the builders of AS7 know better than I, but I guess I will have to play around with settings now that Johan has suggested it, even if he does roll his eyes at me and makes me feel bad.  I guess I can also compare debugging experiences between AS6.2 and AS7.0 and just use the one that works best for me.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sir./Madam,

 

Appreciate all your experts comments. Sorry for late feedback.

More comments will be appreciated.

 

This issue is still in my way.

 

1. Checked WDT is not enabled.

2. Checked not hardware reset generated outside of the Atxmega128A1U under testing.

3. Atmel Studio 7.0.1417 is used.

4. Enabled all level ISR but middle level ISR is not deployed. Would it be a concern ? Will double check.

5. Setting -O0 makes the longer time to jump out of forever while(1) loop but blocks TWI peripheral operation.

6. Relax Branches was not checked. 

7. Checking Relax Branches box separates the red dot break point and the yellow error.

 

Sincerely,

Liu Wang

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

liu wang wrote:
7. Checking Relax Branches box separates the red dot break point and the yellow error.
But that's surely the point - there is an issue if you use -mrelax. If you avoid it the problem goes away.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson,

 

Appreciate the point.

Unchecked the relaxing and debugging keep jump out of the while(1) forever loop and zero out my data buffer.

 

Comments are all appreciated.

 

Disassembly dumped for your info.

 

Sincerely,

Liu Wang

 

 

Disassembly dump:

 

00000000  JMP 0x000000FE Jump 

00000002  JMP 0x00000124 Jump 

00000004  JMP 0x00000124 Jump 

00000006  JMP 0x00000124 Jump 

00000008  JMP 0x00000124 Jump 

0000000A  JMP 0x00000124 Jump 

0000000C  JMP 0x00000124 Jump 

0000000E  JMP 0x00000124 Jump 

00000010  JMP 0x00000124 Jump 

00000012  JMP 0x00000124 Jump 

00000014  JMP 0x00000124 Jump 

00000016  JMP 0x00000124 Jump 

00000018  JMP 0x00000596 Jump 

0000001A  JMP 0x00000124 Jump 

0000001C  JMP 0x00000151 Jump 

0000001E  JMP 0x00000124 Jump 

00000020  JMP 0x00000124 Jump 

00000022  JMP 0x00000124 Jump 

00000024  JMP 0x00000124 Jump 

00000026  JMP 0x00000124 Jump 

00000028  JMP 0x00000124 Jump 

0000002A  JMP 0x00000124 Jump 

0000002C  JMP 0x00000124 Jump 

0000002E  JMP 0x00000124 Jump 

00000030  JMP 0x00000124 Jump 

00000032  JMP 0x00000124 Jump 

00000034  JMP 0x00000124 Jump 

00000036  JMP 0x00000124 Jump 

00000038  JMP 0x00000124 Jump 

0000003A  JMP 0x00000124 Jump 

0000003C  JMP 0x00000124 Jump 

0000003E  JMP 0x00000124 Jump 

00000040  JMP 0x00000124 Jump 

00000042  JMP 0x00000124 Jump 

00000044  JMP 0x00000124 Jump 

00000046  JMP 0x00000124 Jump 

00000048  JMP 0x00000124 Jump 

0000004A  JMP 0x00000124 Jump 

0000004C  JMP 0x00000124 Jump 

0000004E  JMP 0x00000124 Jump 

00000050  JMP 0x00000124 Jump 

00000052  JMP 0x00000124 Jump 

00000054  JMP 0x00000124 Jump 

00000056  JMP 0x00000124 Jump 

00000058  JMP 0x00000124 Jump 

0000005A  JMP 0x000006AC Jump 

0000005C  JMP 0x00000124 Jump 

0000005E  JMP 0x00000124 Jump 

00000060  JMP 0x00000124 Jump 

00000062  JMP 0x00000124 Jump 

00000064  JMP 0x00000124 Jump 

00000066  JMP 0x00000124 Jump 

00000068  JMP 0x00000124 Jump 

0000006A  JMP 0x00000124 Jump 

0000006C  JMP 0x00000124 Jump 

0000006E  JMP 0x00000124 Jump 

00000070  JMP 0x00000124 Jump 

00000072  JMP 0x00000124 Jump 

00000074  JMP 0x00000124 Jump 

00000076  JMP 0x00000124 Jump 

00000078  JMP 0x00000124 Jump 

0000007A  JMP 0x00000124 Jump 

0000007C  JMP 0x00000124 Jump 

0000007E  JMP 0x00000124 Jump 

00000080  JMP 0x00000124 Jump 

00000082  JMP 0x00000124 Jump 

00000084  JMP 0x00000124 Jump 

00000086  JMP 0x00000124 Jump 

00000088  JMP 0x00000124 Jump 

0000008A  JMP 0x00000124 Jump 

0000008C  JMP 0x00000124 Jump 

0000008E  JMP 0x00000124 Jump 

00000090  JMP 0x00000124 Jump 

00000092  JMP 0x00000124 Jump 

00000094  JMP 0x00000124 Jump 

00000096  JMP 0x0000069C Jump 

00000098  JMP 0x00000124 Jump 

0000009A  JMP 0x00000124 Jump 

0000009C  JMP 0x00000124 Jump 

0000009E  JMP 0x00000124 Jump 

000000A0  JMP 0x00000124 Jump 

000000A2  JMP 0x00000124 Jump 

000000A4  JMP 0x00000124 Jump 

000000A6  JMP 0x00000124 Jump 

000000A8  JMP 0x00000124 Jump 

000000AA  JMP 0x00000327 Jump 

000000AC  JMP 0x0000039A Jump 

000000AE  JMP 0x00000124 Jump 

000000B0  JMP 0x00000124 Jump 

000000B2  JMP 0x00000124 Jump 

000000B4  JMP 0x00000124 Jump 

000000B6  JMP 0x00000124 Jump 

000000B8  JMP 0x00000124 Jump 

000000BA  JMP 0x00000124 Jump 

000000BC  JMP 0x00000124 Jump 

000000BE  JMP 0x00000124 Jump 

000000C0  JMP 0x00000124 Jump 

000000C2  JMP 0x00000124 Jump 

000000C4  JMP 0x00000124 Jump 

000000C6  JMP 0x00000124 Jump 

000000C8  JMP 0x00000124 Jump 

000000CA  JMP 0x00000124 Jump 

000000CC  JMP 0x00000124 Jump 

000000CE  JMP 0x00000124 Jump 

000000D0  JMP 0x00000124 Jump 

000000D2  JMP 0x00000124 Jump 

000000D4  JMP 0x000006BC Jump 

000000D6  JMP 0x00000124 Jump 

000000D8  JMP 0x00000124 Jump 

000000DA  JMP 0x00000124 Jump 

000000DC  JMP 0x00000124 Jump 

000000DE  JMP 0x00000124 Jump 

000000E0  JMP 0x00000124 Jump 

000000E2  JMP 0x00000124 Jump 

000000E4  JMP 0x00000124 Jump 

000000E6  JMP 0x00000124 Jump 

000000E8  JMP 0x00000124 Jump 

000000EA  JMP 0x00000124 Jump 

000000EC  JMP 0x00000124 Jump 

000000EE  JMP 0x00000124 Jump 

000000F0  JMP 0x00000124 Jump 

000000F2  JMP 0x00000124 Jump 

000000F4  JMP 0x00000124 Jump 

000000F6  JMP 0x00000124 Jump 

000000F8  JMP 0x00000124 Jump 

000000FA  JMP 0x00000124 Jump 

000000FC  JMP 0x00000124 Jump 

--- ../../../../crt1/gcrt1.S ---------------------------------------------------

000000FE  CLR R1 Clear Register 

000000FF  OUT 0x3F,R1 Out to I/O location 

00000100  SER R28 Set Register 

00000101  OUT 0x3D,R28 Out to I/O location 

00000102  LDI R29,0x3F Load immediate 

00000103  OUT 0x3E,R29 Out to I/O location 

00000104  LDI R16,0x00 Load immediate 

00000105  OUT 0x3C,R16 Out to I/O location 

00000106  OUT 0x38,R1 Out to I/O location 

00000107  OUT 0x39,R1 Out to I/O location 

00000108  OUT 0x3A,R1 Out to I/O location 

--- ../../../../crt1/gcrt1.S ---------------------------------------------------

00000109  OUT 0x3B,R1 Out to I/O location 

--- No source file -------------------------------------------------------------

0000010A  LDI R17,0x20 Load immediate 

0000010B  LDI R26,0x00 Load immediate 

0000010C  LDI R27,0x20 Load immediate 

0000010D  LDI R30,0x3C Load immediate 

0000010E  LDI R31,0x0E Load immediate 

0000010F  LDI R16,0x00 Load immediate 

00000110  OUT 0x3B,R16 Out to I/O location 

00000111  RJMP PC+0x0003 Relative jump 

00000112  ELPM R0,Z+ Extended load program memory and postincrement 

00000113  ST X+,R0 Store indirect and postincrement 

00000114  CPI R26,0x00 Compare with immediate 

00000115  CPC R27,R17 Compare with carry 

00000116  BRNE PC-0x04 Branch if not equal 

00000117  OUT 0x3B,R1 Out to I/O location 

00000118  LDI R18,0x28 Load immediate 

00000119  LDI R26,0x00 Load immediate 

0000011A  LDI R27,0x20 Load immediate 

0000011B  RJMP PC+0x0002 Relative jump 

0000011C  ST X+,R1 Store indirect and postincrement 

0000011D  CPI R26,0x49 Compare with immediate 

0000011E  CPC R27,R18 Compare with carry 

0000011F  BRNE PC-0x03 Branch if not equal 

--- ../../../../crt1/gcrt1.S ---------------------------------------------------

00000120  CALL 0x00000179 Call subroutine 

00000122  JMP 0x0000071C Jump 

00000124  JMP 0x00000000 Jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././HeartBeat.c 

{

  //LE1 heart beat control

  cli();

00000126  CLI Global Interrupt Disable 

  PORTA.DIRSET = 0x01; //out, control LE1, heart beat

00000127  LDI R24,0x01 Load immediate 

00000128  STS 0x0601,R24 Store direct to data space 

  OSC.CTRL |= OSC_RC32MRDY_bm; //enable 32 MHz internal oscillator

0000012A  LDI R30,0x50 Load immediate 

0000012B  LDI R31,0x00 Load immediate 

0000012C  LDD R24,Z+0 Load indirect with displacement 

0000012D  ORI R24,0x02 Logical OR with immediate 

0000012E  STD Z+0,R24 Store indirect with displacement 

  while( ! ( OSC.STATUS & OSC_RC32MRDY_bm ) ); // wait 32 MHz internal oscillator ready

0000012F  LDD R24,Z+1 Load indirect with displacement 

00000130  SBRS R24,1 Skip if bit in register set 

00000131  RJMP PC-0x0002 Relative jump 

  CCP = CCP_IOREG_gc;

00000132  LDI R24,0xD8 Load immediate 

00000133  OUT 0x34,R24 Out to I/O location 

  CLK.CTRL = 0x01; //liu 20170207 select 32MHz internal oscillator. 0x02; //select 32 KHz internal oscillator;

00000134  LDI R24,0x01 Load immediate 

00000135  STS 0x0040,R24 Store direct to data space 

  PORTA.DIRSET = 0x01;//p140 Set port A bit 0 to output.

00000137  STS 0x0601,R24 Store direct to data space 

  TCC0.CTRLA = 0x07; //p163 Set Prescaler clk/1024

00000139  LDI R30,0x00 Load immediate 

0000013A  LDI R31,0x08 Load immediate 

0000013B  LDI R24,0x07 Load immediate 

0000013C  STD Z+0,R24 Store indirect with displacement 

  TCC0.CTRLB = 0x00; //p164 Set Timer to normal mode

0000013D  STD Z+1,R1 Store indirect with displacement 

  TCC0.CTRLC = 0x00; //p165 Set to default value to disable all waveform generator.

0000013E  STD Z+2,R1 Store indirect with displacement 

  TCC0.CTRLD = 0x00;//p165 Set to default value to disable event.

0000013F  STD Z+3,R1 Store indirect with displacement 

  TCC0.CTRLE = 0x00;//p166 Set 16 bit timer / counter mode.

00000140  STD Z+4,R1 Store indirect with displacement 

  TCC0.INTCTRLA = 0x03; //set timer overflow to low level interrupt.

00000141  LDI R24,0x03 Load immediate 

00000142  STD Z+6,R24 Store indirect with displacement 

  TCC0.INTCTRLB = 0x00;//2;//adjust to high level to avoid starving. 2; //set compare / capture channel A interrupt to low level

00000143  STD Z+7,R1 Store indirect with displacement 

  TCC0.CTRLFSET = 0x00; //No force update, no lock, timer direction increase

00000144  STD Z+9,R1 Store indirect with displacement 

  TCC0.CNT = 0x0000; // Count from 0

00000145  STD Z+32,R1 Store indirect with displacement 

00000146  STD Z+33,R1 Store indirect with displacement 

  TCC0.PER = 0x7fff;// 32MHz / 1024scale / 32K PER = 1 s

00000147  SER R24 Set Register 

00000148  LDI R25,0x7F Load immediate 

00000149  STD Z+38,R24 Store indirect with displacement 

0000014A  STD Z+39,R25 Store indirect with displacement 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././HeartBeat.c 

  PMIC.CTRL |= 0x07; //enable interrupt

0000014B  LDI R30,0xA0 Load immediate 

0000014C  LDI R31,0x00 Load immediate 

0000014D  LDD R24,Z+2 Load indirect with displacement 

0000014E  ORI R24,0x07 Logical OR with immediate 

0000014F  STD Z+2,R24 Store indirect with displacement 

00000150  RET Subroutine return 

{

00000151  PUSH R1 Push register on stack 

00000152  PUSH R0 Push register on stack 

00000153  IN R0,0x3F In from I/O location 

00000154  PUSH R0 Push register on stack 

00000155  CLR R1 Clear Register 

00000156  IN R0,0x38 In from I/O location 

00000157  PUSH R0 Push register on stack 

00000158  OUT 0x38,R1 Out to I/O location 

00000159  PUSH R24 Push register on stack 

CCP = CCP_IOREG_gc;

0000015A  LDI R24,0xD8 Load immediate 

0000015B  OUT 0x34,R24 Out to I/O location 

PORTA.OUTTGL = 0x01;//toggle the heart beat bit per 1 second.

0000015C  LDI R24,0x01 Load immediate 

0000015D  STS 0x0607,R24 Store direct to data space 

reti();

0000015F  RETI Interrupt return 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././HeartBeat.c 

}

00000160  POP R24 Pop register from stack 

00000161  POP R0 Pop register from stack 

00000162  OUT 0x38,R0 Out to I/O location 

00000163  POP R0 Pop register from stack 

00000164  OUT 0x3F,R0 Out to I/O location 

00000165  POP R0 Pop register from stack 

00000166  POP R1 Pop register from stack 

00000167  RETI Interrupt return 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././main.c 

{

  unsigned int i,j;

  for ( i = 0; i < numberOfUs; i++ )

00000168  SBIW R24,0x00 Subtract immediate from word 

00000169  BRNE PC+0x0B Branch if not equal 

0000016A  RET Subroutine return 

0000016B  SUBI R18,0x01 Subtract immediate 

0000016C  SBC R19,R1 Subtract with carry 

for ( j = 0; j < 18; j++ ){};

0000016D  BRNE PC-0x02 Branch if not equal 

  for ( i = 0; i < numberOfUs; i++ )

0000016E  SUBI R20,0xFF Subtract immediate 

0000016F  SBCI R21,0xFF Subtract immediate with carry 

00000170  CP R20,R24 Compare 

00000171  CPC R21,R25 Compare with carry 

00000172  BRNE PC+0x04 Branch if not equal 

00000173  RET Subroutine return 

--- No source file -------------------------------------------------------------

00000174  LDI R20,0x00 Load immediate 

00000175  LDI R21,0x00 Load immediate 

00000176  LDI R18,0x12 Load immediate 

00000177  LDI R19,0x00 Load immediate 

00000178  RJMP PC-0x000D Relative jump 

00000179  LDI R30,0xE0 Load immediate 

0000017A  LDI R31,0x06 Load immediate 

0000017B  LDD R24,Z+0 Load indirect with displacement 

0000017C  ANDI R24,0xF0 Logical AND with immediate 

0000017D  STD Z+0,R24 Store indirect with displacement 

0000017E  LDI R24,0x0F Load immediate 

0000017F  STS 0x0700,R24 Store direct to data space 

00000181  SER R24 Set Register 

00000182  STS 0x0720,R24 Store direct to data space 

00000184  LDI R26,0x00 Load immediate 

00000185  LDI R27,0x06 Load immediate 

00000186  ADIW R26,0x04 Add immediate to word 

00000187  LD R24,X Load indirect 

00000188  SBIW R26,0x04 Subtract immediate from word 

00000189  ORI R24,0x02 Logical OR with immediate 

0000018A  ADIW R26,0x04 Add immediate to word 

0000018B  ST X,R24 Store indirect 

  if ( !( PORTH.IN & 0x01 ) )

0000018C  LDD R24,Z+8 Load indirect with displacement 

0000018D  SBRC R24,0 Skip if bit in register cleared 

0000018E  RJMP PC+0x0004 Relative jump 

PORTK.OUTCLR = 0x10; //enable 5VSB_EN1_N.

0000018F  LDI R24,0x10 Load immediate 

00000190  STS 0x0726,R24 Store direct to data space 

  if ( !( PORTH.IN & 0x02 ) )

00000192  LDS R24,0x06E8 Load direct from data space 

00000194  SBRC R24,1 Skip if bit in register cleared 

00000195  RJMP PC+0x0004 Relative jump 

 PORTK.OUTCLR = 0x20; //enable 5VSB_EN2_N.

00000196  LDI R24,0x20 Load immediate 

00000197  STS 0x0726,R24 Store direct to data space 

  if ( !( PORTH.IN & 0x04 ) )

00000199  LDS R24,0x06E8 Load direct from data space 

0000019B  SBRC R24,2 Skip if bit in register cleared 

0000019C  RJMP PC+0x0004 Relative jump 

 PORTK.OUTCLR = 0x40; //enable 5VSB_EN3_N.

0000019D  LDI R24,0x40 Load immediate 

0000019E  STS 0x0726,R24 Store direct to data space 

  if ( !( PORTH.IN & 0x08 ) )

000001A0  LDS R24,0x06E8 Load direct from data space 

000001A2  SBRC R24,3 Skip if bit in register cleared 

000001A3  RJMP PC+0x0004 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././main.c 

 PORTK.OUTCLR = 0x80; //enable 5VSB_EN4_N.

000001A4  LDI R24,0x80 Load immediate 

000001A5  STS 0x0726,R24 Store direct to data space 

  if  ( !( ( PORTJ.IN | PORTH.IN ) & 0x01 ) )

000001A7  LDS R25,0x0708 Load direct from data space 

000001A9  LDS R24,0x06E8 Load direct from data space 

000001AB  OR R24,R25 Logical OR 

000001AC  SBRC R24,0 Skip if bit in register cleared 

000001AD  RJMP PC+0x0004 Relative jump 

 PORTK.OUTSET = 0x01;

000001AE  LDI R24,0x01 Load immediate 

000001AF  STS 0x0725,R24 Store direct to data space 

  if  ( !( ( PORTJ.IN | PORTH.IN ) & 0x02 ) )

000001B1  LDS R25,0x0708 Load direct from data space 

000001B3  LDS R24,0x06E8 Load direct from data space 

000001B5  OR R24,R25 Logical OR 

000001B6  SBRC R24,1 Skip if bit in register cleared 

000001B7  RJMP PC+0x0004 Relative jump 

 PORTK.OUTSET = 0x02;

000001B8  LDI R24,0x02 Load immediate 

000001B9  STS 0x0725,R24 Store direct to data space 

  if  ( !( ( PORTJ.IN | PORTH.IN ) & 0x04 ) )

000001BB  LDS R25,0x0708 Load direct from data space 

000001BD  LDS R24,0x06E8 Load direct from data space 

000001BF  OR R24,R25 Logical OR 

000001C0  SBRC R24,2 Skip if bit in register cleared 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././main.c 

000001C1  RJMP PC+0x0004 Relative jump 

 PORTK.OUTSET = 0x04;

000001C2  LDI R24,0x04 Load immediate 

000001C3  STS 0x0725,R24 Store direct to data space 

  if  ( !( ( PORTJ.IN | PORTH.IN ) & 0x08 ) )

000001C5  LDS R25,0x0708 Load direct from data space 

000001C7  LDS R24,0x06E8 Load direct from data space 

000001C9  OR R24,R25 Logical OR 

000001CA  SBRC R24,3 Skip if bit in register cleared 

000001CB  RJMP PC+0x0004 Relative jump 

 PORTK.OUTSET = 0x08;

000001CC  LDI R24,0x08 Load immediate 

000001CD  STS 0x0725,R24 Store direct to data space 

  ADCA_CTRLA = 0x03;

000001CF  LDI R24,0x03 Load immediate 

000001D0  STS 0x0200,R24 Store direct to data space 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

000001D2  LDI R24,0x3F Load immediate 

000001D3  LDI R25,0x1F Load immediate 

000001D4  SBIW R24,0x01 Subtract immediate from word 

000001D5  BRNE PC-0x01 Branch if not equal 

000001D6  RJMP PC+0x0001 Relative jump 

000001D7  NOP No operation 

000001D8  LDI R28,0x02 Load immediate 

000001D9  LDI R29,0x20 Load immediate 

000001DA  MOV R0,R31 Copy register 

000001DB  LDI R31,0x02 Load immediate 

000001DC  MOV R14,R31 Copy register 

000001DD  LDI R31,0x21 Load immediate 

000001DE  MOV R15,R31 Copy register 

000001DF  MOV R31,R0 Copy register 

000001E0  LDI R17,0x00 Load immediate 

000001E1  LDI R25,0x55 Load immediate 

000001E2  DEC R25 Decrement 

000001E3  BRNE PC-0x01 Branch if not equal 

000001E4  NOP No operation 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././main.c 

read_bytes( &( superMicroI2CFRU2[ i ] ), 1, 0x72, i );

000001E5  MOV R18,R17 Copy register 

000001E6  LDI R20,0x72 Load immediate 

000001E7  LDI R22,0x01 Load immediate 

000001E8  MOVW R24,R28 Copy register pair 

000001E9  CALL 0x00000516 Call subroutine 

000001EB  ADIW R28,0x01 Add immediate to word 

000001EC  SUBI R17,0xFF Subtract immediate 

  for ( i = 0x00; i < 0x100; i++ )

000001ED  CP R28,R14 Compare 

000001EE  CPC R29,R15 Compare with carry 

000001EF  BRNE PC-0x0E Branch if not equal 

  HeartBeatInit();

000001F0  CALL 0x00000126 Call subroutine 

  TWI_initializeBPN_SAS3_827HQ();

000001F2  CALL 0x00000578 Call subroutine 

  PWMInit( );

000001F4  CALL 0x000001FB Call subroutine 

  TACHOInit( );

000001F6  CALL 0x00000303 Call subroutine 

  TempInit( );

000001F8  CALL 0x0000040D Call subroutine 

000001FA  RJMP PC-0x0000 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././PWM.c 

{

  OSC.CTRL |= OSC_RC32MRDY_bm; //enable 32 MHz internal oscillator

000001FB  LDI R30,0x50 Load immediate 

000001FC  LDI R31,0x00 Load immediate 

000001FD  LDD R24,Z+0 Load indirect with displacement 

000001FE  ORI R24,0x02 Logical OR with immediate 

000001FF  STD Z+0,R24 Store indirect with displacement 

  while( ! ( OSC.STATUS & OSC_RC32MRDY_bm ) ); // wait 32 MHz internal oscillator ready

00000200  LDD R24,Z+1 Load indirect with displacement 

00000201  SBRS R24,1 Skip if bit in register set 

00000202  RJMP PC-0x0002 Relative jump 

  CCP = CCP_IOREG_gc;

00000203  LDI R24,0xD8 Load immediate 

00000204  OUT 0x34,R24 Out to I/O location 

  CLK.CTRL = 0x01; //select 32MHz internal oscillator.

00000205  LDI R24,0x01 Load immediate 

00000206  STS 0x0040,R24 Store direct to data space 

  TCC1.CTRLA = 0x01; //p163 Set Prescaler clk

00000208  LDI R30,0x40 Load immediate 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././PWM.c 

00000209  LDI R31,0x08 Load immediate 

0000020A  STD Z+0,R24 Store indirect with displacement 

  TCC1.CTRLB = 0x33; //p164: Set Compare Channel A|B| single slop waveform generation mode.

0000020B  LDI R24,0x33 Load immediate 

0000020C  STD Z+1,R24 Store indirect with displacement 

  PORTC_DIRSET = 0xf0;//Pot C Fan PWM control. 

0000020D  LDI R24,0xF0 Load immediate 

0000020E  STS 0x0641,R24 Store direct to data space 

  TCC1.PER = 0x51f; //p170: Set timer period 25KHz. P9 Fan spec PWM 25KHz.

00000210  LDI R24,0x1F Load immediate 

00000211  LDI R25,0x05 Load immediate 

00000212  STD Z+38,R24 Store indirect with displacement 

00000213  STD Z+39,R25 Store indirect with displacement 

  TCC1.CCABUF = 0x020C;

00000214  LDI R24,0x0C Load immediate 

00000215  LDI R25,0x02 Load immediate 

00000216  STD Z+56,R24 Store indirect with displacement 

00000217  STD Z+57,R25 Store indirect with displacement 

  TCC1.CCBBUF = 0x020C;

00000218  STD Z+58,R24 Store indirect with displacement 

00000219  STD Z+59,R25 Store indirect with displacement 

  TCC1.CCA = 0x020C;

0000021A  STD Z+40,R24 Store indirect with displacement 

0000021B  STD Z+41,R25 Store indirect with displacement 

  TCC1.CCB = 0x020C; //Default value corresponding to 40% duty cycle. 

0000021C  STD Z+42,R24 Store indirect with displacement 

0000021D  STD Z+43,R25 Store indirect with displacement 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././PWM.c 

0000021E  RET Subroutine return 

{

0000021F  PUSH R16 Push register on stack 

00000220  PUSH R17 Push register on stack 

00000221  PUSH R28 Push register on stack 

00000222  PUSH R29 Push register on stack 

  if ( ( ADCA_CH0_RES / 31 ) < 25 ) // 31 = ADC value per degree

00000223  LDS R24,0x0224 Load direct from data space 

00000225  LDS R25,0x0225 Load direct from data space 

00000227  CPI R24,0x07 Compare with immediate 

00000228  SBCI R25,0x03 Subtract immediate with carry 

00000229  BRCC PC+0x12 Branch if carry cleared 

    TCC1.CCA = 1311 * 20 / 100; //20% duty cycle

0000022A  LDI R30,0x40 Load immediate 

0000022B  LDI R31,0x08 Load immediate 

0000022C  LDI R24,0x06 Load immediate 

0000022D  LDI R25,0x01 Load immediate 

0000022E  STD Z+40,R24 Store indirect with displacement 

0000022F  STD Z+41,R25 Store indirect with displacement 

    TCC1.CCB = 1311 * 20 / 100;

00000230  STD Z+42,R24 Store indirect with displacement 

00000231  STD Z+43,R25 Store indirect with displacement 

    preADCACH0RES = ADCA_CH0_RES;

00000232  LDS R24,0x0224 Load direct from data space 

00000234  LDS R25,0x0225 Load direct from data space 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././PWM.c 

00000236  STS 0x27EB,R24 Store direct to data space 

00000238  STS 0x27EC,R25 Store direct to data space 

0000023A  RJMP PC+0x00C4 Relative jump 

  else if ( ( ADCA_CH0_RES / 31 ) > 50 )

0000023B  LDS R24,0x0224 Load direct from data space 

0000023D  LDS R25,0x0225 Load direct from data space 

0000023F  CPI R24,0x2D Compare with immediate 

00000240  SBCI R25,0x06 Subtract immediate with carry 

00000241  BRCS PC+0x12 Branch if carry set 

    TCC1.CCA = 1311; //100% duty cycle

00000242  LDI R30,0x40 Load immediate 

00000243  LDI R31,0x08 Load immediate 

00000244  LDI R24,0x1F Load immediate 

00000245  LDI R25,0x05 Load immediate 

00000246  STD Z+40,R24 Store indirect with displacement 

00000247  STD Z+41,R25 Store indirect with displacement 

    TCC1.CCB = 1311;

00000248  STD Z+42,R24 Store indirect with displacement 

00000249  STD Z+43,R25 Store indirect with displacement 

    preADCACH0RES = ADCA_CH0_RES;

0000024A  LDS R24,0x0224 Load direct from data space 

0000024C  LDS R25,0x0225 Load direct from data space 

0000024E  STS 0x27EB,R24 Store direct to data space 

00000250  STS 0x27EC,R25 Store direct to data space 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././PWM.c 

00000252  RJMP PC+0x00AC Relative jump 

  else if ( ADCA_CH0_RES > preADCACH0RES )

00000253  LDS R18,0x0224 Load direct from data space 

00000255  LDS R19,0x0225 Load direct from data space 

00000257  LDS R24,0x27EB Load direct from data space 

00000259  LDS R25,0x27EC Load direct from data space 

0000025B  CP R24,R18 Compare 

0000025C  CPC R25,R19 Compare with carry 

0000025D  BRCS PC+0x02 Branch if carry set 

0000025E  RJMP PC+0x004C Relative jump 

    TCC1.CCA = 1311 * ADCA_CH0_RES / 31 * 4; // temp vs. duty cycle slop = 4, 1311 = counter for 100% duty cycle.

0000025F  LDI R30,0x24 Load immediate 

00000260  LDI R31,0x02 Load immediate 

00000261  LDD R24,Z+0 Load indirect with displacement 

00000262  LDD R25,Z+1 Load indirect with displacement 

00000263  LDI R16,0x1F Load immediate 

00000264  LDI R17,0x05 Load immediate 

00000265  MUL R24,R16 Multiply unsigned 

00000266  MOVW R20,R0 Copy register pair 

00000267  MUL R24,R17 Multiply unsigned 

00000268  ADD R21,R0 Add without carry 

00000269  MUL R25,R16 Multiply unsigned 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././PWM.c 

0000026A  ADD R21,R0 Add without carry 

0000026B  CLR R1 Clear Register 

0000026C  MOVW R18,R20 Copy register pair 

0000026D  LDI R26,0x43 Load immediate 

0000026E  LDI R27,0x08 Load immediate 

0000026F  CALL 0x000006EB Call subroutine 

00000271  SUB R20,R24 Subtract without carry 

00000272  SBC R21,R25 Subtract with carry 

00000273  LSR R21 Logical shift right 

00000274  ROR R20 Rotate right through carry 

00000275  ADD R24,R20 Add without carry 

00000276  ADC R25,R21 Add with carry 

00000277  SWAP R25 Swap nibbles 

00000278  SWAP R24 Swap nibbles 

00000279  ANDI R24,0x0F Logical AND with immediate 

0000027A  EOR R24,R25 Exclusive OR 

0000027B  ANDI R25,0x0F Logical AND with immediate 

0000027C  EOR R24,R25 Exclusive OR 

0000027D  LSL R24 Logical Shift Left 

0000027E  ROL R25 Rotate Left Through Carry 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././PWM.c 

0000027F  LSL R24 Logical Shift Left 

00000280  ROL R25 Rotate Left Through Carry 

00000281  LDI R28,0x40 Load immediate 

00000282  LDI R29,0x08 Load immediate 

00000283  STD Y+40,R24 Store indirect with displacement 

00000284  STD Y+41,R25 Store indirect with displacement 

    TCC1.CCB = 1311 * ADCA_CH0_RES / 31 * 4;

00000285  LDD R24,Z+0 Load indirect with displacement 

00000286  LDD R25,Z+1 Load indirect with displacement 

00000287  MUL R24,R16 Multiply unsigned 

00000288  MOVW R20,R0 Copy register pair 

00000289  MUL R24,R17 Multiply unsigned 

0000028A  ADD R21,R0 Add without carry 

0000028B  MUL R25,R16 Multiply unsigned 

0000028C  ADD R21,R0 Add without carry 

0000028D  CLR R1 Clear Register 

0000028E  MOVW R18,R20 Copy register pair 

0000028F  CALL 0x000006EB Call subroutine 

00000291  SUB R20,R24 Subtract without carry 

00000292  SBC R21,R25 Subtract with carry 

00000293  LSR R21 Logical shift right 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././PWM.c 

00000294  ROR R20 Rotate right through carry 

00000295  ADD R24,R20 Add without carry 

00000296  ADC R25,R21 Add with carry 

00000297  SWAP R25 Swap nibbles 

00000298  SWAP R24 Swap nibbles 

00000299  ANDI R24,0x0F Logical AND with immediate 

0000029A  EOR R24,R25 Exclusive OR 

0000029B  ANDI R25,0x0F Logical AND with immediate 

0000029C  EOR R24,R25 Exclusive OR 

0000029D  LSL R24 Logical Shift Left 

0000029E  ROL R25 Rotate Left Through Carry 

0000029F  LSL R24 Logical Shift Left 

000002A0  ROL R25 Rotate Left Through Carry 

000002A1  STD Y+42,R24 Store indirect with displacement 

000002A2  STD Y+43,R25 Store indirect with displacement 

    preADCACH0RES = ADCA_CH0_RES;

000002A3  LDD R24,Z+0 Load indirect with displacement 

000002A4  LDD R25,Z+1 Load indirect with displacement 

000002A5  STS 0x27EB,R24 Store direct to data space 

000002A7  STS 0x27EC,R25 Store direct to data space 

000002A9  RJMP PC+0x0055 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././PWM.c 

  else if ( ( ( preADCACH0RES - ADCA_CH0_RES ) / 31 ) > 4 ) // temp decreases over 4 degree.

000002AA  LDS R18,0x0224 Load direct from data space 

000002AC  LDS R19,0x0225 Load direct from data space 

000002AE  SUB R24,R18 Subtract without carry 

000002AF  SBC R25,R19 Subtract with carry 

000002B0  CPI R24,0x9B Compare with immediate 

000002B1  CPC R25,R1 Compare with carry 

000002B2  BRCC PC+0x02 Branch if carry cleared 

000002B3  RJMP PC+0x004B Relative jump 

    TCC1.CCA = 1311 * ADCA_CH0_RES / 31 * 4;

000002B4  LDI R30,0x24 Load immediate 

000002B5  LDI R31,0x02 Load immediate 

000002B6  LDD R24,Z+0 Load indirect with displacement 

000002B7  LDD R25,Z+1 Load indirect with displacement 

000002B8  LDI R16,0x1F Load immediate 

000002B9  LDI R17,0x05 Load immediate 

000002BA  MUL R24,R16 Multiply unsigned 

000002BB  MOVW R20,R0 Copy register pair 

000002BC  MUL R24,R17 Multiply unsigned 

000002BD  ADD R21,R0 Add without carry 

000002BE  MUL R25,R16 Multiply unsigned 

000002BF  ADD R21,R0 Add without carry 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././PWM.c 

000002C0  CLR R1 Clear Register 

000002C1  MOVW R18,R20 Copy register pair 

000002C2  LDI R26,0x43 Load immediate 

000002C3  LDI R27,0x08 Load immediate 

000002C4  CALL 0x000006EB Call subroutine 

000002C6  SUB R20,R24 Subtract without carry 

000002C7  SBC R21,R25 Subtract with carry 

000002C8  LSR R21 Logical shift right 

000002C9  ROR R20 Rotate right through carry 

000002CA  ADD R24,R20 Add without carry 

000002CB  ADC R25,R21 Add with carry 

000002CC  SWAP R25 Swap nibbles 

000002CD  SWAP R24 Swap nibbles 

000002CE  ANDI R24,0x0F Logical AND with immediate 

000002CF  EOR R24,R25 Exclusive OR 

000002D0  ANDI R25,0x0F Logical AND with immediate 

000002D1  EOR R24,R25 Exclusive OR 

000002D2  LSL R24 Logical Shift Left 

000002D3  ROL R25 Rotate Left Through Carry 

000002D4  LSL R24 Logical Shift Left 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././PWM.c 

000002D5  ROL R25 Rotate Left Through Carry 

000002D6  LDI R28,0x40 Load immediate 

000002D7  LDI R29,0x08 Load immediate 

000002D8  STD Y+40,R24 Store indirect with displacement 

000002D9  STD Y+41,R25 Store indirect with displacement 

    TCC1.CCB = 1311 * ADCA_CH0_RES / 31 * 4;

000002DA  LDD R24,Z+0 Load indirect with displacement 

000002DB  LDD R25,Z+1 Load indirect with displacement 

000002DC  MUL R24,R16 Multiply unsigned 

000002DD  MOVW R20,R0 Copy register pair 

000002DE  MUL R24,R17 Multiply unsigned 

000002DF  ADD R21,R0 Add without carry 

000002E0  MUL R25,R16 Multiply unsigned 

000002E1  ADD R21,R0 Add without carry 

000002E2  CLR R1 Clear Register 

000002E3  MOVW R18,R20 Copy register pair 

000002E4  CALL 0x000006EB Call subroutine 

000002E6  SUB R20,R24 Subtract without carry 

000002E7  SBC R21,R25 Subtract with carry 

000002E8  LSR R21 Logical shift right 

000002E9  ROR R20 Rotate right through carry 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././PWM.c 

000002EA  ADD R24,R20 Add without carry 

000002EB  ADC R25,R21 Add with carry 

000002EC  SWAP R25 Swap nibbles 

000002ED  SWAP R24 Swap nibbles 

000002EE  ANDI R24,0x0F Logical AND with immediate 

000002EF  EOR R24,R25 Exclusive OR 

000002F0  ANDI R25,0x0F Logical AND with immediate 

000002F1  EOR R24,R25 Exclusive OR 

000002F2  LSL R24 Logical Shift Left 

000002F3  ROL R25 Rotate Left Through Carry 

000002F4  LSL R24 Logical Shift Left 

000002F5  ROL R25 Rotate Left Through Carry 

000002F6  STD Y+42,R24 Store indirect with displacement 

000002F7  STD Y+43,R25 Store indirect with displacement 

    preADCACH0RES = ADCA_CH0_RES;

000002F8  LDD R24,Z+0 Load indirect with displacement 

000002F9  LDD R25,Z+1 Load indirect with displacement 

000002FA  STS 0x27EB,R24 Store direct to data space 

000002FC  STS 0x27EC,R25 Store direct to data space 

}

000002FE  POP R29 Pop register from stack 

000002FF  POP R28 Pop register from stack 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././PWM.c 

00000300  POP R17 Pop register from stack 

00000301  POP R16 Pop register from stack 

00000302  RET Subroutine return 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TACHO.c 

{

cli();

00000303  CLI Global Interrupt Disable 

  TCD1.CTRLA = 0x07; //p163 pre-scaler = Clk / 1024. 

00000304  LDI R30,0x40 Load immediate 

00000305  LDI R31,0x09 Load immediate 

00000306  LDI R24,0x07 Load immediate 

00000307  STD Z+0,R24 Store indirect with displacement 

  TCD1.CTRLB = 0x30; //p164: Enable channel A, B of Timer1 on port D. Set the compare and capture channel A & B to Normal mode. 

00000308  LDI R24,0x30 Load immediate 

00000309  STD Z+1,R24 Store indirect with displacement 

  TCD1.CTRLD = 0x2c; //EVACT[2:0]: Input capture. Timer Delay bit Clear. Channel #4.

0000030A  LDI R24,0x2C Load immediate 

0000030B  STD Z+3,R24 Store indirect with displacement 

  TCD1.CTRLE = 0x00;//Timer / counter 1 in port D operate in default normal mode.

0000030C  STD Z+4,R1 Store indirect with displacement 

  PORTD_DIRCLR = 0xc0;//+Port D pin 4 and 5 for fan tachometer input. 

0000030D  LDI R24,0xC0 Load immediate 

0000030E  STS 0x0662,R24 Store direct to data space 

  PORTD_PIN2CTRL = 0x01;//Port D pin4 sense rising edge.

00000310  LDI R24,0x01 Load immediate 

00000311  STS 0x0672,R24 Store direct to data space 

  PORTD_PIN3CTRL = 0x01;//Port D pin5 sense rising edge. 

00000313  STS 0x0673,R24 Store direct to data space 

  EVSYS.CH4MUX = EVSYS_CHMUX_PORTD_PIN2_gc;

00000315  LDI R26,0x80 Load immediate 

00000316  LDI R27,0x01 Load immediate 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TACHO.c 

00000317  LDI R24,0x6A Load immediate 

00000318  ADIW R26,0x04 Add immediate to word 

00000319  ST X,R24 Store indirect 

0000031A  SBIW R26,0x04 Subtract immediate from word 

  EVSYS.CH1MUX = EVSYS_CHMUX_PORTD_PIN3_gc;

0000031B  LDI R24,0x6B Load immediate 

0000031C  ADIW R26,0x01 Add immediate to word 

0000031D  ST X,R24 Store indirect 

  TCD1.PER = 0x7FFF; //p13: AVR1306.

0000031E  SER R24 Set Register 

0000031F  LDI R25,0x7F Load immediate 

00000320  STD Z+38,R24 Store indirect with displacement 

00000321  STD Z+39,R25 Store indirect with displacement 

  TCD1.INTCTRLA = 0x00;// enable interrupt for overflow and error.

00000322  STD Z+6,R1 Store indirect with displacement 

  TCD1.INTCTRLB = 0x03; //enable interrupt channel A, B.

00000323  LDI R24,0x03 Load immediate 

00000324  STD Z+7,R24 Store indirect with displacement 

  sei();

00000325  SEI Global Interrupt Enable 

00000326  RET Subroutine return 

{

00000327  PUSH R1 Push register on stack 

00000328  PUSH R0 Push register on stack 

00000329  IN R0,0x3F In from I/O location 

0000032A  PUSH R0 Push register on stack 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TACHO.c 

0000032B  CLR R1 Clear Register 

0000032C  IN R0,0x38 In from I/O location 

0000032D  PUSH R0 Push register on stack 

0000032E  OUT 0x38,R1 Out to I/O location 

0000032F  IN R0,0x39 In from I/O location 

00000330  PUSH R0 Push register on stack 

00000331  OUT 0x39,R1 Out to I/O location 

00000332  IN R0,0x3B In from I/O location 

00000333  PUSH R0 Push register on stack 

00000334  OUT 0x3B,R1 Out to I/O location 

00000335  PUSH R12 Push register on stack 

00000336  PUSH R13 Push register on stack 

00000337  PUSH R14 Push register on stack 

00000338  PUSH R15 Push register on stack 

00000339  PUSH R18 Push register on stack 

0000033A  PUSH R19 Push register on stack 

0000033B  PUSH R20 Push register on stack 

0000033C  PUSH R21 Push register on stack 

0000033D  PUSH R22 Push register on stack 

0000033E  PUSH R23 Push register on stack 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TACHO.c 

0000033F  PUSH R24 Push register on stack 

00000340  PUSH R25 Push register on stack 

00000341  PUSH R26 Push register on stack 

00000342  PUSH R27 Push register on stack 

00000343  PUSH R30 Push register on stack 

00000344  PUSH R31 Push register on stack 

  lastCaptureA = TCD1_CCA;

00000345  LDS R24,0x0968 Load direct from data space 

00000347  LDS R25,0x0969 Load direct from data space 

00000349  MOVW R12,R24 Copy register pair 

0000034A  MOV R14,R1 Copy register 

0000034B  MOV R15,R1 Copy register 

0000034C  STS 0x27DD,R12 Store direct to data space 

0000034E  STS 0x27DE,R13 Store direct to data space 

00000350  STS 0x27DF,R14 Store direct to data space 

00000352  STS 0x27E0,R15 Store direct to data space 

  if ( !( lastCaptureA & 0x8000 ) )

00000354  TST R25 Test for Zero or Minus 

00000355  BRLT PC+0x29 Branch if less than, signed 

    halfPeriodCountA = TCD1_CCA - lastCaptureA;//in unit of 1 / 32768 (2 pow 16 ) s

00000356  LDS R18,0x0968 Load direct from data space 

00000358  LDS R19,0x0969 Load direct from data space 

0000035A  MOVW R24,R18 Copy register pair 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TACHO.c 

0000035B  LDI R26,0x00 Load immediate 

0000035C  LDI R27,0x00 Load immediate 

0000035D  MOVW R18,R24 Copy register pair 

0000035E  MOVW R20,R26 Copy register pair 

0000035F  SUB R18,R12 Subtract without carry 

00000360  SBC R19,R13 Subtract with carry 

00000361  SBC R20,R14 Subtract with carry 

00000362  SBC R21,R15 Subtract with carry 

00000363  STS 0x27D1,R18 Store direct to data space 

00000365  STS 0x27D2,R19 Store direct to data space 

00000367  STS 0x27D3,R20 Store direct to data space 

00000369  STS 0x27D4,R21 Store direct to data space 

if ( halfPeriodCountA ) fanSpeedA = 60 * 16 * 1024L / halfPeriodCountA; // rotate / min.

0000036B  CP R18,R1 Compare 

0000036C  CPC R19,R1 Compare with carry 

0000036D  CPC R20,R1 Compare with carry 

0000036E  CPC R21,R1 Compare with carry 

0000036F  BREQ PC+0x0F Branch if equal 

--- No source file -------------------------------------------------------------

00000370  LDI R22,0x00 Load immediate 

00000371  LDI R23,0x00 Load immediate 

00000372  LDI R24,0x0F Load immediate 

--- No source file -------------------------------------------------------------

00000373  LDI R25,0x00 Load immediate 

00000374  CALL 0x000006CC Call subroutine 

00000376  STS 0x27E1,R18 Store direct to data space 

00000378  STS 0x27E2,R19 Store direct to data space 

0000037A  STS 0x27E3,R20 Store direct to data space 

0000037C  STS 0x27E4,R21 Store direct to data space 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TACHO.c 

  reti();

0000037E  RETI Interrupt return 

}

0000037F  POP R31 Pop register from stack 

00000380  POP R30 Pop register from stack 

00000381  POP R27 Pop register from stack 

00000382  POP R26 Pop register from stack 

00000383  POP R25 Pop register from stack 

00000384  POP R24 Pop register from stack 

00000385  POP R23 Pop register from stack 

00000386  POP R22 Pop register from stack 

00000387  POP R21 Pop register from stack 

00000388  POP R20 Pop register from stack 

00000389  POP R19 Pop register from stack 

0000038A  POP R18 Pop register from stack 

0000038B  POP R15 Pop register from stack 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TACHO.c 

0000038C  POP R14 Pop register from stack 

0000038D  POP R13 Pop register from stack 

0000038E  POP R12 Pop register from stack 

0000038F  POP R0 Pop register from stack 

00000390  OUT 0x3B,R0 Out to I/O location 

00000391  POP R0 Pop register from stack 

00000392  OUT 0x39,R0 Out to I/O location 

00000393  POP R0 Pop register from stack 

00000394  OUT 0x38,R0 Out to I/O location 

00000395  POP R0 Pop register from stack 

00000396  OUT 0x3F,R0 Out to I/O location 

00000397  POP R0 Pop register from stack 

00000398  POP R1 Pop register from stack 

00000399  RETI Interrupt return 

{

0000039A  PUSH R1 Push register on stack 

0000039B  PUSH R0 Push register on stack 

0000039C  IN R0,0x3F In from I/O location 

0000039D  PUSH R0 Push register on stack 

0000039E  CLR R1 Clear Register 

0000039F  IN R0,0x38 In from I/O location 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TACHO.c 

000003A0  PUSH R0 Push register on stack 

000003A1  OUT 0x38,R1 Out to I/O location 

000003A2  IN R0,0x39 In from I/O location 

000003A3  PUSH R0 Push register on stack 

000003A4  OUT 0x39,R1 Out to I/O location 

000003A5  IN R0,0x3B In from I/O location 

000003A6  PUSH R0 Push register on stack 

000003A7  OUT 0x3B,R1 Out to I/O location 

000003A8  PUSH R12 Push register on stack 

000003A9  PUSH R13 Push register on stack 

000003AA  PUSH R14 Push register on stack 

000003AB  PUSH R15 Push register on stack 

000003AC  PUSH R18 Push register on stack 

000003AD  PUSH R19 Push register on stack 

000003AE  PUSH R20 Push register on stack 

000003AF  PUSH R21 Push register on stack 

000003B0  PUSH R22 Push register on stack 

000003B1  PUSH R23 Push register on stack 

000003B2  PUSH R24 Push register on stack 

000003B3  PUSH R25 Push register on stack 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TACHO.c 

000003B4  PUSH R26 Push register on stack 

000003B5  PUSH R27 Push register on stack 

000003B6  PUSH R30 Push register on stack 

000003B7  PUSH R31 Push register on stack 

lastCaptureB = TCD1_CCB;

000003B8  LDS R24,0x096A Load direct from data space 

000003BA  LDS R25,0x096B Load direct from data space 

000003BC  MOVW R12,R24 Copy register pair 

000003BD  MOV R14,R1 Copy register 

000003BE  MOV R15,R1 Copy register 

000003BF  STS 0x27E5,R12 Store direct to data space 

000003C1  STS 0x27E6,R13 Store direct to data space 

000003C3  STS 0x27E7,R14 Store direct to data space 

000003C5  STS 0x27E8,R15 Store direct to data space 

if ( !( lastCaptureB & 0x8000 ) )

000003C7  TST R25 Test for Zero or Minus 

000003C8  BRLT PC+0x29 Branch if less than, signed 

halfPeriodCountB = TCD1_CCB - lastCaptureB;//in unit of 1 / 32768 (2 pow 16 ) s

000003C9  LDS R18,0x096A Load direct from data space 

000003CB  LDS R19,0x096B Load direct from data space 

000003CD  MOVW R24,R18 Copy register pair 

000003CE  LDI R26,0x00 Load immediate 

000003CF  LDI R27,0x00 Load immediate 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TACHO.c 

000003D0  MOVW R18,R24 Copy register pair 

000003D1  MOVW R20,R26 Copy register pair 

000003D2  SUB R18,R12 Subtract without carry 

000003D3  SBC R19,R13 Subtract with carry 

000003D4  SBC R20,R14 Subtract with carry 

000003D5  SBC R21,R15 Subtract with carry 

000003D6  STS 0x27D9,R18 Store direct to data space 

000003D8  STS 0x27DA,R19 Store direct to data space 

000003DA  STS 0x27DB,R20 Store direct to data space 

000003DC  STS 0x27DC,R21 Store direct to data space 

if ( halfPeriodCountB ) fanSpeedB = 60 * 16 * 1024L / halfPeriodCountB; // rotate / min.

000003DE  CP R18,R1 Compare 

000003DF  CPC R19,R1 Compare with carry 

000003E0  CPC R20,R1 Compare with carry 

000003E1  CPC R21,R1 Compare with carry 

000003E2  BREQ PC+0x0F Branch if equal 

--- No source file -------------------------------------------------------------

000003E3  LDI R22,0x00 Load immediate 

000003E4  LDI R23,0x00 Load immediate 

000003E5  LDI R24,0x0F Load immediate 

000003E6  LDI R25,0x00 Load immediate 

000003E7  CALL 0x000006CC Call subroutine 

--- No source file -------------------------------------------------------------

000003E9  STS 0x27D5,R18 Store direct to data space 

000003EB  STS 0x27D6,R19 Store direct to data space 

000003ED  STS 0x27D7,R20 Store direct to data space 

000003EF  STS 0x27D8,R21 Store direct to data space 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TACHO.c 

reti();

000003F1  RETI Interrupt return 

}

000003F2  POP R31 Pop register from stack 

000003F3  POP R30 Pop register from stack 

000003F4  POP R27 Pop register from stack 

000003F5  POP R26 Pop register from stack 

000003F6  POP R25 Pop register from stack 

000003F7  POP R24 Pop register from stack 

000003F8  POP R23 Pop register from stack 

000003F9  POP R22 Pop register from stack 

000003FA  POP R21 Pop register from stack 

000003FB  POP R20 Pop register from stack 

000003FC  POP R19 Pop register from stack 

000003FD  POP R18 Pop register from stack 

000003FE  POP R15 Pop register from stack 

000003FF  POP R14 Pop register from stack 

00000400  POP R13 Pop register from stack 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TACHO.c 

00000401  POP R12 Pop register from stack 

00000402  POP R0 Pop register from stack 

00000403  OUT 0x3B,R0 Out to I/O location 

00000404  POP R0 Pop register from stack 

00000405  OUT 0x39,R0 Out to I/O location 

00000406  POP R0 Pop register from stack 

00000407  OUT 0x38,R0 Out to I/O location 

00000408  POP R0 Pop register from stack 

00000409  OUT 0x3F,R0 Out to I/O location 

0000040A  POP R0 Pop register from stack 

0000040B  POP R1 Pop register from stack 

0000040C  RETI Interrupt return 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././Temp.c 

{

  ADCA_CTRLA = 0x05; //DMASEL[1:0]:No combined DMA request. CHSTART[3:0]:Hold on conversion. FLUSH: Pipeline Flush. ENABLE: Enable ADC.

0000040D  LDI R24,0x05 Load immediate 

0000040E  STS 0x0200,R24 Store direct to data space 

  ADCA_CTRLB = 0x08;//CONVMODE: Conversion Mode unsigned. FREERUN: Free Running Mode. RESOLUTION[1:0]: Conversion Result Resolution:12-bit result, right adjusted.

00000410  LDI R24,0x08 Load immediate 

00000411  STS 0x0201,R24 Store direct to data space 

  ADCA_REFCTRL = 0x01;//REFSEL[1:0]: Reference Selection:10/11 of bandgap (1.0V). BANDGAP: Bandgap disabled. TEMPREF: Temperature Reference Enabled.

00000413  LDI R24,0x01 Load immediate 

00000414  STS 0x0202,R24 Store direct to data space 

  ADCA_EVCTRL = 0x00;//SWEEP[1:0]: Only channel #0.EVSEL[2:0]: Event Channel #7. EVACT[2:0]: EVACT[2:0]: event mode: No event input.

00000416  STS 0x0203,R1 Store direct to data space 

  ADCA_PRESCALER = 0x07;//PRESCALER[2:0]: DIV 512.

00000418  LDI R24,0x07 Load immediate 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././Temp.c 

00000419  STS 0x0204,R24 Store direct to data space 

  CCP = 0xD8; //0x9D;//0xD8; //Signature of IO protected register.

0000041B  LDI R24,0xD8 Load immediate 

0000041C  OUT 0x34,R24 Out to I/O location 

  ADCA_CAL = 0x0A80;

0000041D  LDI R24,0x80 Load immediate 

0000041E  LDI R25,0x0A Load immediate 

0000041F  STS 0x020C,R24 Store direct to data space 

00000421  STS 0x020D,R25 Store direct to data space 

  ADCA_CH0_CTRL = 0x80;//Start conversion, Gain factor = 1x, Internal positive input.

00000423  LDI R24,0x80 Load immediate 

00000424  STS 0x0220,R24 Store direct to data space 

  ADCA_CH0_MUXCTRL = 0x00;//MUX positive input: Temperature reference. MUX Negative: N / A for internal positive input.

00000426  STS 0x0221,R1 Store direct to data space 

  ADCA_CH0_INTCTRL = 0x00;//Interrupt mode: N / A, Interrupt level = disabled.

00000428  STS 0x0222,R1 Store direct to data space 

  preADCACH0RES = ADCA_CH0_RES;

0000042A  LDI R30,0x24 Load immediate 

0000042B  LDI R31,0x02 Load immediate 

0000042C  LDD R24,Z+0 Load indirect with displacement 

0000042D  LDD R25,Z+1 Load indirect with displacement 

0000042E  STS 0x27EB,R24 Store direct to data space 

00000430  STS 0x27EC,R25 Store direct to data space 

  currentADCACH0RES = ADCA_CH0_RES;

00000432  LDD R24,Z+0 Load indirect with displacement 

00000433  LDD R25,Z+1 Load indirect with displacement 

00000434  STS 0x27E9,R24 Store direct to data space 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././Temp.c 

00000436  STS 0x27EA,R25 Store direct to data space 

00000438  RET Subroutine return 

{

return 0;

}

00000439  LDI R24,0x00 Load immediate 

0000043A  LDI R25,0x00 Load immediate 

0000043B  RET Subroutine return 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

{

//DDR_SCL |= (1 << SCL);

//DDR_SDA |= (1 << SDA);

  PORTB.DIRSET = 0x03;

0000043C  LDI R30,0x20 Load immediate 

0000043D  LDI R31,0x06 Load immediate 

0000043E  LDI R24,0x03 Load immediate 

0000043F  STD Z+1,R24 Store indirect with displacement 

  PORTB.OUTSET = 0x03;

00000440  STD Z+5,R24 Store indirect with displacement 

00000441  RET Subroutine return 

{

//DDR_SCL &= ~(1 << SCL);

//DDR_SDA &= ~(1 << SDA);

  PORTB.DIRCLR = 0x03;

00000442  LDI R24,0x03 Load immediate 

00000443  STS 0x0622,R24 Store direct to data space 

00000445  RET Subroutine return 

{

    PORTB.OUTSET = 0x01;

00000446  LDI R30,0x20 Load immediate 

00000447  LDI R31,0x06 Load immediate 

00000448  LDI R25,0x01 Load immediate 

00000449  STD Z+5,R25 Store indirect with displacement 

    PORTB.DIRSET = 0x01;

0000044A  STD Z+1,R25 Store indirect with displacement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

0000044B  RJMP PC+0x0001 Relative jump 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

0000044C  RJMP PC+0x0001 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

    PORTB.OUTSET = 0x02;

0000044D  LDI R24,0x02 Load immediate 

0000044E  STD Z+5,R24 Store indirect with displacement 

    PORTB.DIRSET = 0x02;

0000044F  STD Z+1,R24 Store indirect with displacement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

00000450  LDI R18,0x02 Load immediate 

00000451  DEC R18 Decrement 

00000452  BRNE PC-0x01 Branch if not equal 

00000453  RJMP PC+0x0001 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

PORTB.OUTCLR = 0x01;

00000454  STD Z+6,R25 Store indirect with displacement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

00000455  RJMP PC+0x0001 Relative jump 

00000456  RJMP PC+0x0001 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

PORTB.OUTCLR = 0x02;

00000457  STD Z+6,R24 Store indirect with displacement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

00000458  RJMP PC+0x0001 Relative jump 

00000459  RJMP PC+0x0001 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

}

0000045A  LDI R24,0x01 Load immediate 

0000045B  RET Subroutine return 

{

0000045C  MOV R25,R24 Copy register 

  PORTB_DIRSET = 0x01;

0000045D  LDI R24,0x01 Load immediate 

0000045E  STS 0x0621,R24 Store direct to data space 

00000460  LDI R24,0x08 Load immediate 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

if ( byte & 0x80 ) PORTB.OUTSET = 0x01; else PORTB.OUTCLR = 0x01;

00000461  LDI R30,0x20 Load immediate 

00000462  LDI R31,0x06 Load immediate 

00000463  LDI R19,0x01 Load immediate 

    PORTB.OUTSET = 0x02;

00000464  LDI R18,0x02 Load immediate 

if ( byte & 0x80 ) PORTB.OUTSET = 0x01; else PORTB.OUTCLR = 0x01;

00000465  TST R25 Test for Zero or Minus 

00000466  BRGE PC+0x03 Branch if greater or equal, signed 

--- No source file -------------------------------------------------------------

00000467  STD Z+5,R19 Store indirect with displacement 

00000468  RJMP PC+0x0002 Relative jump 

00000469  STD Z+6,R19 Store indirect with displacement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

0000046A  RJMP PC+0x0001 Relative jump 

0000046B  RJMP PC+0x0001 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

    PORTB.OUTSET = 0x02;

0000046C  STD Z+5,R18 Store indirect with displacement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

0000046D  LDI R20,0x02 Load immediate 

0000046E  DEC R20 Decrement 

0000046F  BRNE PC-0x01 Branch if not equal 

00000470  RJMP PC+0x0001 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

PORTB.OUTCLR = 0x02; // 100KHz I2C operation is required by SMC's power supply. 

00000471  STD Z+6,R18 Store indirect with displacement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

00000472  RJMP PC+0x0001 Relative jump 

00000473  RJMP PC+0x0001 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

    byte <<= 1;

00000474  LSL R25 Logical Shift Left 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

00000475  SUBI R24,0x01 Subtract immediate 

  for (bit = 0; bit < 8; bit++) 

00000476  BRNE PC-0x11 Branch if not equal 

  PORTB.DIRCLR = 0x01; 

00000477  LDI R30,0x20 Load immediate 

00000478  LDI R31,0x06 Load immediate 

00000479  LDI R25,0x01 Load immediate 

0000047A  STD Z+2,R25 Store indirect with displacement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

0000047B  RJMP PC+0x0001 Relative jump 

0000047C  RJMP PC+0x0001 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

  PORTB.OUTSET = 0x02;

0000047D  LDI R25,0x02 Load immediate 

0000047E  STD Z+5,R25 Store indirect with displacement 

  if ( PORTB.IN & 0x01 )

0000047F  LDD R25,Z+8 Load indirect with displacement 

00000480  SBRS R25,0 Skip if bit in register set 

00000481  RJMP PC+0x000D Relative jump 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

00000482  LDI R25,0x02 Load immediate 

00000483  DEC R25 Decrement 

00000484  BRNE PC-0x01 Branch if not equal 

00000485  RJMP PC+0x0001 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

PORTB.OUTCLR = 0x02;

00000486  LDI R25,0x02 Load immediate 

00000487  STD Z+6,R25 Store indirect with displacement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

00000488  LDI R18,0x02 Load immediate 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

00000489  DEC R18 Decrement 

0000048A  BRNE PC-0x01 Branch if not equal 

0000048B  RJMP PC+0x0001 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

PORTB.OUTSET = 0x02;

0000048C  STD Z+5,R25 Store indirect with displacement 

    return 0; //liu20170209 if NAC than return fail.

0000048D  RET Subroutine return 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

0000048E  LDI R20,0x02 Load immediate 

0000048F  DEC R20 Decrement 

00000490  BRNE PC-0x01 Branch if not equal 

00000491  RJMP PC+0x0001 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

  PORTB.OUTCLR = 0x02;

00000492  LDI R30,0x20 Load immediate 

00000493  LDI R31,0x06 Load immediate 

00000494  LDI R24,0x02 Load immediate 

00000495  STD Z+6,R24 Store indirect with displacement 

  PORTB.DIRSET = 0x01;

00000496  LDI R24,0x01 Load immediate 

00000497  STD Z+1,R24 Store indirect with displacement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

00000498  RJMP PC+0x0001 Relative jump 

00000499  RJMP PC+0x0001 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

}

0000049A  RET Subroutine return 

{

0000049B  PUSH R14 Push register on stack 

0000049C  PUSH R15 Push register on stack 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

0000049D  PUSH R16 Push register on stack 

0000049E  PUSH R17 Push register on stack 

0000049F  PUSH R28 Push register on stack 

000004A0  PUSH R29 Push register on stack 

000004A1  MOVW R14,R24 Copy register pair 

000004A2  MOV R17,R22 Copy register 

000004A3  MOV R28,R20 Copy register 

if(!twi_start_cond()) return 0;

000004A4  CALL 0x00000446 Call subroutine 

000004A6  TST R24 Test for Zero or Minus 

000004A7  BREQ PC+0x22 Branch if equal 

if( !i2c_write_byte( i2cSlaveAddress | 0x00 ) ) return 0;

000004A8  MOV R24,R28 Copy register 

000004A9  CALL 0x0000045C Call subroutine 

000004AB  TST R24 Test for Zero or Minus 

000004AC  BREQ PC+0x1D Branch if equal 

for(index = 0; index < bytes; index++) if ( !i2c_write_byte( indata[ index ] ) ) return 0;

000004AD  TST R17 Test for Zero or Minus 

000004AE  BREQ PC+0x11 Branch if equal 

000004AF  MOVW R28,R14 Copy register pair 

000004B0  SUBI R17,0x01 Subtract immediate 

000004B1  MOV R16,R17 Copy register 

000004B2  LDI R17,0x00 Load immediate 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

000004B3  SUBI R16,0xFF Subtract immediate 

000004B4  SBCI R17,0xFF Subtract immediate with carry 

000004B5  ADD R16,R14 Add without carry 

000004B6  ADC R17,R15 Add with carry 

--- No source file -------------------------------------------------------------

000004B7  LD R24,Y+ Load indirect and postincrement 

000004B8  CALL 0x0000045C Call subroutine 

000004BA  TST R24 Test for Zero or Minus 

000004BB  BREQ PC+0x0E Branch if equal 

000004BC  CP R28,R16 Compare 

000004BD  CPC R29,R17 Compare with carry 

000004BE  BRNE PC-0x07 Branch if not equal 

000004BF  LDI R30,0x20 Load immediate 

000004C0  LDI R31,0x06 Load immediate 

000004C1  LDI R24,0x02 Load immediate 

000004C2  STD Z+5,R24 Store indirect with displacement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

000004C3  LDI R24,0x03 Load immediate 

000004C4  DEC R24 Decrement 

000004C5  BRNE PC-0x01 Branch if not equal 

000004C6  NOP No operation 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

PORTB.OUTSET = 0x01;

000004C7  LDI R24,0x01 Load immediate 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

000004C8  STD Z+5,R24 Store indirect with displacement 

}

000004C9  POP R29 Pop register from stack 

000004CA  POP R28 Pop register from stack 

000004CB  POP R17 Pop register from stack 

000004CC  POP R16 Pop register from stack 

000004CD  POP R15 Pop register from stack 

000004CE  POP R14 Pop register from stack 

000004CF  RET Subroutine return 

{

000004D0  PUSH R16 Push register on stack 

000004D1  PUSH R17 Push register on stack 

000004D2  PUSH R28 Push register on stack 

000004D3  PUSH R29 Push register on stack 

000004D4  MOVW R16,R24 Copy register pair 

  PORTB.DIRCLR = 0x01;

000004D5  LDI R24,0x01 Load immediate 

000004D6  STS 0x0622,R24 Store direct to data space 

000004D8  LDI R18,0x07 Load immediate 

000004D9  LDI R19,0x00 Load immediate 

  unsigned char byte = 0;

000004DA  LDI R22,0x00 Load immediate 

PORTB.OUTSET = 0x02;

000004DB  LDI R30,0x20 Load immediate 

000004DC  LDI R31,0x06 Load immediate 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

000004DD  LDI R25,0x02 Load immediate 

    byte|= (1 << (7- bit));

000004DE  LDI R28,0x01 Load immediate 

000004DF  LDI R29,0x00 Load immediate 

PORTB.OUTSET = 0x02;

000004E0  STD Z+5,R25 Store indirect with displacement 

if ( PORTB.IN & 0x01 )

000004E1  LDD R21,Z+8 Load indirect with displacement 

000004E2  SBRS R21,0 Skip if bit in register set 

000004E3  RJMP PC+0x0009 Relative jump 

    byte|= (1 << (7- bit));

000004E4  MOVW R26,R28 Copy register pair 

000004E5  MOV R0,R18 Copy register 

000004E6  RJMP PC+0x0003 Relative jump 

000004E7  LSL R26 Logical Shift Left 

000004E8  ROL R27 Rotate Left Through Carry 

000004E9  DEC R0 Decrement 

000004EA  BRPL PC-0x03 Branch if plus 

000004EB  OR R22,R26 Logical OR 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

000004EC  LDI R24,0x02 Load immediate 

000004ED  DEC R24 Decrement 

000004EE  BRNE PC-0x01 Branch if not equal 

000004EF  RJMP PC+0x0001 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

PORTB.OUTCLR = 0x02;

000004F0  STD Z+6,R25 Store indirect with displacement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

000004F1  LDI R24,0x02 Load immediate 

000004F2  DEC R24 Decrement 

000004F3  BRNE PC-0x01 Branch if not equal 

000004F4  RJMP PC+0x0001 Relative jump 

000004F5  SUBI R18,0x01 Subtract immediate 

000004F6  SBC R19,R1 Subtract with carry 

000004F7  BRCC PC-0x17 Branch if carry cleared 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

  rcvdata

= byte;

000004F8  MOVW R30,R16 Copy register pair 

000004F9  ADD R30,R20 Add without carry 

000004FA  ADC R31,R1 Add with carry 

000004FB  STD Z+0,R22 Store indirect with displacement 

  PORTB.OUTSET = 0x01;//Host NAC for the 9th bit in reading

000004FC  LDI R30,0x20 Load immediate 

000004FD  LDI R31,0x06 Load immediate 

000004FE  LDI R24,0x01 Load immediate 

000004FF  STD Z+5,R24 Store indirect with displacement 

  PORTB.DIRSET = 0x01;

00000500  STD Z+1,R24 Store indirect with displacement 

  PORTB.OUTSET = 0x02;

00000501  LDI R25,0x02 Load immediate 

00000502  STD Z+5,R25 Store indirect with displacement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

00000503  LDI R18,0x02 Load immediate 

00000504  DEC R18 Decrement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

00000505  BRNE PC-0x01 Branch if not equal 

00000506  RJMP PC+0x0001 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

  PORTB.OUTCLR = 0x02;

00000507  STD Z+6,R25 Store indirect with displacement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

00000508  RJMP PC+0x0001 Relative jump 

00000509  RJMP PC+0x0001 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

  PORTB.OUTCLR = 0x01;

0000050A  STD Z+6,R24 Store indirect with displacement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

0000050B  RJMP PC+0x0001 Relative jump 

0000050C  RJMP PC+0x0001 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

  PORTB.OUTSET = 0x02;

0000050D  STD Z+5,R25 Store indirect with displacement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

0000050E  RJMP PC+0x0001 Relative jump 

0000050F  RJMP PC+0x0001 Relative jump 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

  PORTB.OUTSET = 0x01; //Stop bit

00000510  STD Z+5,R24 Store indirect with displacement 

}

00000511  POP R29 Pop register from stack 

00000512  POP R28 Pop register from stack 

00000513  POP R17 Pop register from stack 

00000514  POP R16 Pop register from stack 

00000515  RET Subroutine return 

{

00000516  PUSH R15 Push register on stack 

00000517  PUSH R16 Push register on stack 

00000518  PUSH R17 Push register on stack 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

00000519  PUSH R28 Push register on stack 

0000051A  PUSH R29 Push register on stack 

0000051B  MOVW R16,R24 Copy register pair 

0000051C  MOV R15,R22 Copy register 

0000051D  MOV R28,R20 Copy register 

0000051E  MOV R29,R18 Copy register 

  if( !twi_start_cond() ) return 0;

0000051F  CALL 0x00000446 Call subroutine 

00000521  TST R24 Test for Zero or Minus 

00000522  BREQ PC+0x33 Branch if equal 

  if( !i2c_write_byte( i2cSlaveAddress | 0x00 )) return 0;

00000523  MOV R24,R28 Copy register 

00000524  CALL 0x0000045C Call subroutine 

00000526  TST R24 Test for Zero or Minus 

00000527  BREQ PC+0x2E Branch if equal 

  if( !i2c_write_byte( i2cOffset )) return 0;

00000528  MOV R24,R29 Copy register 

00000529  CALL 0x0000045C Call subroutine 

0000052B  TST R24 Test for Zero or Minus 

0000052C  BREQ PC+0x29 Branch if equal 

  if( !twi_start_cond() ) return 0;

0000052D  CALL 0x00000446 Call subroutine 

0000052F  TST R24 Test for Zero or Minus 

00000530  BREQ PC+0x25 Branch if equal 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

  if( !i2c_write_byte( i2cSlaveAddress | 0x01 )) return 0;

00000531  MOV R24,R28 Copy register 

00000532  ORI R24,0x01 Logical OR with immediate 

00000533  CALL 0x0000045C Call subroutine 

00000535  TST R24 Test for Zero or Minus 

00000536  BREQ PC+0x1F Branch if equal 

    PORTB.DIRCLR = 0x02; //Temporarily turn SMCLK as input to sense PSU slave stretching.

00000537  LDI R24,0x02 Load immediate 

00000538  STS 0x0622,R24 Store direct to data space 

    while ( ! ( PORTB.IN & 0x02 ) );//Sense and wait for SMCLK stretching. 

0000053A  LDI R30,0x20 Load immediate 

0000053B  LDI R31,0x06 Load immediate 

--- No source file -------------------------------------------------------------

0000053C  LDD R24,Z+8 Load indirect with displacement 

0000053D  SBRS R24,1 Skip if bit in register set 

0000053E  RJMP PC-0x0002 Relative jump 

0000053F  LDI R30,0x20 Load immediate 

00000540  LDI R31,0x06 Load immediate 

00000541  LDI R24,0x02 Load immediate 

00000542  STD Z+5,R24 Store indirect with displacement 

00000543  STD Z+1,R24 Store indirect with displacement 

00000544  LDI R20,0x00 Load immediate 

00000545  MOV R22,R15 Copy register 

00000546  MOVW R24,R16 Copy register pair 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

00000547  CALL 0x000004D0 Call subroutine 

00000549  TST R24 Test for Zero or Minus 

0000054A  BREQ PC+0x0B Branch if equal 

  PORTB.OUTSET = 0x02;

0000054B  LDI R30,0x20 Load immediate 

0000054C  LDI R31,0x06 Load immediate 

0000054D  LDI R24,0x02 Load immediate 

0000054E  STD Z+5,R24 Store indirect with displacement 

--- c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util/delay.h 

__builtin_avr_delay_cycles(__ticks_dc);

0000054F  LDI R24,0x03 Load immediate 

00000550  DEC R24 Decrement 

00000551  BRNE PC-0x01 Branch if not equal 

00000552  NOP No operation 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_master.c 

  PORTB.OUTSET = 0x01;

00000553  LDI R24,0x01 Load immediate 

00000554  STD Z+5,R24 Store indirect with displacement 

}

00000555  POP R29 Pop register from stack 

00000556  POP R28 Pop register from stack 

00000557  POP R17 Pop register from stack 

00000558  POP R16 Pop register from stack 

00000559  POP R15 Pop register from stack 

0000055A  RET Subroutine return 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

{

  TWIC_Slave_Buffer.bytesReceived = 0;

0000055B  LDI R30,0x1B Load immediate 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

0000055C  LDI R31,0x28 Load immediate 

0000055D  STD Z+18,R1 Store indirect with displacement 

TWIC_Slave_Buffer.bytesSent = 0;

0000055E  STD Z+19,R1 Store indirect with displacement 

TWIC_Slave_Buffer.status = TWIS_STATUS_READY;

0000055F  STD Z+20,R1 Store indirect with displacement 

TWIC_Slave_Buffer.result = TWIS_RESULT_UNKNOWN;

00000560  STD Z+21,R1 Store indirect with displacement 

TWIC_Slave_Buffer.abort = 0;

00000561  STD Z+22,R1 Store indirect with displacement 

TWID_Slave_Buffer.bytesReceived = 0;

00000562  LDI R30,0x04 Load immediate 

00000563  LDI R31,0x28 Load immediate 

00000564  STD Z+18,R1 Store indirect with displacement 

TWID_Slave_Buffer.bytesSent = 0;

00000565  STD Z+19,R1 Store indirect with displacement 

TWID_Slave_Buffer.status = TWIS_STATUS_READY;

00000566  STD Z+20,R1 Store indirect with displacement 

TWID_Slave_Buffer.result = TWIS_RESULT_UNKNOWN;

00000567  STD Z+21,R1 Store indirect with displacement 

TWID_Slave_Buffer.abort = 0;

00000568  STD Z+22,R1 Store indirect with displacement 

TWIE_Slave_Buffer.bytesReceived = 0;

00000569  LDI R30,0xED Load immediate 

0000056A  LDI R31,0x27 Load immediate 

0000056B  STD Z+18,R1 Store indirect with displacement 

TWIE_Slave_Buffer.bytesSent = 0;

0000056C  STD Z+19,R1 Store indirect with displacement 

TWIE_Slave_Buffer.status = TWIS_STATUS_READY;

0000056D  STD Z+20,R1 Store indirect with displacement 

TWIE_Slave_Buffer.result = TWIS_RESULT_UNKNOWN;

0000056E  STD Z+21,R1 Store indirect with displacement 

TWIE_Slave_Buffer.abort = 0;

0000056F  STD Z+22,R1 Store indirect with displacement 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

TWIF_Slave_Buffer.bytesReceived = 0;

00000570  LDI R30,0x32 Load immediate 

00000571  LDI R31,0x28 Load immediate 

00000572  STD Z+18,R1 Store indirect with displacement 

TWIF_Slave_Buffer.bytesSent = 0;

00000573  STD Z+19,R1 Store indirect with displacement 

TWIF_Slave_Buffer.status = TWIS_STATUS_READY;

00000574  STD Z+20,R1 Store indirect with displacement 

TWIF_Slave_Buffer.result = TWIS_RESULT_UNKNOWN;

00000575  STD Z+21,R1 Store indirect with displacement 

TWIF_Slave_Buffer.abort = 0;

00000576  STD Z+22,R1 Store indirect with displacement 

00000577  RET Subroutine return 

{

  //PMSDA1/PMSCL1 

  TWIC.CTRL = 0x00;

00000578  LDI R30,0x80 Load immediate 

00000579  LDI R31,0x04 Load immediate 

0000057A  STD Z+0,R1 Store indirect with displacement 

  TWIC.SLAVE.ADDR = 0xA0

0000057B  LDI R24,0xA0 Load immediate 

0000057C  STD Z+11,R24 Store indirect with displacement 

  TWIC.SLAVE.ADDRMASK = 0x00;

0000057D  STD Z+13,R1 Store indirect with displacement 

  TWIC.SLAVE.CTRLA = 0xf9;

0000057E  LDI R24,0xF9 Load immediate 

0000057F  STD Z+8,R24 Store indirect with displacement 

  TWID.CTRL = 0x00;

00000580  LDI R30,0x90 Load immediate 

00000581  LDI R31,0x04 Load immediate 

00000582  STD Z+0,R1 Store indirect with displacement 

  TWID.SLAVE.ADDR = 0xB0;

00000583  LDI R25,0xB0 Load immediate 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

00000584  STD Z+11,R25 Store indirect with displacement 

  TWID.SLAVE.ADDRMASK = 0x00;

00000585  STD Z+13,R1 Store indirect with displacement 

  TWID.SLAVE.CTRLA = 0xf9;

00000586  STD Z+8,R24 Store indirect with displacement 

  TWIE.CTRL = 0x00;

00000587  LDI R30,0xA0 Load immediate 

00000588  LDI R31,0x04 Load immediate 

00000589  STD Z+0,R1 Store indirect with displacement 

  TWIE.SLAVE.ADDR = 0x74;

0000058A  LDI R25,0x74 Load immediate 

0000058B  STD Z+11,R25 Store indirect with displacement 

  TWIE.SLAVE.ADDRMASK = 0x00;

0000058C  STD Z+13,R1 Store indirect with displacement 

  TWIE.SLAVE.CTRLA = 0xf9;

0000058D  STD Z+8,R24 Store indirect with displacement 

  TWIF.CTRL = 0x00;

0000058E  LDI R30,0xB0 Load immediate 

0000058F  LDI R31,0x04 Load immediate 

00000590  STD Z+0,R1 Store indirect with displacement 

  TWIF.SLAVE.ADDR = 0x76;

00000591  LDI R25,0x76 Load immediate 

00000592  STD Z+11,R25 Store indirect with displacement 

  TWIF.SLAVE.ADDRMASK = 0x00;

00000593  STD Z+13,R1 Store indirect with displacement 

  TWIF.SLAVE.CTRLA = 0xf9;

00000594  STD Z+8,R24 Store indirect with displacement 

00000595  RET Subroutine return 

{

00000596  PUSH R1 Push register on stack 

00000597  PUSH R0 Push register on stack 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

00000598  IN R0,0x3F In from I/O location 

00000599  PUSH R0 Push register on stack 

0000059A  CLR R1 Clear Register 

0000059B  IN R0,0x38 In from I/O location 

0000059C  PUSH R0 Push register on stack 

0000059D  OUT 0x38,R1 Out to I/O location 

0000059E  IN R0,0x39 In from I/O location 

0000059F  PUSH R0 Push register on stack 

000005A0  OUT 0x39,R1 Out to I/O location 

000005A1  IN R0,0x3B In from I/O location 

000005A2  PUSH R0 Push register on stack 

000005A3  OUT 0x3B,R1 Out to I/O location 

000005A4  PUSH R18 Push register on stack 

000005A5  PUSH R24 Push register on stack 

000005A6  PUSH R25 Push register on stack 

000005A7  PUSH R26 Push register on stack 

000005A8  PUSH R27 Push register on stack 

000005A9  PUSH R30 Push register on stack 

000005AA  PUSH R31 Push register on stack 

  if (TWIC.SLAVE.STATUS & TWI_SLAVE_BUSERR_bm) 

000005AB  LDS R24,0x048A Load direct from data space 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

000005AD  SBRS R24,2 Skip if bit in register set 

000005AE  RJMP PC+0x0009 Relative jump 

    TWIC_Slave_Buffer.bytesReceived = 0;

000005AF  LDI R30,0x1B Load immediate 

000005B0  LDI R31,0x28 Load immediate 

000005B1  STD Z+18,R1 Store indirect with displacement 

TWIC_Slave_Buffer.bytesSent = 0;

000005B2  STD Z+19,R1 Store indirect with displacement 

TWIC_Slave_Buffer.status = TWIS_STATUS_READY;

000005B3  STD Z+20,R1 Store indirect with displacement 

TWIC_Slave_Buffer.result = TWIS_RESULT_BUS_ERROR;

000005B4  LDI R24,0x04 Load immediate 

000005B5  STD Z+21,R24 Store indirect with displacement 

000005B6  RJMP PC+0x00D3 Relative jump 

  else if (TWIC.SLAVE.STATUS & TWI_SLAVE_COLL_bm)

000005B7  LDS R24,0x048A Load direct from data space 

000005B9  SBRS R24,3 Skip if bit in register set 

000005BA  RJMP PC+0x0009 Relative jump 

    TWIC_Slave_Buffer.bytesReceived = 0;

000005BB  LDI R30,0x1B Load immediate 

000005BC  LDI R31,0x28 Load immediate 

000005BD  STD Z+18,R1 Store indirect with displacement 

    TWIC_Slave_Buffer.bytesSent = 0;

000005BE  STD Z+19,R1 Store indirect with displacement 

    TWIC_Slave_Buffer.status = TWIS_STATUS_READY;

000005BF  STD Z+20,R1 Store indirect with displacement 

    TWIC_Slave_Buffer.result = TWIS_RESULT_TRANSMIT_COLLISION;

000005C0  LDI R24,0x03 Load immediate 

000005C1  STD Z+21,R24 Store indirect with displacement 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

000005C2  RJMP PC+0x00C7 Relative jump 

  else if ((TWIC.SLAVE.STATUS & TWI_SLAVE_APIF_bm) && (TWIC.SLAVE.STATUS & TWI_SLAVE_AP_bm)) 

000005C3  LDS R24,0x048A Load direct from data space 

000005C5  SBRS R24,6 Skip if bit in register set 

000005C6  RJMP PC+0x0027 Relative jump 

--- No source file -------------------------------------------------------------

000005C7  LDS R24,0x048A Load direct from data space 

000005C9  SBRS R24,0 Skip if bit in register set 

000005CA  RJMP PC+0x0023 Relative jump 

000005CB  LDS R24,0x2831 Load direct from data space 

000005CD  TST R24 Test for Zero or Minus 

000005CE  BREQ PC+0x0B Branch if equal 

000005CF  LDI R24,0x02 Load immediate 

000005D0  STS 0x0489,R24 Store direct to data space 

000005D2  LDI R30,0x1B Load immediate 

000005D3  LDI R31,0x28 Load immediate 

000005D4  LDI R24,0x06 Load immediate 

000005D5  STD Z+21,R24 Store indirect with displacement 

000005D6  STD Z+20,R1 Store indirect with displacement 

000005D7  STD Z+22,R1 Store indirect with displacement 

000005D8  RJMP PC+0x00B1 Relative jump 

000005D9  LDI R30,0x1B Load immediate 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

000005DA  LDI R31,0x28 Load immediate 

000005DB  LDI R24,0x01 Load immediate 

000005DC  STD Z+20,R24 Store indirect with displacement 

      TWIC_Slave_Buffer.result = TWIS_RESULT_UNKNOWN;

000005DD  STD Z+21,R1 Store indirect with displacement 

      TWIC.SLAVE.CTRLA &= ~TWI_SLAVE_PIEN_bm;

000005DE  LDI R26,0x80 Load immediate 

000005DF  LDI R27,0x04 Load immediate 

000005E0  ADIW R26,0x08 Add immediate to word 

000005E1  LD R24,X Load indirect 

000005E2  SBIW R26,0x08 Subtract immediate from word 

000005E3  ANDI R24,0xFB Logical AND with immediate 

000005E4  ADIW R26,0x08 Add immediate to word 

000005E5  ST X,R24 Store indirect 

000005E6  SBIW R26,0x08 Subtract immediate from word 

      TWIC_Slave_Buffer.bytesReceived = 0;

000005E7  STD Z+18,R1 Store indirect with displacement 

      TWIC_Slave_Buffer.bytesSent = 0;

000005E8  STD Z+19,R1 Store indirect with displacement 

      TWIC.SLAVE.CTRLB = TWI_SLAVE_CMD_RESPONSE_gc;

000005E9  LDI R24,0x03 Load immediate 

000005EA  ADIW R26,0x09 Add immediate to word 

000005EB  ST X,R24 Store indirect 

000005EC  RJMP PC+0x009D Relative jump 

  else if (TWIC.SLAVE.STATUS & TWI_SLAVE_APIF_bm)

000005ED  LDS R24,0x048A Load direct from data space 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

000005EF  SBRS R24,6 Skip if bit in register set 

000005F0  RJMP PC+0x000E Relative jump 

  TWIC.SLAVE.CTRLA &= ~TWI_SLAVE_PIEN_bm;

000005F1  LDI R30,0x80 Load immediate 

000005F2  LDI R31,0x04 Load immediate 

000005F3  LDD R24,Z+8 Load indirect with displacement 

000005F4  ANDI R24,0xFB Logical AND with immediate 

000005F5  STD Z+8,R24 Store indirect with displacement 

  TWIC.SLAVE.STATUS |= TWI_SLAVE_APIF_bm;

000005F6  LDD R24,Z+10 Load indirect with displacement 

000005F7  ORI R24,0x40 Logical OR with immediate 

000005F8  STD Z+10,R24 Store indirect with displacement 

TWIC_Slave_Buffer.bytesReceived = 0; //Clear ISR data buffer

000005F9  LDI R30,0x1B Load immediate 

000005FA  LDI R31,0x28 Load immediate 

000005FB  STD Z+18,R1 Store indirect with displacement 

    TWIC_Slave_Buffer.status = TWIS_STATUS_READY; 

000005FC  STD Z+20,R1 Store indirect with displacement 

000005FD  RJMP PC+0x008C Relative jump 

  else if (TWIC.SLAVE.STATUS & TWI_SLAVE_DIF_bm) 

000005FE  LDS R24,0x048A Load direct from data space 

00000600  TST R24 Test for Zero or Minus 

00000601  BRLT PC+0x02 Branch if less than, signed 

00000602  RJMP PC+0x0082 Relative jump 

    if (TWIC.SLAVE.STATUS & TWI_SLAVE_DIR_bm) 

00000603  LDS R24,0x048A Load direct from data space 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

00000605  SBRS R24,1 Skip if bit in register set 

00000606  RJMP PC+0x0048 Relative jump 

00000607  LDI R24,0x00 Load immediate 

00000608  LDI R25,0x00 Load immediate 

 TWIC_Slave_Buffer.sendData[ i ] = superMicroI2CFRU2[ TWIC_Slave_Buffer.receivedData[ 00 ] + i ];

00000609  LDI R26,0x1B Load immediate 

0000060A  LDI R27,0x28 Load immediate 

--- No source file -------------------------------------------------------------

0000060B  ADIW R26,0x02 Add immediate to word 

0000060C  LD R18,X Load indirect 

0000060D  SBIW R26,0x02 Subtract immediate from word 

0000060E  MOVW R30,R24 Copy register pair 

0000060F  SUBI R30,0xFE Subtract immediate 

00000610  SBCI R31,0xDF Subtract immediate with carry 

00000611  ADD R30,R18 Add without carry 

00000612  ADC R31,R1 Add with carry 

00000613  LDD R18,Z+0 Load indirect with displacement 

00000614  MOVW R30,R24 Copy register pair 

00000615  SUBI R30,0xE5 Subtract immediate 

00000616  SBCI R31,0xD7 Subtract immediate with carry 

00000617  STD Z+10,R18 Store indirect with displacement 

00000618  ADIW R24,0x01 Add immediate to word 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

for ( unsigned char i = 0; i < 8; i++ )

00000619  CPI R24,0x08 Compare with immediate 

0000061A  CPC R25,R1 Compare with carry 

0000061B  BRNE PC-0x10 Branch if not equal 

      if ( ( TWIC_Slave_Buffer.bytesSent > 0 ) && ( TWIC.SLAVE.STATUS & TWI_SLAVE_RXACK_bm ) )

0000061C  LDS R24,0x282E Load direct from data space 

0000061E  TST R24 Test for Zero or Minus 

0000061F  BREQ PC+0x0E Branch if equal 

--- No source file -------------------------------------------------------------

00000620  LDS R24,0x048A Load direct from data space 

00000622  SBRS R24,4 Skip if bit in register set 

00000623  RJMP PC+0x000A Relative jump 

00000624  LDI R24,0x02 Load immediate 

00000625  STS 0x0489,R24 Store direct to data space 

00000627  LDI R30,0x1B Load immediate 

00000628  LDI R31,0x28 Load immediate 

00000629  LDI R24,0x01 Load immediate 

0000062A  STD Z+21,R24 Store indirect with displacement 

0000062B  STD Z+20,R1 Store indirect with displacement 

0000062C  RJMP PC+0x005D Relative jump 

0000062D  LDS R24,0x282E Load direct from data space 

0000062F  CPI R24,0x08 Compare with immediate 

00000630  BRCC PC+0x16 Branch if carry cleared 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

          TWIC.SLAVE.DATA = TWIC_Slave_Buffer.sendData[TWIC_Slave_Buffer.bytesSent];

00000631  LDI R26,0x1B Load immediate 

00000632  LDI R27,0x28 Load immediate 

00000633  ADIW R26,0x13 Add immediate to word 

00000634  LD R30,X Load indirect 

00000635  SBIW R26,0x13 Subtract immediate from word 

00000636  LDI R31,0x00 Load immediate 

00000637  SUBI R30,0xE5 Subtract immediate 

00000638  SBCI R31,0xD7 Subtract immediate with carry 

00000639  LDD R24,Z+10 Load indirect with displacement 

0000063A  LDI R30,0x80 Load immediate 

0000063B  LDI R31,0x04 Load immediate 

0000063C  STD Z+12,R24 Store indirect with displacement 

          TWIC_Slave_Buffer.bytesSent++;

0000063D  ADIW R26,0x13 Add immediate to word 

0000063E  LD R24,X Load indirect 

0000063F  SBIW R26,0x13 Subtract immediate from word 

00000640  SUBI R24,0xFF Subtract immediate 

00000641  ADIW R26,0x13 Add immediate to word 

00000642  ST X,R24 Store indirect 

          TWIC.SLAVE.CTRLB = TWI_SLAVE_CMD_RESPONSE_gc;

00000643  LDI R24,0x03 Load immediate 

00000644  STD Z+9,R24 Store indirect with displacement 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

00000645  RJMP PC+0x0044 Relative jump 

          TWIC.SLAVE.CTRLB = TWI_SLAVE_CMD_COMPTRANS_gc;

00000646  LDI R24,0x02 Load immediate 

00000647  STS 0x0489,R24 Store direct to data space 

          TWIC_Slave_Buffer.result = TWIS_RESULT_BUFFER_OVERFLOW;

00000649  LDI R30,0x1B Load immediate 

0000064A  LDI R31,0x28 Load immediate 

0000064B  STD Z+21,R24 Store indirect with displacement 

          TWIC_Slave_Buffer.status = TWIS_STATUS_READY;

0000064C  STD Z+20,R1 Store indirect with displacement 

0000064D  RJMP PC+0x003C Relative jump 

 TWIC.SLAVE.CTRLA |= TWI_SLAVE_PIEN_bm;

0000064E  LDI R30,0x80 Load immediate 

0000064F  LDI R31,0x04 Load immediate 

00000650  LDD R24,Z+8 Load indirect with displacement 

00000651  ORI R24,0x04 Logical OR with immediate 

00000652  STD Z+8,R24 Store indirect with displacement 

      if (TWIC_Slave_Buffer.bytesReceived < TWIS_RECEIVE_BUFFER_SIZE) 

00000653  LDS R24,0x282D Load direct from data space 

00000655  CPI R24,0x08 Compare with immediate 

00000656  BRCC PC+0x25 Branch if carry cleared 

        TWIC_Slave_Buffer.receivedData[TWIC_Slave_Buffer.bytesReceived] = TWIC.SLAVE.DATA;

00000657  LDI R26,0x1B Load immediate 

00000658  LDI R27,0x28 Load immediate 

00000659  ADIW R26,0x12 Add immediate to word 

0000065A  LD R30,X Load indirect 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

0000065B  SBIW R26,0x12 Subtract immediate from word 

0000065C  LDI R31,0x00 Load immediate 

0000065D  LDS R24,0x048C Load direct from data space 

0000065F  SUBI R30,0xE5 Subtract immediate 

00000660  SBCI R31,0xD7 Subtract immediate with carry 

00000661  STD Z+2,R24 Store indirect with displacement 

        TWIC_Slave_Buffer.bytesReceived++;

00000662  ADIW R26,0x12 Add immediate to word 

00000663  LD R24,X Load indirect 

00000664  SBIW R26,0x12 Subtract immediate from word 

00000665  SUBI R24,0xFF Subtract immediate 

00000666  ADIW R26,0x12 Add immediate to word 

00000667  ST X,R24 Store indirect 

00000668  SBIW R26,0x12 Subtract immediate from word 

        if (TWIC_Slave_Buffer.abort) 

00000669  ADIW R26,0x16 Add immediate to word 

0000066A  LD R24,X Load indirect 

0000066B  SBIW R26,0x16 Subtract immediate from word 

0000066C  TST R24 Test for Zero or Minus 

0000066D  BREQ PC+0x0A Branch if equal 

          TWIC.SLAVE.CTRLB = TWI_SLAVE_CMD_COMPTRANS_gc;

0000066E  LDI R24,0x02 Load immediate 

0000066F  STS 0x0489,R24 Store direct to data space 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

          TWIC_Slave_Buffer.result = TWIS_RESULT_ABORTED;

00000671  MOVW R30,R26 Copy register pair 

00000672  LDI R24,0x06 Load immediate 

00000673  STD Z+21,R24 Store indirect with displacement 

          TWIC_Slave_Buffer.status = TWIS_STATUS_READY;

00000674  STD Z+20,R1 Store indirect with displacement 

          TWIC_Slave_Buffer.abort = 0x00;

00000675  STD Z+22,R1 Store indirect with displacement 

00000676  RJMP PC+0x0013 Relative jump 

          TWIC.SLAVE.CTRLB = TWI_SLAVE_CMD_RESPONSE_gc;

00000677  LDI R24,0x03 Load immediate 

00000678  STS 0x0489,R24 Store direct to data space 

0000067A  RJMP PC+0x000F Relative jump 

TWIC.SLAVE.CTRLB = TWI_SLAVE_ACKACT_bm | TWI_SLAVE_CMD_COMPTRANS_gc;

0000067B  LDI R24,0x06 Load immediate 

0000067C  STS 0x0489,R24 Store direct to data space 

        TWIC_Slave_Buffer.result = TWIS_RESULT_BUFFER_OVERFLOW;

0000067E  LDI R30,0x1B Load immediate 

0000067F  LDI R31,0x28 Load immediate 

00000680  LDI R24,0x02 Load immediate 

00000681  STD Z+21,R24 Store indirect with displacement 

        TWIC_Slave_Buffer.status = TWIS_STATUS_READY;

00000682  STD Z+20,R1 Store indirect with displacement 

00000683  RJMP PC+0x0006 Relative jump 

    TWIC_Slave_Buffer.result = TWIS_RESULT_FAIL;

00000684  LDI R30,0x1B Load immediate 

00000685  LDI R31,0x28 Load immediate 

00000686  LDI R24,0x05 Load immediate 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

00000687  STD Z+21,R24 Store indirect with displacement 

    TWIC_Slave_Buffer.status = TWIS_STATUS_READY;

00000688  STD Z+20,R1 Store indirect with displacement 

  reti();

00000689  RETI Interrupt return 

}

0000068A  POP R31 Pop register from stack 

0000068B  POP R30 Pop register from stack 

0000068C  POP R27 Pop register from stack 

0000068D  POP R26 Pop register from stack 

0000068E  POP R25 Pop register from stack 

0000068F  POP R24 Pop register from stack 

00000690  POP R18 Pop register from stack 

00000691  POP R0 Pop register from stack 

00000692  OUT 0x3B,R0 Out to I/O location 

00000693  POP R0 Pop register from stack 

00000694  OUT 0x39,R0 Out to I/O location 

00000695  POP R0 Pop register from stack 

00000696  OUT 0x38,R0 Out to I/O location 

00000697  POP R0 Pop register from stack 

00000698  OUT 0x3F,R0 Out to I/O location 

00000699  POP R0 Pop register from stack 

0000069A  POP R1 Pop register from stack 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

0000069B  RETI Interrupt return 

{

0000069C  PUSH R1 Push register on stack 

0000069D  PUSH R0 Push register on stack 

0000069E  IN R0,0x3F In from I/O location 

0000069F  PUSH R0 Push register on stack 

000006A0  CLR R1 Clear Register 

000006A1  IN R0,0x38 In from I/O location 

000006A2  PUSH R0 Push register on stack 

000006A3  OUT 0x38,R1 Out to I/O location 

  reti();

000006A4  RETI Interrupt return 

}

000006A5  POP R0 Pop register from stack 

000006A6  OUT 0x38,R0 Out to I/O location 

000006A7  POP R0 Pop register from stack 

000006A8  OUT 0x3F,R0 Out to I/O location 

000006A9  POP R0 Pop register from stack 

000006AA  POP R1 Pop register from stack 

000006AB  RETI Interrupt return 

{

000006AC  PUSH R1 Push register on stack 

000006AD  PUSH R0 Push register on stack 

000006AE  IN R0,0x3F In from I/O location 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

000006AF  PUSH R0 Push register on stack 

000006B0  CLR R1 Clear Register 

000006B1  IN R0,0x38 In from I/O location 

000006B2  PUSH R0 Push register on stack 

000006B3  OUT 0x38,R1 Out to I/O location 

  reti();

000006B4  RETI Interrupt return 

}

000006B5  POP R0 Pop register from stack 

000006B6  OUT 0x38,R0 Out to I/O location 

000006B7  POP R0 Pop register from stack 

000006B8  OUT 0x3F,R0 Out to I/O location 

000006B9  POP R0 Pop register from stack 

000006BA  POP R1 Pop register from stack 

000006BB  RETI Interrupt return 

{

000006BC  PUSH R1 Push register on stack 

000006BD  PUSH R0 Push register on stack 

000006BE  IN R0,0x3F In from I/O location 

000006BF  PUSH R0 Push register on stack 

000006C0  CLR R1 Clear Register 

000006C1  IN R0,0x38 In from I/O location 

000006C2  PUSH R0 Push register on stack 

--- C:\Users\liu\Desktop\BPN-SAS3-827HQ\BPN-SAS3-827HQ\BPN-SAS3-827HQ\Debug/.././TWI_slave.c 

000006C3  OUT 0x38,R1 Out to I/O location 

  reti();

000006C4  RETI Interrupt return 

}

000006C5  POP R0 Pop register from stack 

000006C6  OUT 0x38,R0 Out to I/O location 

000006C7  POP R0 Pop register from stack 

000006C8  OUT 0x3F,R0 Out to I/O location 

000006C9  POP R0 Pop register from stack 

000006CA  POP R1 Pop register from stack 

000006CB  RETI Interrupt return 

--- No source file -------------------------------------------------------------

000006CC  MOV R0,R21 Copy register 

000006CD  BST R25,7 Bit store from register to T 

000006CE  BRTC PC+0x04 Branch if T flag cleared 

000006CF  COM R0 One's complement 

000006D0  CALL 0x000006E3 Call subroutine 

000006D2  SBRC R21,7 Skip if bit in register cleared 

000006D3  RCALL PC+0x0008 Relative call subroutine 

000006D4  CALL 0x000006FA Call subroutine 

000006D6  SBRC R0,7 Skip if bit in register cleared 

000006D7  RCALL PC+0x0004 Relative call subroutine 

000006D8  BRTC PC+0x0A Branch if T flag cleared 

--- No source file -------------------------------------------------------------

000006D9  JMP 0x000006E3 Jump 

000006DB  COM R21 One's complement 

000006DC  COM R20 One's complement 

000006DD  COM R19 One's complement 

000006DE  NEG R18 Two's complement 

000006DF  SBCI R19,0xFF Subtract immediate with carry 

000006E0  SBCI R20,0xFF Subtract immediate with carry 

000006E1  SBCI R21,0xFF Subtract immediate with carry 

000006E2  RET Subroutine return 

000006E3  COM R25 One's complement 

000006E4  COM R24 One's complement 

000006E5  COM R23 One's complement 

000006E6  NEG R22 Two's complement 

000006E7  SBCI R23,0xFF Subtract immediate with carry 

000006E8  SBCI R24,0xFF Subtract immediate with carry 

000006E9  SBCI R25,0xFF Subtract immediate with carry 

000006EA  RET Subroutine return 

000006EB  MUL R26,R18 Multiply unsigned 

000006EC  MOVW R22,R0 Copy register pair 

000006ED  MUL R27,R19 Multiply unsigned 

--- No source file -------------------------------------------------------------

000006EE  MOVW R24,R0 Copy register pair 

000006EF  MUL R26,R19 Multiply unsigned 

000006F0  ADD R23,R0 Add without carry 

000006F1  ADC R24,R1 Add with carry 

000006F2  CLR R1 Clear Register 

000006F3  ADC R25,R1 Add with carry 

000006F4  MUL R27,R18 Multiply unsigned 

000006F5  ADD R23,R0 Add without carry 

000006F6  ADC R24,R1 Add with carry 

000006F7  CLR R1 Clear Register 

000006F8  ADC R25,R1 Add with carry 

000006F9  RET Subroutine return 

000006FA  LDI R26,0x21 Load immediate 

000006FB  MOV R1,R26 Copy register 

000006FC  SUB R26,R26 Subtract without carry 

000006FD  SUB R27,R27 Subtract without carry 

000006FE  MOVW R30,R26 Copy register pair 

000006FF  RJMP PC+0x000E Relative jump 

00000700  ROL R26 Rotate Left Through Carry 

00000701  ROL R27 Rotate Left Through Carry 

--- No source file -------------------------------------------------------------

00000702  ROL R30 Rotate Left Through Carry 

00000703  ROL R31 Rotate Left Through Carry 

00000704  CP R26,R18 Compare 

00000705  CPC R27,R19 Compare with carry 

00000706  CPC R30,R20 Compare with carry 

00000707  CPC R31,R21 Compare with carry 

00000708  BRCS PC+0x05 Branch if carry set 

00000709  SUB R26,R18 Subtract without carry 

0000070A  SBC R27,R19 Subtract with carry 

0000070B  SBC R30,R20 Subtract with carry 

0000070C  SBC R31,R21 Subtract with carry 

0000070D  ROL R22 Rotate Left Through Carry 

0000070E  ROL R23 Rotate Left Through Carry 

0000070F  ROL R24 Rotate Left Through Carry 

00000710  ROL R25 Rotate Left Through Carry 

00000711  DEC R1 Decrement 

00000712  BRNE PC-0x12 Branch if not equal 

00000713  COM R22 One's complement 

00000714  COM R23 One's complement 

00000715  COM R24 One's complement 

--- No source file -------------------------------------------------------------

00000716  COM R25 One's complement 

00000717  MOVW R18,R22 Copy register pair 

00000718  MOVW R20,R24 Copy register pair 

00000719  MOVW R22,R26 Copy register pair 

0000071A  MOVW R24,R30 Copy register pair 

0000071B  RET Subroutine return 

0000071C  CLI Global Interrupt Disable 

0000071D  RJMP PC-0x0000 Relative jump 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sir/Madam,

 

The Atmel ICE periodically signals the RESET to Atxmega128A1U. See attached snapshots.

The RESET signal silenced after removing Atmel ICE.

 

What, in the code, is triggering the Atmel ICE to generated RESET signal to Atxmega128A1U ?

 

Sincerely,

Liu Wang

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The issue has been fixed.

Thank you all for the comments.

 

Sincerely,

Liu Wang