Can the code from Tiny13 be used on Tiny85?

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

Guys,

 

Can the code from Tiny13 be used on Tiny85 ?

 

I tried to init port on Tiny85 from the code Tiny13, it doesn't give me a response ?? why is it ??

 

Thanks

 

*A more sensible title provided. Try harder next time please. Moderator*
 

Last Edited: Fri. Sep 4, 2015 - 10:45 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you recompile the code for the tiny85 or just download code that was compiled for the tiny13?

Regards,
Steve A.

The Board helps those that help themselves.

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

yes I recompile the code from Tiny13 and then upload it to tiny85....is there anything I must change ?

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

One could check the datasheet for the 13 and 85 and make sure all the registers are at the same addresses. One could check to see if they have the same ram size. This has to do with initializing the stack pointer. I think it would be so easy to make another dir, copy the files into it, change the target avr type and recompile?

 

Imagecraft compiler user

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

One could check the datasheet ...

One could also post the code, and tell what is expected, and what "doesn't work".

 

Of course if the code for the old model used anything hard-coded it would be different with the new model.

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

The code :

// structure to allow bit field operations, name conversions: PORTA.0 -> PORT_A.b0  PORTB.7 -> PORT_B.b7
typedef struct{ uint8_t b0:1;
	uint8_t b1:1;
	uint8_t b2:1;
	uint8_t b3:1;
	uint8_t b4:1;
	uint8_t b5:1;
	 } bits;

// define all the ports of your microcontroller, add more ports depending on the available mcu ports
#define PORT_B (* (volatile bits *) &PORTB)

int main(void)
{
	
	
	 
	DDRB = 0x3F;
	 
    while(1)
	
    {
		
	
		test_LED();
		
		
		
		
		//TODO:: Please write your application code 
    }
}

test_LED()
{
	//PORTB = 0x00;
	
	
	PORT_B.b0 = 1; 
    _delay_ms(50);
	PORT_B.b0 = 0;
}

 

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

That cannot be the complete program:

$ avr-gcc -mmcu=attiny85 -Os -g avr.c -o avr.elf
avr.c:2:17: error: expected specifier-qualifier-list before ‘uint8_t’
avr.c: In function ‘main’:
avr.c:18:2: error: ‘DDRB’ undeclared (first use in this function)
avr.c:18:2: note: each undeclared identifier is reported only once for each function it appears in
avr.c: In function ‘test_LED’:
avr.c:39:2: error: ‘PORTB’ undeclared (first use in this function)

There must surely be an include of <avr/io.h> above what you have shown? If I add that I then get:

$ avr-gcc -mmcu=attiny85 -Os -g avr.c -o avr.elf
/tmp/ccFIweO9.o: In function `test_LED':
/home/uid23021/avr.c:41: undefined reference to `_delay_ms'
collect2: ld returned 1 exit status

which suggests that it needs <util/delay.h> too:

$ avr-gcc -mmcu=attiny85 -Os -g avr.c -o avr.elf
In file included from avr.c:2:0:
/usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h:90:3: warning: #warning "F_CPU not defined for <util/delay.h>"

At least that builds and I find:

$ avr-objdump -S avr.elf

avr.elf:     file format elf32-avr


Disassembly of section .text:

00000000 <__vectors>:
   0:	0e c0       	rjmp	.+28     	; 0x1e <__ctors_end>
   2:	15 c0       	rjmp	.+42     	; 0x2e <__bad_interrupt>
   4:	14 c0       	rjmp	.+40     	; 0x2e <__bad_interrupt>
   6:	13 c0       	rjmp	.+38     	; 0x2e <__bad_interrupt>
   8:	12 c0       	rjmp	.+36     	; 0x2e <__bad_interrupt>
   a:	11 c0       	rjmp	.+34     	; 0x2e <__bad_interrupt>
   c:	10 c0       	rjmp	.+32     	; 0x2e <__bad_interrupt>
   e:	0f c0       	rjmp	.+30     	; 0x2e <__bad_interrupt>
  10:	0e c0       	rjmp	.+28     	; 0x2e <__bad_interrupt>
  12:	0d c0       	rjmp	.+26     	; 0x2e <__bad_interrupt>
  14:	0c c0       	rjmp	.+24     	; 0x2e <__bad_interrupt>
  16:	0b c0       	rjmp	.+22     	; 0x2e <__bad_interrupt>
  18:	0a c0       	rjmp	.+20     	; 0x2e <__bad_interrupt>
  1a:	09 c0       	rjmp	.+18     	; 0x2e <__bad_interrupt>
  1c:	08 c0       	rjmp	.+16     	; 0x2e <__bad_interrupt>

0000001e <__ctors_end>:
  1e:	11 24       	eor	r1, r1
  20:	1f be       	out	0x3f, r1	; 63
  22:	cf e5       	ldi	r28, 0x5F	; 95
  24:	d2 e0       	ldi	r29, 0x02	; 2
  26:	de bf       	out	0x3e, r29	; 62
  28:	cd bf       	out	0x3d, r28	; 61
  2a:	0b d0       	rcall	.+22     	; 0x42 <main>
  2c:	0e c0       	rjmp	.+28     	; 0x4a <_exit>

0000002e <__bad_interrupt>:
  2e:	e8 cf       	rjmp	.-48     	; 0x0 <__vectors>

00000030 <test_LED>:
test_LED()
{
	//PORTB = 0x00;
	
	
	PORT_B.b0 = 1; 
  30:	c0 9a       	sbi	0x18, 0	; 24
	#else
		//round up by default
		__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
	#endif

	__builtin_avr_delay_cycles(__ticks_dc);
  32:	83 ed       	ldi	r24, 0xD3	; 211
  34:	90 e3       	ldi	r25, 0x30	; 48
  36:	01 97       	sbiw	r24, 0x01	; 1
  38:	f1 f7       	brne	.-4      	; 0x36 <__CCP__+0x2>
  3a:	00 c0       	rjmp	.+0      	; 0x3c <__CCP__+0x8>
  3c:	00 00       	nop
    _delay_ms(50);
	PORT_B.b0 = 0;
  3e:	c0 98       	cbi	0x18, 0	; 24
}
  40:	08 95       	ret

00000042 <main>:
int main(void)
{
	
	
	 
	DDRB = 0x3F;
  42:	8f e3       	ldi	r24, 0x3F	; 63
  44:	87 bb       	out	0x17, r24	; 23
    while(1)
	
    {
		
	
		test_LED();
  46:	f4 df       	rcall	.-24     	; 0x30 <test_LED>
  48:	fe cf       	rjmp	.-4      	; 0x46 <main+0x4>

0000004a <_exit>:
  4a:	f8 94       	cli

0000004c <__stop_program>:
  4c:	ff cf       	rjmp	.-2      	; 0x4c <__stop_program>

But something is immediately obvious (I should have seen this in the C):

test_LED()
{
	//PORTB = 0x00;
	
	
	PORT_B.b0 = 1; 
    _delay_ms(50);
	PORT_B.b0 = 0;
}

so what happens here? It sets the port bit to 1 (you can see the SBI in the disassembly), it delays, it sets the bit to 0 (again the CBI) but it then immediately (and I mean IMMEDIATELY!) re-enters the function and sets the bit to 1 again. The bit is 0 for only a few machine cycles. You are going to need bloody good eyesight to see that "off" period!!! May I suggest:

test_LED()
{
    PORT_B.b0 = 1; 
    _delay_ms(50);
    PORT_B.b0 = 0;
    _delay_ms(50);
}

Which gives you a chance (though 50m is still pretty short) to see the LED in both its states.

 

What puzzle me is that you seem to be saying this "worked" on the tiny13 but does not work on the tiny85? I can't see how it can have worked (that is do something observable) on either?! Were you measuring the port activity with a scope rather than an LED or something?

 

Anyway the reason I built the code was to check that the PORTB and DDRB addresses were being correctly accessed. For OUT/SBI/CBI on a tiny85 they are 0x17/0x18 so the code looks right in that sense.

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

Here we go the complete one and it works well on attiny13A, I have some boards with this code...

/*
 * main.c
 *
 * Created: 2/09/2015 8:35:36 PM
 *  Author: antonius
 */ 


#define F_CPU 8000000UL  // 8 MHz

#include <avr/io.h>
//#include <avr/interrupt.h>
//#include <avr/pgmspace.h>
#include <util/delay.h>

// structure to allow bit field operations, name conversions: PORTA.0 -> PORT_A.b0  PORTB.7 -> PORT_B.b7
typedef struct{ uint8_t b0:1;
	uint8_t b1:1;
	uint8_t b2:1;
	uint8_t b3:1;
	uint8_t b4:1;
	uint8_t b5:1;
	 } bits;

// define all the ports of your microcontroller, add more ports depending on the available mcu ports
#define PORT_B (* (volatile bits *) &PORTB)

test_LED()
{
	//PORTB = 0x00;
	
	PORTB = 0x00;
	_delay_ms(200);
	PORTB = 0xFF;
	
	/*
	PORT_B.b0 = 1; 
    _delay_ms(50);
	PORT_B.b0 = 0;
	/*
	PORT_B.b1 = 1;
	_delay_ms(50);
	PORT_B.b1 = 0;
	
	
	
	PORT_B.b2 = 1;
	_delay_ms(50);
	PORT_B.b2 = 0;
	
	PORT_B.b4 = 1;
	_delay_ms(50);
	PORT_B.b4 = 0;
	
	
	
	PORT_B.b3 = 1;
	_delay_ms(50);
	PORT_B.b3 = 0;
	
	PORT_B.b5 = 1;
	_delay_ms(50);
	PORT_B.b5 = 0;
	*/
	
}

LED_1()
{
	PORTB = 0xFF;
	_delay_ms(15);
	PORTB = 0x00;
		
}

LED_2()
{
	
	
	//PORTB ^= (0 << LED0);
	PORT_B.b0 = 1;
	_delay_ms(50);
	PORT_B.b1 = 1;
	_delay_ms(50);
	PORT_B.b2 = 1;
	_delay_ms(50);
	PORT_B.b4 = 1;
	_delay_ms(50);
	PORT_B.b3 = 1;
	_delay_ms(50);
	PORT_B.b5 = 1;
	_delay_ms(100);
	PORT_B.b5 = 0;
	_delay_ms(50);
	PORT_B.b3 = 0;
	_delay_ms(50);
	PORT_B.b4 = 0;
	_delay_ms(50);
	PORT_B.b2 = 0;
	_delay_ms(50);
	PORT_B.b1 = 0;
	_delay_ms(50);
	PORT_B.b0 = 0;
    PORTB = 0x00;
	_delay_ms(75);

}

LED_3()
{
	
	//PORTB ^= (0 << LED0);
	PORT_B.b0 = 1;
	_delay_ms(15);
	PORT_B.b1 = 1;
	_delay_ms(15);
	PORT_B.b2 = 1;
	_delay_ms(15);
	PORT_B.b4 = 1;
	_delay_ms(15);
	PORT_B.b3 = 1;
	_delay_ms(15);
	PORT_B.b5 = 1;
    
	PORT_B.b0 = 0;
	_delay_ms(15);
	PORT_B.b1 = 0;
	_delay_ms(15);
	PORT_B.b2 = 0;
	_delay_ms(15);
	PORT_B.b4 = 0;
	_delay_ms(15);
	PORT_B.b3 = 0;
	_delay_ms(15);
	PORT_B.b5 = 0;

}

LED_4()
{
	PORT_B.b0 = 1;
	PORT_B.b1 = 1;
	PORT_B.b2 = 1;
	_delay_ms(200);
	PORT_B.b0 = 0;
	PORT_B.b1 = 0;
	PORT_B.b2 = 0;
	
	PORT_B.b3 = 1;
	PORT_B.b4 = 1;
	PORT_B.b5 = 1;
	_delay_ms(200);
	PORT_B.b3 = 0;
	PORT_B.b4 = 0;
	PORT_B.b5 = 0;
    
	PORT_B.b0 = 1;
	PORT_B.b1 = 1;
	PORT_B.b2 = 1;
	_delay_ms(20);
	PORT_B.b0 = 0;
	PORT_B.b1 = 0;
	PORT_B.b2 = 0;
	
	PORT_B.b3 = 1;
	PORT_B.b4 = 1;
	PORT_B.b5 = 1;
	_delay_ms(20);
	PORT_B.b3 = 0;
	PORT_B.b4 = 0;
	PORT_B.b5 = 0;
	
	
 

}

LED_5()
{
	//PORTB = 0x00;
	PORT_B.b0 = 1;
	PORT_B.b5 = 1;
	_delay_ms(150);
	PORT_B.b1 = 1;
	PORT_B.b3 = 1;
	_delay_ms(150);
	PORT_B.b2 = 1;
	PORT_B.b4 = 1;
	_delay_ms(150);
	PORT_B.b0 = 0;
	PORT_B.b5 = 0;
	_delay_ms(150);
	PORT_B.b1 = 0;
	PORT_B.b3 = 0;
	_delay_ms(150);
	PORT_B.b2 = 0;
	PORT_B.b4 = 0;
	PORTB=0x00;	
	_delay_ms(100);
	
}

LED_6()
{
	
	
    
    
	PORT_B.b2 =1;
	_delay_ms(15);
	PORT_B.b1 =1;
	_delay_ms(15);
	PORT_B.b0 =1;
	_delay_ms(15);
	
	
	
	PORT_B.b2 =0;
	_delay_ms(15);
	PORT_B.b1 =0;
	_delay_ms(15);
	PORT_B.b0 =0;
	
 	
}

void PWMOut(uint8_t out)
{
	OCR0A=out;
}

void LED_0_brightness()
{
	uint8_t b=0;
	//set timer 0 as Fast PWM
	 TCCR0A|=(1<<WGM00)|(1<<WGM01)|(1<<COM0A1)|(0<<COM0A0);
	 TCCR0B|=(1<<CS00);
	 
	 for(b=0;b<255;b++)
	 {
		 //set brightness with PWM

		 PWMOut(b);

		 
		_delay_us(500);
	 }
	 
	 _delay_ms(500);
	 
	  for(b=255;b>0;b--)
	  {
		  //set brightness with PWM

		  PWMOut(b);

		  
		  _delay_us(500);
	  }
	  
	   //_delay_ms(100);
	   //return to normal port
       TCCR0A=0x00;
	   TCCR0B=0x00;
	   }

void PWMOut_1(uint8_t out)
{
	OCR0B=out;
}	   
	   
void LED_1_brightness()
{
	uint8_t b=0;
	//set timer 0 as Fast PWM
	TCCR0A|=(1<<WGM00)|(1<<WGM01)|(1<<COM0B1)|(0<<COM0B0);
	TCCR0B|=(1<<CS00);
	
	for(b=0;b<255;b++)
	{
		//set brightness with PWM

		PWMOut_1(b);

		
		_delay_us(500);
	}
	
	_delay_ms(500);
	
	for(b=255;b>0;b--)
	{
		//set brightness with PWM

		PWMOut_1(b);

		
		_delay_us(500);
	}
	
	_delay_ms(100);
	//return to normal port
	TCCR0A=0x00;
	TCCR0B=0x00;
}	   


int main(void)
{
	
	
	 
	DDRB = 0x3F;
	 
    while(1)
	
    {
		
		LED_0_brightness();
		
		LED_1_brightness();
		PORTB =0x00;
		//DDRB = 0x3F;
		test_LED();
		
		
		LED_1();
		
		LED_2();	                    
        				
		LED_3();	             
	      	
		LED_4();
		
		LED_5();	
		
		LED_6();  
		
		//TODO:: Please write your application code 
    }
}

 

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

OK and what about that does not work on the tiny85 then?

 

(BTW why only 6 bits in your bitfield? You may only be using it on micro with 6 bits to a port today but convention says bits are numbered 0 to 7 and there's eight of them - it'll bite you in future if you don't define all eight)chksum

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

I don't understand ....why isn't it working ?......Anything I missed here ?

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

From avrdude :

avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"

         Using Port                    : lpt1
         Using Programmer              : usbasp
         AVR Part                      : ATtiny85
         Chip Erase delay              : 4500 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65     6     4    0 no        512    4      0  4000  4500 0xff 0xff
           flash         65     6    32    0 yes      8192   64    128  4500  4500 0xff 0xff
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          2    0      0     0     0 0x00 0x00

         Programmer Type : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.06s

avrdude: Device signature = 0x1e930b
avrdude: safemode: lfuse reads as 62
avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as FF

avrdude: safemode: lfuse reads as 62
avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as FF
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

 

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

bianchi77 wrote:

I don't understand ....why isn't it working ?......Anything I missed here ?

 

WHAT isn't working?

 

What does it not do?

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

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

Why can't flip the value of PORTB on attiny85....?

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

Your fuses have the chip running at 1MHz (CLKDIV8 is 0).

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

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

Oh, and how are you dealing with the fact that PortB.5 is also the /RESET pin?

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

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

I'm not changing the fuse yet....so that CLKDIV8 must be 1 ? and I will get 8 MHz ?

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

I have put CLKDIV8 = 1 and still no response... .?

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

Why can't flip the value of PORTB on attiny85....?

Which bit? How do you know it cannot be flipped? Which line in the source are you expecting to do this flipping? How have you confirmed that line is actually being executed?

 

If I had to guess (and let's face it, what else have we got at this stage in a typical Bianchi77 thread?) then I'd say you are building for the wrong model, the stack is not being set to a valid RAM address so any function calls are not returning as expected - but that's pure conjecture with so little to go on.

 

Can you post the lss file so se can check details like stack location and IO addresses used for PORTB etc.

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

Ok, no problem, here we go the lss file, I don't know much assembly language for avr, I did before with PIC....but never with avr.....anyway thanks for the suggestion....

 


Tiny85LED.elf:     file format elf32-avr

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000404  00000000  00000000  00000074  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data         00000000  00800060  00000404  00000478  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  2 .stab         000006cc  00000000  00000000  00000478  2**2
                  CONTENTS, READONLY, DEBUGGING
  3 .stabstr      00000097  00000000  00000000  00000b44  2**0
                  CONTENTS, READONLY, DEBUGGING
  4 .comment      0000002f  00000000  00000000  00000bdb  2**0
                  CONTENTS, READONLY
  5 .debug_aranges 00000078  00000000  00000000  00000c0a  2**0
                  CONTENTS, READONLY, DEBUGGING
  6 .debug_info   00000f1c  00000000  00000000  00000c82  2**0
                  CONTENTS, READONLY, DEBUGGING
  7 .debug_abbrev 00000206  00000000  00000000  00001b9e  2**0
                  CONTENTS, READONLY, DEBUGGING
  8 .debug_line   00000495  00000000  00000000  00001da4  2**0
                  CONTENTS, READONLY, DEBUGGING
  9 .debug_frame  000000e4  00000000  00000000  0000223c  2**2
                  CONTENTS, READONLY, DEBUGGING
 10 .debug_str    0000018a  00000000  00000000  00002320  2**0
                  CONTENTS, READONLY, DEBUGGING
 11 .debug_loc    00000098  00000000  00000000  000024aa  2**0
                  CONTENTS, READONLY, DEBUGGING
 12 .debug_ranges 00000068  00000000  00000000  00002542  2**0
                  CONTENTS, READONLY, DEBUGGING

Disassembly of section .text:

00000000 <__vectors>:
   0:	0e c0       	rjmp	.+28     	; 0x1e <__ctors_end>
   2:	15 c0       	rjmp	.+42     	; 0x2e <__bad_interrupt>
   4:	14 c0       	rjmp	.+40     	; 0x2e <__bad_interrupt>
   6:	13 c0       	rjmp	.+38     	; 0x2e <__bad_interrupt>
   8:	12 c0       	rjmp	.+36     	; 0x2e <__bad_interrupt>
   a:	11 c0       	rjmp	.+34     	; 0x2e <__bad_interrupt>
   c:	10 c0       	rjmp	.+32     	; 0x2e <__bad_interrupt>
   e:	0f c0       	rjmp	.+30     	; 0x2e <__bad_interrupt>
  10:	0e c0       	rjmp	.+28     	; 0x2e <__bad_interrupt>
  12:	0d c0       	rjmp	.+26     	; 0x2e <__bad_interrupt>
  14:	0c c0       	rjmp	.+24     	; 0x2e <__bad_interrupt>
  16:	0b c0       	rjmp	.+22     	; 0x2e <__bad_interrupt>
  18:	0a c0       	rjmp	.+20     	; 0x2e <__bad_interrupt>
  1a:	09 c0       	rjmp	.+18     	; 0x2e <__bad_interrupt>
  1c:	08 c0       	rjmp	.+16     	; 0x2e <__bad_interrupt>

0000001e <__ctors_end>:
  1e:	11 24       	eor	r1, r1
  20:	1f be       	out	0x3f, r1	; 63
  22:	cf e5       	ldi	r28, 0x5F	; 95
  24:	d2 e0       	ldi	r29, 0x02	; 2
  26:	de bf       	out	0x3e, r29	; 62
  28:	cd bf       	out	0x3d, r28	; 61
  2a:	dd d1       	rcall	.+954    	; 0x3e6 <main>
  2c:	e9 c1       	rjmp	.+978    	; 0x400 <_exit>

0000002e <__bad_interrupt>:
  2e:	e8 cf       	rjmp	.-48     	; 0x0 <__vectors>

00000030 <test_LED>:

test_LED()
{
	//PORTB = 0x00;
	
	PORTB = 0x00;
  30:	18 ba       	out	0x18, r1	; 24
	#else
		//round up by default
		__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
	#endif

	__builtin_avr_delay_cycles(__ticks_dc);
  32:	2f ef       	ldi	r18, 0xFF	; 255
  34:	81 ee       	ldi	r24, 0xE1	; 225
  36:	94 e0       	ldi	r25, 0x04	; 4
  38:	21 50       	subi	r18, 0x01	; 1
  3a:	80 40       	sbci	r24, 0x00	; 0
  3c:	90 40       	sbci	r25, 0x00	; 0
  3e:	e1 f7       	brne	.-8      	; 0x38 <test_LED+0x8>
  40:	00 c0       	rjmp	.+0      	; 0x42 <__SREG__+0x3>
  42:	00 00       	nop
	_delay_ms(200);
	PORTB = 0xFF;
  44:	8f ef       	ldi	r24, 0xFF	; 255
  46:	88 bb       	out	0x18, r24	; 24
	PORT_B.b5 = 1;
	_delay_ms(50);
	PORT_B.b5 = 0;
	*/
	
}
  48:	08 95       	ret

0000004a <LED_1>:

LED_1()
{
	PORTB = 0xFF;
  4a:	8f ef       	ldi	r24, 0xFF	; 255
  4c:	88 bb       	out	0x18, r24	; 24
  4e:	8f e2       	ldi	r24, 0x2F	; 47
  50:	95 e7       	ldi	r25, 0x75	; 117
  52:	01 97       	sbiw	r24, 0x01	; 1
  54:	f1 f7       	brne	.-4      	; 0x52 <LED_1+0x8>
  56:	00 c0       	rjmp	.+0      	; 0x58 <LED_1+0xe>
  58:	00 00       	nop
	_delay_ms(15);
	PORTB = 0x00;
  5a:	18 ba       	out	0x18, r1	; 24
		
}
  5c:	08 95       	ret

0000005e <LED_2>:
LED_2()
{
	
	
	//PORTB ^= (0 << LED0);
	PORT_B.b0 = 1;
  5e:	c0 9a       	sbi	0x18, 0	; 24
  60:	2f e7       	ldi	r18, 0x7F	; 127
  62:	88 e3       	ldi	r24, 0x38	; 56
  64:	91 e0       	ldi	r25, 0x01	; 1
  66:	21 50       	subi	r18, 0x01	; 1
  68:	80 40       	sbci	r24, 0x00	; 0
  6a:	90 40       	sbci	r25, 0x00	; 0
  6c:	e1 f7       	brne	.-8      	; 0x66 <LED_2+0x8>
  6e:	00 c0       	rjmp	.+0      	; 0x70 <LED_2+0x12>
  70:	00 00       	nop
	_delay_ms(50);
	PORT_B.b1 = 1;
  72:	c1 9a       	sbi	0x18, 1	; 24
  74:	2f e7       	ldi	r18, 0x7F	; 127
  76:	88 e3       	ldi	r24, 0x38	; 56
  78:	91 e0       	ldi	r25, 0x01	; 1
  7a:	21 50       	subi	r18, 0x01	; 1
  7c:	80 40       	sbci	r24, 0x00	; 0
  7e:	90 40       	sbci	r25, 0x00	; 0
  80:	e1 f7       	brne	.-8      	; 0x7a <LED_2+0x1c>
  82:	00 c0       	rjmp	.+0      	; 0x84 <LED_2+0x26>
  84:	00 00       	nop
	_delay_ms(50);
	PORT_B.b2 = 1;
  86:	c2 9a       	sbi	0x18, 2	; 24
  88:	2f e7       	ldi	r18, 0x7F	; 127
  8a:	88 e3       	ldi	r24, 0x38	; 56
  8c:	91 e0       	ldi	r25, 0x01	; 1
  8e:	21 50       	subi	r18, 0x01	; 1
  90:	80 40       	sbci	r24, 0x00	; 0
  92:	90 40       	sbci	r25, 0x00	; 0
  94:	e1 f7       	brne	.-8      	; 0x8e <LED_2+0x30>
  96:	00 c0       	rjmp	.+0      	; 0x98 <LED_2+0x3a>
  98:	00 00       	nop
	_delay_ms(50);
	PORT_B.b4 = 1;
  9a:	c4 9a       	sbi	0x18, 4	; 24
  9c:	2f e7       	ldi	r18, 0x7F	; 127
  9e:	88 e3       	ldi	r24, 0x38	; 56
  a0:	91 e0       	ldi	r25, 0x01	; 1
  a2:	21 50       	subi	r18, 0x01	; 1
  a4:	80 40       	sbci	r24, 0x00	; 0
  a6:	90 40       	sbci	r25, 0x00	; 0
  a8:	e1 f7       	brne	.-8      	; 0xa2 <LED_2+0x44>
  aa:	00 c0       	rjmp	.+0      	; 0xac <LED_2+0x4e>
  ac:	00 00       	nop
	_delay_ms(50);
	PORT_B.b3 = 1;
  ae:	c3 9a       	sbi	0x18, 3	; 24
  b0:	2f e7       	ldi	r18, 0x7F	; 127
  b2:	88 e3       	ldi	r24, 0x38	; 56
  b4:	91 e0       	ldi	r25, 0x01	; 1
  b6:	21 50       	subi	r18, 0x01	; 1
  b8:	80 40       	sbci	r24, 0x00	; 0
  ba:	90 40       	sbci	r25, 0x00	; 0
  bc:	e1 f7       	brne	.-8      	; 0xb6 <LED_2+0x58>
  be:	00 c0       	rjmp	.+0      	; 0xc0 <LED_2+0x62>
  c0:	00 00       	nop
	_delay_ms(50);
	PORT_B.b5 = 1;
  c2:	c5 9a       	sbi	0x18, 5	; 24
  c4:	2f ef       	ldi	r18, 0xFF	; 255
  c6:	80 e7       	ldi	r24, 0x70	; 112
  c8:	92 e0       	ldi	r25, 0x02	; 2
  ca:	21 50       	subi	r18, 0x01	; 1
  cc:	80 40       	sbci	r24, 0x00	; 0
  ce:	90 40       	sbci	r25, 0x00	; 0
  d0:	e1 f7       	brne	.-8      	; 0xca <LED_2+0x6c>
  d2:	00 c0       	rjmp	.+0      	; 0xd4 <LED_2+0x76>
  d4:	00 00       	nop
	_delay_ms(100);
	PORT_B.b5 = 0;
  d6:	c5 98       	cbi	0x18, 5	; 24
  d8:	2f e7       	ldi	r18, 0x7F	; 127
  da:	88 e3       	ldi	r24, 0x38	; 56
  dc:	91 e0       	ldi	r25, 0x01	; 1
  de:	21 50       	subi	r18, 0x01	; 1
  e0:	80 40       	sbci	r24, 0x00	; 0
  e2:	90 40       	sbci	r25, 0x00	; 0
  e4:	e1 f7       	brne	.-8      	; 0xde <LED_2+0x80>
  e6:	00 c0       	rjmp	.+0      	; 0xe8 <LED_2+0x8a>
  e8:	00 00       	nop
	_delay_ms(50);
	PORT_B.b3 = 0;
  ea:	c3 98       	cbi	0x18, 3	; 24
  ec:	2f e7       	ldi	r18, 0x7F	; 127
  ee:	88 e3       	ldi	r24, 0x38	; 56
  f0:	91 e0       	ldi	r25, 0x01	; 1
  f2:	21 50       	subi	r18, 0x01	; 1
  f4:	80 40       	sbci	r24, 0x00	; 0
  f6:	90 40       	sbci	r25, 0x00	; 0
  f8:	e1 f7       	brne	.-8      	; 0xf2 <LED_2+0x94>
  fa:	00 c0       	rjmp	.+0      	; 0xfc <LED_2+0x9e>
  fc:	00 00       	nop
	_delay_ms(50);
	PORT_B.b4 = 0;
  fe:	c4 98       	cbi	0x18, 4	; 24
 100:	2f e7       	ldi	r18, 0x7F	; 127
 102:	88 e3       	ldi	r24, 0x38	; 56
 104:	91 e0       	ldi	r25, 0x01	; 1
 106:	21 50       	subi	r18, 0x01	; 1
 108:	80 40       	sbci	r24, 0x00	; 0
 10a:	90 40       	sbci	r25, 0x00	; 0
 10c:	e1 f7       	brne	.-8      	; 0x106 <LED_2+0xa8>
 10e:	00 c0       	rjmp	.+0      	; 0x110 <LED_2+0xb2>
 110:	00 00       	nop
	_delay_ms(50);
	PORT_B.b2 = 0;
 112:	c2 98       	cbi	0x18, 2	; 24
 114:	2f e7       	ldi	r18, 0x7F	; 127
 116:	88 e3       	ldi	r24, 0x38	; 56
 118:	91 e0       	ldi	r25, 0x01	; 1
 11a:	21 50       	subi	r18, 0x01	; 1
 11c:	80 40       	sbci	r24, 0x00	; 0
 11e:	90 40       	sbci	r25, 0x00	; 0
 120:	e1 f7       	brne	.-8      	; 0x11a <LED_2+0xbc>
 122:	00 c0       	rjmp	.+0      	; 0x124 <LED_2+0xc6>
 124:	00 00       	nop
	_delay_ms(50);
	PORT_B.b1 = 0;
 126:	c1 98       	cbi	0x18, 1	; 24
 128:	2f e7       	ldi	r18, 0x7F	; 127
 12a:	88 e3       	ldi	r24, 0x38	; 56
 12c:	91 e0       	ldi	r25, 0x01	; 1
 12e:	21 50       	subi	r18, 0x01	; 1
 130:	80 40       	sbci	r24, 0x00	; 0
 132:	90 40       	sbci	r25, 0x00	; 0
 134:	e1 f7       	brne	.-8      	; 0x12e <LED_2+0xd0>
 136:	00 c0       	rjmp	.+0      	; 0x138 <LED_2+0xda>
 138:	00 00       	nop
	_delay_ms(50);
	PORT_B.b0 = 0;
 13a:	c0 98       	cbi	0x18, 0	; 24
    PORTB = 0x00;
 13c:	18 ba       	out	0x18, r1	; 24
 13e:	2f eb       	ldi	r18, 0xBF	; 191
 140:	84 ed       	ldi	r24, 0xD4	; 212
 142:	91 e0       	ldi	r25, 0x01	; 1
 144:	21 50       	subi	r18, 0x01	; 1
 146:	80 40       	sbci	r24, 0x00	; 0
 148:	90 40       	sbci	r25, 0x00	; 0
 14a:	e1 f7       	brne	.-8      	; 0x144 <LED_2+0xe6>
 14c:	00 c0       	rjmp	.+0      	; 0x14e <LED_2+0xf0>
 14e:	00 00       	nop
	_delay_ms(75);

}
 150:	08 95       	ret

00000152 <LED_3>:

LED_3()
{
	
	//PORTB ^= (0 << LED0);
	PORT_B.b0 = 1;
 152:	c0 9a       	sbi	0x18, 0	; 24
 154:	8f e2       	ldi	r24, 0x2F	; 47
 156:	95 e7       	ldi	r25, 0x75	; 117
 158:	01 97       	sbiw	r24, 0x01	; 1
 15a:	f1 f7       	brne	.-4      	; 0x158 <LED_3+0x6>
 15c:	00 c0       	rjmp	.+0      	; 0x15e <LED_3+0xc>
 15e:	00 00       	nop
	_delay_ms(15);
	PORT_B.b1 = 1;
 160:	c1 9a       	sbi	0x18, 1	; 24
 162:	8f e2       	ldi	r24, 0x2F	; 47
 164:	95 e7       	ldi	r25, 0x75	; 117
 166:	01 97       	sbiw	r24, 0x01	; 1
 168:	f1 f7       	brne	.-4      	; 0x166 <LED_3+0x14>
 16a:	00 c0       	rjmp	.+0      	; 0x16c <LED_3+0x1a>
 16c:	00 00       	nop
	_delay_ms(15);
	PORT_B.b2 = 1;
 16e:	c2 9a       	sbi	0x18, 2	; 24
 170:	8f e2       	ldi	r24, 0x2F	; 47
 172:	95 e7       	ldi	r25, 0x75	; 117
 174:	01 97       	sbiw	r24, 0x01	; 1
 176:	f1 f7       	brne	.-4      	; 0x174 <LED_3+0x22>
 178:	00 c0       	rjmp	.+0      	; 0x17a <LED_3+0x28>
 17a:	00 00       	nop
	_delay_ms(15);
	PORT_B.b4 = 1;
 17c:	c4 9a       	sbi	0x18, 4	; 24
 17e:	8f e2       	ldi	r24, 0x2F	; 47
 180:	95 e7       	ldi	r25, 0x75	; 117
 182:	01 97       	sbiw	r24, 0x01	; 1
 184:	f1 f7       	brne	.-4      	; 0x182 <LED_3+0x30>
 186:	00 c0       	rjmp	.+0      	; 0x188 <LED_3+0x36>
 188:	00 00       	nop
	_delay_ms(15);
	PORT_B.b3 = 1;
 18a:	c3 9a       	sbi	0x18, 3	; 24
 18c:	8f e2       	ldi	r24, 0x2F	; 47
 18e:	95 e7       	ldi	r25, 0x75	; 117
 190:	01 97       	sbiw	r24, 0x01	; 1
 192:	f1 f7       	brne	.-4      	; 0x190 <LED_3+0x3e>
 194:	00 c0       	rjmp	.+0      	; 0x196 <LED_3+0x44>
 196:	00 00       	nop
	_delay_ms(15);
	PORT_B.b5 = 1;
 198:	c5 9a       	sbi	0x18, 5	; 24
    
	PORT_B.b0 = 0;
 19a:	c0 98       	cbi	0x18, 0	; 24
 19c:	8f e2       	ldi	r24, 0x2F	; 47
 19e:	95 e7       	ldi	r25, 0x75	; 117
 1a0:	01 97       	sbiw	r24, 0x01	; 1
 1a2:	f1 f7       	brne	.-4      	; 0x1a0 <LED_3+0x4e>
 1a4:	00 c0       	rjmp	.+0      	; 0x1a6 <LED_3+0x54>
 1a6:	00 00       	nop
	_delay_ms(15);
	PORT_B.b1 = 0;
 1a8:	c1 98       	cbi	0x18, 1	; 24
 1aa:	8f e2       	ldi	r24, 0x2F	; 47
 1ac:	95 e7       	ldi	r25, 0x75	; 117
 1ae:	01 97       	sbiw	r24, 0x01	; 1
 1b0:	f1 f7       	brne	.-4      	; 0x1ae <LED_3+0x5c>
 1b2:	00 c0       	rjmp	.+0      	; 0x1b4 <LED_3+0x62>
 1b4:	00 00       	nop
	_delay_ms(15);
	PORT_B.b2 = 0;
 1b6:	c2 98       	cbi	0x18, 2	; 24
 1b8:	8f e2       	ldi	r24, 0x2F	; 47
 1ba:	95 e7       	ldi	r25, 0x75	; 117
 1bc:	01 97       	sbiw	r24, 0x01	; 1
 1be:	f1 f7       	brne	.-4      	; 0x1bc <LED_3+0x6a>
 1c0:	00 c0       	rjmp	.+0      	; 0x1c2 <LED_3+0x70>
 1c2:	00 00       	nop
	_delay_ms(15);
	PORT_B.b4 = 0;
 1c4:	c4 98       	cbi	0x18, 4	; 24
 1c6:	8f e2       	ldi	r24, 0x2F	; 47
 1c8:	95 e7       	ldi	r25, 0x75	; 117
 1ca:	01 97       	sbiw	r24, 0x01	; 1
 1cc:	f1 f7       	brne	.-4      	; 0x1ca <LED_3+0x78>
 1ce:	00 c0       	rjmp	.+0      	; 0x1d0 <LED_3+0x7e>
 1d0:	00 00       	nop
	_delay_ms(15);
	PORT_B.b3 = 0;
 1d2:	c3 98       	cbi	0x18, 3	; 24
 1d4:	8f e2       	ldi	r24, 0x2F	; 47
 1d6:	95 e7       	ldi	r25, 0x75	; 117
 1d8:	01 97       	sbiw	r24, 0x01	; 1
 1da:	f1 f7       	brne	.-4      	; 0x1d8 <LED_3+0x86>
 1dc:	00 c0       	rjmp	.+0      	; 0x1de <LED_3+0x8c>
 1de:	00 00       	nop
	_delay_ms(15);
	PORT_B.b5 = 0;
 1e0:	c5 98       	cbi	0x18, 5	; 24

}
 1e2:	08 95       	ret

000001e4 <LED_4>:

LED_4()
{
	PORT_B.b0 = 1;
 1e4:	c0 9a       	sbi	0x18, 0	; 24
	PORT_B.b1 = 1;
 1e6:	c1 9a       	sbi	0x18, 1	; 24
	PORT_B.b2 = 1;
 1e8:	c2 9a       	sbi	0x18, 2	; 24
 1ea:	2f ef       	ldi	r18, 0xFF	; 255
 1ec:	81 ee       	ldi	r24, 0xE1	; 225
 1ee:	94 e0       	ldi	r25, 0x04	; 4
 1f0:	21 50       	subi	r18, 0x01	; 1
 1f2:	80 40       	sbci	r24, 0x00	; 0
 1f4:	90 40       	sbci	r25, 0x00	; 0
 1f6:	e1 f7       	brne	.-8      	; 0x1f0 <LED_4+0xc>
 1f8:	00 c0       	rjmp	.+0      	; 0x1fa <LED_4+0x16>
 1fa:	00 00       	nop
	_delay_ms(200);
	PORT_B.b0 = 0;
 1fc:	c0 98       	cbi	0x18, 0	; 24
	PORT_B.b1 = 0;
 1fe:	c1 98       	cbi	0x18, 1	; 24
	PORT_B.b2 = 0;
 200:	c2 98       	cbi	0x18, 2	; 24
	
	PORT_B.b3 = 1;
 202:	c3 9a       	sbi	0x18, 3	; 24
	PORT_B.b4 = 1;
 204:	c4 9a       	sbi	0x18, 4	; 24
	PORT_B.b5 = 1;
 206:	c5 9a       	sbi	0x18, 5	; 24
 208:	2f ef       	ldi	r18, 0xFF	; 255
 20a:	81 ee       	ldi	r24, 0xE1	; 225
 20c:	94 e0       	ldi	r25, 0x04	; 4
 20e:	21 50       	subi	r18, 0x01	; 1
 210:	80 40       	sbci	r24, 0x00	; 0
 212:	90 40       	sbci	r25, 0x00	; 0
 214:	e1 f7       	brne	.-8      	; 0x20e <LED_4+0x2a>
 216:	00 c0       	rjmp	.+0      	; 0x218 <LED_4+0x34>
 218:	00 00       	nop
	_delay_ms(200);
	PORT_B.b3 = 0;
 21a:	c3 98       	cbi	0x18, 3	; 24
	PORT_B.b4 = 0;
 21c:	c4 98       	cbi	0x18, 4	; 24
	PORT_B.b5 = 0;
 21e:	c5 98       	cbi	0x18, 5	; 24
    
	PORT_B.b0 = 1;
 220:	c0 9a       	sbi	0x18, 0	; 24
	PORT_B.b1 = 1;
 222:	c1 9a       	sbi	0x18, 1	; 24
	PORT_B.b2 = 1;
 224:	c2 9a       	sbi	0x18, 2	; 24
 226:	8f e3       	ldi	r24, 0x3F	; 63
 228:	9c e9       	ldi	r25, 0x9C	; 156
 22a:	01 97       	sbiw	r24, 0x01	; 1
 22c:	f1 f7       	brne	.-4      	; 0x22a <LED_4+0x46>
 22e:	00 c0       	rjmp	.+0      	; 0x230 <LED_4+0x4c>
 230:	00 00       	nop
	_delay_ms(20);
	PORT_B.b0 = 0;
 232:	c0 98       	cbi	0x18, 0	; 24
	PORT_B.b1 = 0;
 234:	c1 98       	cbi	0x18, 1	; 24
	PORT_B.b2 = 0;
 236:	c2 98       	cbi	0x18, 2	; 24
	
	PORT_B.b3 = 1;
 238:	c3 9a       	sbi	0x18, 3	; 24
	PORT_B.b4 = 1;
 23a:	c4 9a       	sbi	0x18, 4	; 24
	PORT_B.b5 = 1;
 23c:	c5 9a       	sbi	0x18, 5	; 24
 23e:	8f e3       	ldi	r24, 0x3F	; 63
 240:	9c e9       	ldi	r25, 0x9C	; 156
 242:	01 97       	sbiw	r24, 0x01	; 1
 244:	f1 f7       	brne	.-4      	; 0x242 <LED_4+0x5e>
 246:	00 c0       	rjmp	.+0      	; 0x248 <LED_4+0x64>
 248:	00 00       	nop
	_delay_ms(20);
	PORT_B.b3 = 0;
 24a:	c3 98       	cbi	0x18, 3	; 24
	PORT_B.b4 = 0;
 24c:	c4 98       	cbi	0x18, 4	; 24
	PORT_B.b5 = 0;
 24e:	c5 98       	cbi	0x18, 5	; 24
	
	
 

}
 250:	08 95       	ret

00000252 <LED_5>:

LED_5()
{
	//PORTB = 0x00;
	PORT_B.b0 = 1;
 252:	c0 9a       	sbi	0x18, 0	; 24
	PORT_B.b5 = 1;
 254:	c5 9a       	sbi	0x18, 5	; 24
 256:	2f e7       	ldi	r18, 0x7F	; 127
 258:	89 ea       	ldi	r24, 0xA9	; 169
 25a:	93 e0       	ldi	r25, 0x03	; 3
 25c:	21 50       	subi	r18, 0x01	; 1
 25e:	80 40       	sbci	r24, 0x00	; 0
 260:	90 40       	sbci	r25, 0x00	; 0
 262:	e1 f7       	brne	.-8      	; 0x25c <LED_5+0xa>
 264:	00 c0       	rjmp	.+0      	; 0x266 <__stack+0x7>
 266:	00 00       	nop
	_delay_ms(150);
	PORT_B.b1 = 1;
 268:	c1 9a       	sbi	0x18, 1	; 24
	PORT_B.b3 = 1;
 26a:	c3 9a       	sbi	0x18, 3	; 24
 26c:	2f e7       	ldi	r18, 0x7F	; 127
 26e:	89 ea       	ldi	r24, 0xA9	; 169
 270:	93 e0       	ldi	r25, 0x03	; 3
 272:	21 50       	subi	r18, 0x01	; 1
 274:	80 40       	sbci	r24, 0x00	; 0
 276:	90 40       	sbci	r25, 0x00	; 0
 278:	e1 f7       	brne	.-8      	; 0x272 <__stack+0x13>
 27a:	00 c0       	rjmp	.+0      	; 0x27c <__stack+0x1d>
 27c:	00 00       	nop
	_delay_ms(150);
	PORT_B.b2 = 1;
 27e:	c2 9a       	sbi	0x18, 2	; 24
	PORT_B.b4 = 1;
 280:	c4 9a       	sbi	0x18, 4	; 24
 282:	2f e7       	ldi	r18, 0x7F	; 127
 284:	89 ea       	ldi	r24, 0xA9	; 169
 286:	93 e0       	ldi	r25, 0x03	; 3
 288:	21 50       	subi	r18, 0x01	; 1
 28a:	80 40       	sbci	r24, 0x00	; 0
 28c:	90 40       	sbci	r25, 0x00	; 0
 28e:	e1 f7       	brne	.-8      	; 0x288 <__stack+0x29>
 290:	00 c0       	rjmp	.+0      	; 0x292 <__stack+0x33>
 292:	00 00       	nop
	_delay_ms(150);
	PORT_B.b0 = 0;
 294:	c0 98       	cbi	0x18, 0	; 24
	PORT_B.b5 = 0;
 296:	c5 98       	cbi	0x18, 5	; 24
 298:	2f e7       	ldi	r18, 0x7F	; 127
 29a:	89 ea       	ldi	r24, 0xA9	; 169
 29c:	93 e0       	ldi	r25, 0x03	; 3
 29e:	21 50       	subi	r18, 0x01	; 1
 2a0:	80 40       	sbci	r24, 0x00	; 0
 2a2:	90 40       	sbci	r25, 0x00	; 0
 2a4:	e1 f7       	brne	.-8      	; 0x29e <__stack+0x3f>
 2a6:	00 c0       	rjmp	.+0      	; 0x2a8 <__stack+0x49>
 2a8:	00 00       	nop
	_delay_ms(150);
	PORT_B.b1 = 0;
 2aa:	c1 98       	cbi	0x18, 1	; 24
	PORT_B.b3 = 0;
 2ac:	c3 98       	cbi	0x18, 3	; 24
 2ae:	2f e7       	ldi	r18, 0x7F	; 127
 2b0:	89 ea       	ldi	r24, 0xA9	; 169
 2b2:	93 e0       	ldi	r25, 0x03	; 3
 2b4:	21 50       	subi	r18, 0x01	; 1
 2b6:	80 40       	sbci	r24, 0x00	; 0
 2b8:	90 40       	sbci	r25, 0x00	; 0
 2ba:	e1 f7       	brne	.-8      	; 0x2b4 <__stack+0x55>
 2bc:	00 c0       	rjmp	.+0      	; 0x2be <__stack+0x5f>
 2be:	00 00       	nop
	_delay_ms(150);
	PORT_B.b2 = 0;
 2c0:	c2 98       	cbi	0x18, 2	; 24
	PORT_B.b4 = 0;
 2c2:	c4 98       	cbi	0x18, 4	; 24
	PORTB=0x00;	
 2c4:	18 ba       	out	0x18, r1	; 24
 2c6:	2f ef       	ldi	r18, 0xFF	; 255
 2c8:	80 e7       	ldi	r24, 0x70	; 112
 2ca:	92 e0       	ldi	r25, 0x02	; 2
 2cc:	21 50       	subi	r18, 0x01	; 1
 2ce:	80 40       	sbci	r24, 0x00	; 0
 2d0:	90 40       	sbci	r25, 0x00	; 0
 2d2:	e1 f7       	brne	.-8      	; 0x2cc <__stack+0x6d>
 2d4:	00 c0       	rjmp	.+0      	; 0x2d6 <__stack+0x77>
 2d6:	00 00       	nop
	_delay_ms(100);
	
}
 2d8:	08 95       	ret

000002da <LED_6>:
{
	
	
    
    
	PORT_B.b2 =1;
 2da:	c2 9a       	sbi	0x18, 2	; 24
 2dc:	8f e2       	ldi	r24, 0x2F	; 47
 2de:	95 e7       	ldi	r25, 0x75	; 117
 2e0:	01 97       	sbiw	r24, 0x01	; 1
 2e2:	f1 f7       	brne	.-4      	; 0x2e0 <LED_6+0x6>
 2e4:	00 c0       	rjmp	.+0      	; 0x2e6 <LED_6+0xc>
 2e6:	00 00       	nop
	_delay_ms(15);
	PORT_B.b1 =1;
 2e8:	c1 9a       	sbi	0x18, 1	; 24
 2ea:	8f e2       	ldi	r24, 0x2F	; 47
 2ec:	95 e7       	ldi	r25, 0x75	; 117
 2ee:	01 97       	sbiw	r24, 0x01	; 1
 2f0:	f1 f7       	brne	.-4      	; 0x2ee <LED_6+0x14>
 2f2:	00 c0       	rjmp	.+0      	; 0x2f4 <LED_6+0x1a>
 2f4:	00 00       	nop
	_delay_ms(15);
	PORT_B.b0 =1;
 2f6:	c0 9a       	sbi	0x18, 0	; 24
 2f8:	8f e2       	ldi	r24, 0x2F	; 47
 2fa:	95 e7       	ldi	r25, 0x75	; 117
 2fc:	01 97       	sbiw	r24, 0x01	; 1
 2fe:	f1 f7       	brne	.-4      	; 0x2fc <LED_6+0x22>
 300:	00 c0       	rjmp	.+0      	; 0x302 <LED_6+0x28>
 302:	00 00       	nop
	_delay_ms(15);
	
	
	
	PORT_B.b2 =0;
 304:	c2 98       	cbi	0x18, 2	; 24
 306:	8f e2       	ldi	r24, 0x2F	; 47
 308:	95 e7       	ldi	r25, 0x75	; 117
 30a:	01 97       	sbiw	r24, 0x01	; 1
 30c:	f1 f7       	brne	.-4      	; 0x30a <LED_6+0x30>
 30e:	00 c0       	rjmp	.+0      	; 0x310 <LED_6+0x36>
 310:	00 00       	nop
	_delay_ms(15);
	PORT_B.b1 =0;
 312:	c1 98       	cbi	0x18, 1	; 24
 314:	8f e2       	ldi	r24, 0x2F	; 47
 316:	95 e7       	ldi	r25, 0x75	; 117
 318:	01 97       	sbiw	r24, 0x01	; 1
 31a:	f1 f7       	brne	.-4      	; 0x318 <LED_6+0x3e>
 31c:	00 c0       	rjmp	.+0      	; 0x31e <LED_6+0x44>
 31e:	00 00       	nop
	_delay_ms(15);
	PORT_B.b0 =0;
 320:	c0 98       	cbi	0x18, 0	; 24
	
 	
}
 322:	08 95       	ret

00000324 <PWMOut>:

void PWMOut(uint8_t out)
{
	OCR0A=out;
 324:	89 bd       	out	0x29, r24	; 41
 326:	08 95       	ret

00000328 <LED_0_brightness>:
}

void LED_0_brightness()
{
 328:	cf 93       	push	r28
	uint8_t b=0;
	//set timer 0 as Fast PWM
	 TCCR0A|=(1<<WGM00)|(1<<WGM01)|(1<<COM0A1)|(0<<COM0A0);
 32a:	8a b5       	in	r24, 0x2a	; 42
 32c:	83 68       	ori	r24, 0x83	; 131
 32e:	8a bd       	out	0x2a, r24	; 42
	 TCCR0B|=(1<<CS00);
 330:	83 b7       	in	r24, 0x33	; 51
 332:	81 60       	ori	r24, 0x01	; 1
 334:	83 bf       	out	0x33, r24	; 51
	 
	 for(b=0;b<255;b++)
 336:	c0 e0       	ldi	r28, 0x00	; 0
	 {
		 //set brightness with PWM

		 PWMOut(b);
 338:	8c 2f       	mov	r24, r28
 33a:	f4 df       	rcall	.-24     	; 0x324 <PWMOut>
	#else
		//round up by default
		__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
	#endif

	__builtin_avr_delay_cycles(__ticks_dc);
 33c:	87 ee       	ldi	r24, 0xE7	; 231
 33e:	93 e0       	ldi	r25, 0x03	; 3
 340:	01 97       	sbiw	r24, 0x01	; 1
 342:	f1 f7       	brne	.-4      	; 0x340 <LED_0_brightness+0x18>
 344:	00 c0       	rjmp	.+0      	; 0x346 <LED_0_brightness+0x1e>
 346:	00 00       	nop
	uint8_t b=0;
	//set timer 0 as Fast PWM
	 TCCR0A|=(1<<WGM00)|(1<<WGM01)|(1<<COM0A1)|(0<<COM0A0);
	 TCCR0B|=(1<<CS00);
	 
	 for(b=0;b<255;b++)
 348:	cf 5f       	subi	r28, 0xFF	; 255
 34a:	cf 3f       	cpi	r28, 0xFF	; 255
 34c:	a9 f7       	brne	.-22     	; 0x338 <LED_0_brightness+0x10>
	#else
		//round up by default
		__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
	#endif

	__builtin_avr_delay_cycles(__ticks_dc);
 34e:	9f ef       	ldi	r25, 0xFF	; 255
 350:	24 e3       	ldi	r18, 0x34	; 52
 352:	8c e0       	ldi	r24, 0x0C	; 12
 354:	91 50       	subi	r25, 0x01	; 1
 356:	20 40       	sbci	r18, 0x00	; 0
 358:	80 40       	sbci	r24, 0x00	; 0
 35a:	e1 f7       	brne	.-8      	; 0x354 <LED_0_brightness+0x2c>
 35c:	00 c0       	rjmp	.+0      	; 0x35e <LED_0_brightness+0x36>
 35e:	00 00       	nop
	 
	  for(b=255;b>0;b--)
	  {
		  //set brightness with PWM

		  PWMOut(b);
 360:	8c 2f       	mov	r24, r28
 362:	e0 df       	rcall	.-64     	; 0x324 <PWMOut>
	#else
		//round up by default
		__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
	#endif

	__builtin_avr_delay_cycles(__ticks_dc);
 364:	87 ee       	ldi	r24, 0xE7	; 231
 366:	93 e0       	ldi	r25, 0x03	; 3
 368:	01 97       	sbiw	r24, 0x01	; 1
 36a:	f1 f7       	brne	.-4      	; 0x368 <LED_0_brightness+0x40>
 36c:	00 c0       	rjmp	.+0      	; 0x36e <LED_0_brightness+0x46>
 36e:	00 00       	nop
		_delay_us(500);
	 }
	 
	 _delay_ms(500);
	 
	  for(b=255;b>0;b--)
 370:	c1 50       	subi	r28, 0x01	; 1
 372:	b1 f7       	brne	.-20     	; 0x360 <LED_0_brightness+0x38>
		  _delay_us(500);
	  }
	  
	   //_delay_ms(100);
	   //return to normal port
       TCCR0A=0x00;
 374:	1a bc       	out	0x2a, r1	; 42
	   TCCR0B=0x00;
 376:	13 be       	out	0x33, r1	; 51
	   }
 378:	cf 91       	pop	r28
 37a:	08 95       	ret

0000037c <PWMOut_1>:

void PWMOut_1(uint8_t out)
{
	OCR0B=out;
 37c:	88 bd       	out	0x28, r24	; 40
 37e:	08 95       	ret

00000380 <LED_1_brightness>:
}	   
	   
void LED_1_brightness()
{
 380:	cf 93       	push	r28
	uint8_t b=0;
	//set timer 0 as Fast PWM
	TCCR0A|=(1<<WGM00)|(1<<WGM01)|(1<<COM0B1)|(0<<COM0B0);
 382:	8a b5       	in	r24, 0x2a	; 42
 384:	83 62       	ori	r24, 0x23	; 35
 386:	8a bd       	out	0x2a, r24	; 42
	TCCR0B|=(1<<CS00);
 388:	83 b7       	in	r24, 0x33	; 51
 38a:	81 60       	ori	r24, 0x01	; 1
 38c:	83 bf       	out	0x33, r24	; 51
	
	for(b=0;b<255;b++)
 38e:	c0 e0       	ldi	r28, 0x00	; 0
	{
		//set brightness with PWM

		PWMOut_1(b);
 390:	8c 2f       	mov	r24, r28
 392:	f4 df       	rcall	.-24     	; 0x37c <PWMOut_1>
 394:	87 ee       	ldi	r24, 0xE7	; 231
 396:	93 e0       	ldi	r25, 0x03	; 3
 398:	01 97       	sbiw	r24, 0x01	; 1
 39a:	f1 f7       	brne	.-4      	; 0x398 <LED_1_brightness+0x18>
 39c:	00 c0       	rjmp	.+0      	; 0x39e <LED_1_brightness+0x1e>
 39e:	00 00       	nop
	uint8_t b=0;
	//set timer 0 as Fast PWM
	TCCR0A|=(1<<WGM00)|(1<<WGM01)|(1<<COM0B1)|(0<<COM0B0);
	TCCR0B|=(1<<CS00);
	
	for(b=0;b<255;b++)
 3a0:	cf 5f       	subi	r28, 0xFF	; 255
 3a2:	cf 3f       	cpi	r28, 0xFF	; 255
 3a4:	a9 f7       	brne	.-22     	; 0x390 <LED_1_brightness+0x10>
	#else
		//round up by default
		__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
	#endif

	__builtin_avr_delay_cycles(__ticks_dc);
 3a6:	9f ef       	ldi	r25, 0xFF	; 255
 3a8:	24 e3       	ldi	r18, 0x34	; 52
 3aa:	8c e0       	ldi	r24, 0x0C	; 12
 3ac:	91 50       	subi	r25, 0x01	; 1
 3ae:	20 40       	sbci	r18, 0x00	; 0
 3b0:	80 40       	sbci	r24, 0x00	; 0
 3b2:	e1 f7       	brne	.-8      	; 0x3ac <LED_1_brightness+0x2c>
 3b4:	00 c0       	rjmp	.+0      	; 0x3b6 <LED_1_brightness+0x36>
 3b6:	00 00       	nop
	
	for(b=255;b>0;b--)
	{
		//set brightness with PWM

		PWMOut_1(b);
 3b8:	8c 2f       	mov	r24, r28
 3ba:	e0 df       	rcall	.-64     	; 0x37c <PWMOut_1>
	#else
		//round up by default
		__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
	#endif

	__builtin_avr_delay_cycles(__ticks_dc);
 3bc:	87 ee       	ldi	r24, 0xE7	; 231
 3be:	93 e0       	ldi	r25, 0x03	; 3
 3c0:	01 97       	sbiw	r24, 0x01	; 1
 3c2:	f1 f7       	brne	.-4      	; 0x3c0 <LED_1_brightness+0x40>
 3c4:	00 c0       	rjmp	.+0      	; 0x3c6 <LED_1_brightness+0x46>
 3c6:	00 00       	nop
		_delay_us(500);
	}
	
	_delay_ms(500);
	
	for(b=255;b>0;b--)
 3c8:	c1 50       	subi	r28, 0x01	; 1
 3ca:	b1 f7       	brne	.-20     	; 0x3b8 <LED_1_brightness+0x38>
	#else
		//round up by default
		__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
	#endif

	__builtin_avr_delay_cycles(__ticks_dc);
 3cc:	9f ef       	ldi	r25, 0xFF	; 255
 3ce:	20 e7       	ldi	r18, 0x70	; 112
 3d0:	82 e0       	ldi	r24, 0x02	; 2
 3d2:	91 50       	subi	r25, 0x01	; 1
 3d4:	20 40       	sbci	r18, 0x00	; 0
 3d6:	80 40       	sbci	r24, 0x00	; 0
 3d8:	e1 f7       	brne	.-8      	; 0x3d2 <LED_1_brightness+0x52>
 3da:	00 c0       	rjmp	.+0      	; 0x3dc <LED_1_brightness+0x5c>
 3dc:	00 00       	nop
		_delay_us(500);
	}
	
	_delay_ms(100);
	//return to normal port
	TCCR0A=0x00;
 3de:	1a bc       	out	0x2a, r1	; 42
	TCCR0B=0x00;
 3e0:	13 be       	out	0x33, r1	; 51
}	   
 3e2:	cf 91       	pop	r28
 3e4:	08 95       	ret

000003e6 <main>:
int main(void)
{
	
	
	 
	DDRB = 0x3F;
 3e6:	8f e3       	ldi	r24, 0x3F	; 63
 3e8:	87 bb       	out	0x17, r24	; 23
	 
    while(1)
	
    {
		
		LED_0_brightness();
 3ea:	9e df       	rcall	.-196    	; 0x328 <LED_0_brightness>
		
		LED_1_brightness();
 3ec:	c9 df       	rcall	.-110    	; 0x380 <LED_1_brightness>
		PORTB =0x00;
 3ee:	18 ba       	out	0x18, r1	; 24
		//DDRB = 0x3F;
		test_LED();
 3f0:	1f de       	rcall	.-962    	; 0x30 <test_LED>
		
		
		LED_1();
 3f2:	2b de       	rcall	.-938    	; 0x4a <LED_1>
		
		LED_2();	                    
 3f4:	34 de       	rcall	.-920    	; 0x5e <LED_2>
        				
		LED_3();	             
 3f6:	ad de       	rcall	.-678    	; 0x152 <LED_3>
	      	
		LED_4();
 3f8:	f5 de       	rcall	.-534    	; 0x1e4 <LED_4>
		
		LED_5();	
 3fa:	2b df       	rcall	.-426    	; 0x252 <LED_5>
		
		LED_6();  
 3fc:	6e df       	rcall	.-292    	; 0x2da <LED_6>
 3fe:	f5 cf       	rjmp	.-22     	; 0x3ea <main+0x4>

00000400 <_exit>:
 400:	f8 94       	cli

00000402 <__stop_program>:
 402:	ff cf       	rjmp	.-2      	; 0x402 <__stop_program>

 

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

You still haven't answered my question about the RESET/PB5 pin.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

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

What title do you suggest me ? ====> *A more sensible title provided. Try harder next time please. Moderator*

 

The more sensible title is now the current title.

Last Edited: Sat. Sep 5, 2015 - 02:27 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I didn't touch  RESET/PB5 pin, it's connected to LED as port....I didn't change it on the fuse as you can see on my fuse setting...

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

RSTDISBL = 1 on my fuse, I rechecked it just now......

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

If the clock = 1 Mhz and my code is working, it will blink with a slow motion.....but this one is nothing at all.....confusing me....

I can write to the chip, I check all the connection and while writing I can see LED blinking.......

 

But the chip isn't doing what I want....strange ??

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

I think attiny13 and attiny85 has a similar characteristic.....but don't know....can't just chuck my tiny13 code to tiny85 straight away....

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

I didn't touch  RESET/PB5 pin, it's connected to LED as port

HUH?? Do you mean that you have a LED connected to the reset pin and the RSTDISBL fuse is not enabled?

 

If this is the case then the LED will either pull the pin low (chip always in reset) or high (depending on how the LED is wired) but will not do anything because it is not configured as an I/O pin.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

I did the same thing with ATtiny13 and it worked ok.....I connect anode to the PB5 and then resistor to the ground....LED active on 1.....

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

Of course PB5 will not give me an output at all,I know that, until I finished the code and disable RST....that's what I did with ATtiny13

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

Is the chip by any chance still in dW mode?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

what does it mean by dW mode ?

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

DebugWire. Have you been doing debug with any debug tools?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Only the AVRFreaks one...

 

Ross McKenzie ValuSoft Melbourne Australia

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

No, I'm not using debug tool....I'm using USBasp for uploading the file...

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

bianchi77 wrote:

I did the same thing with ATtiny13 and it worked ok...

 

But the '85 is a different chip.

 

 

bianchi77 wrote:

...I connect anode to the PB5 and then resistor to the ground....LED active on 1.....

 

So, what voltage does this cause on the /RESET pin?

 

And what effect does it have on the uC?

 

 

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

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

Of course PB5 will not give me an output at all,I know that, until I finished the code and disable RST....that's what I did with ATtiny13

So you know that your code cannot work because you have not disabled  RST.

Still you ask why the code is not working.

I do not understand.

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

But last time I didn't disable RST and it's working fine on ATTiny13.....that's confusing me...???????

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

The reset pin can only be one of two things at time. Either it is RESET and will reset the AVR when pulled low (it's also used during ISP to put the chip into a state where ISP can operate). OR you use your last ever ISP session to enable the RSTDISBL fuse. Now it stops being _reset and starts being an IO line. But, because ISP needs to use _RESET to operate you can never ISP program the chip again so the only way you can now program it is to use high voltage programming.

 

This is as true for a tiny13 as it is for a tiny85. So the only way you can possibly have used the reset pin on a tiny13 as an IO line is because the last time you ever programmed it you changed RSTDISBL.

 

Apart from a bulk production environment where package size or chip price is important there is no reason on earth a home user should ever be messing with RSTDISBL and using _RESET as n IO. If you need more IO lines buy a chip with more pins!

Last Edited: Sat. Sep 5, 2015 - 01:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In my case, I will not use PB5 until I finished my code....so I still can program it and PB0 -- PB4 still work as a port.....

Last time with ATtiny13....I uploaded the code and not messing or doing anything with PB5....I can blink PB0 straight away....no worries.....but with this 85....no response....I don't get it at all ????

Is my code wrong ???

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

Hang on. You've got an LED/resistor connected to /RESET? The simple answer is 'you can't do that'. The fact that it worked on the '13 is pure luck. Without RSTDISBL, there is a weak internal pullup on /RESET pulling it to Vcc. The resistor and LED will however pull it down to slightly higher than the LED's Vf, depending on the LED colour.
For a red LED, this will be about 2V.
The reset threshold voltage for the '13 and the '85 can be anywhere between 20% of Vcc and 90% of Vcc. Exactly where the reset threshold is will depend upon many things, including process variations between devices.
You just got lucky. Remove the LED until you've programmed RSTDISBL.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

Last Edited: Sat. Sep 5, 2015 - 04:11 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In my case, I will not use PB5 until I finished my code....so I still can program it and PB0 -- PB4 still work as a port

Well, then try your code from #6 with clawson's correction in #7.

Led on PB0 blinks.

Tested in simulator.

//tiny85
#define F_CPU 8000000L
#include <avr/io.h>
#include <util/delay.h> 
    
typedef struct{ uint8_t b0:1;
	uint8_t b1:1;
	uint8_t b2:1;
	uint8_t b3:1;
	uint8_t b4:1;
	uint8_t b5:1;
	 } bits;

// define all the ports of your microcontroller, add more ports depending on the available mcu ports
#define PORT_B (* (volatile bits *) &PORTB)

void test_LED(void); // function declaration 


int main(void)
{
   DDRB = 0x3F;

   while(1)
   {
      test_LED();
   }
}

void test_LED(void)
{
	PORT_B.b0 = 1; 
   _delay_ms(50);
	PORT_B.b0 = 0;
   _delay_ms(50);
}

 

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

Ok, I will test the code later on guys, have a nice sunday

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

Thanks guys, I open the LED connected to PB5 and it does the job now.....I will reconnect it after I finish the code and disable RST...

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

Like so many of your threads this could all have been resolved #40 posts earlier if you'd started by giving more details in the first post. Please bear this in mind next time you post unless you really are trolling to create wild goose chases?

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

clawson wrote:

...all have been resolved #40 posts earlier...

 

Well certainly 27 posts earlier where I asked the relevant question and was ignored.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

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

I am reminded of a recent thread...

 

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]