MCUdude / MicroCore

A light-weight Arduino hardware package for ATtiny13
552 stars 87 forks source link

Error compiled for attiny13A #143

Closed EmSerg74 closed 1 year ago

EmSerg74 commented 1 year ago

Hi, on the oscilloscope, it generates a square wave with a duty cycle of 50%, but this cannot be in the code! my code:

int main(void){
uint8_t course;
uint8_t course_old;
PORTB = B0010000;
DDRB  = B00001111;
while(1){
course = (uint8_t) bitRead(PINB, 4);
if(course != course_old){
  delayMicroseconds(30);
  course_old = course;
}
if(course>0){

  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;
  PORTB = B00010001;

  PORTB = B00010000;

  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;
  PORTB = B00010010;

  PORTB = B00010000; 

} else {

  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;

  PORTB = B00010000;

  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;

  PORTB = B00010000;  
}
}        
return 0; 
}  

Here such garbage is compiled. For a long time I could not understand why my code did not work until I saw this:

C:\Users\USER\AppData\Local\Temp\arduino_build_827036/sketch_jan12a.ino.elf:     file format elf32-avr

Disassembly of section .text:

00000000 <__vectors>:
__vectors():
   0:   09 c0           rjmp    .+18        ; 0x14 <__ctors_end>
   2:   dc c0           rjmp    .+440       ; 0x1bc <__bad_interrupt>
   4:   db c0           rjmp    .+438       ; 0x1bc <__bad_interrupt>
   6:   da c0           rjmp    .+436       ; 0x1bc <__bad_interrupt>
   8:   d9 c0           rjmp    .+434       ; 0x1bc <__bad_interrupt>
   a:   d8 c0           rjmp    .+432       ; 0x1bc <__bad_interrupt>
   c:   d7 c0           rjmp    .+430       ; 0x1bc <__bad_interrupt>
   e:   d6 c0           rjmp    .+428       ; 0x1bc <__bad_interrupt>
  10:   d5 c0           rjmp    .+426       ; 0x1bc <__bad_interrupt>
  12:   d4 c0           rjmp    .+424       ; 0x1bc <__bad_interrupt>

00000014 <__ctors_end>:
__trampolines_start():
  14:   11 24           eor r1, r1
  16:   1f be           out 0x3f, r1    ; 63
  18:   cf e9           ldi r28, 0x9F   ; 159
  1a:   cd bf           out 0x3d, r28   ; 61
  1c:   01 d0           rcall   .+2         ; 0x20 <main>
  1e:   cf c0           rjmp    .+414       ; 0x1be <_exit>

00000020 <main>:
main():
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:5

int main(void){
uint8_t course;
uint8_t course_old;
PORTB = B0010000;
  20:   80 e1           ldi r24, 0x10   ; 16
  22:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:6
DDRB  = B00001111;
  24:   8f e0           ldi r24, 0x0F   ; 15
  26:   87 bb           out 0x17, r24   ; 23
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:113

  PORTB = B00010000; 

} else {

  PORTB = B00010100;
  28:   94 e1           ldi r25, 0x14   ; 20
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:159
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;
  PORTB = B00010100;

  PORTB = B00010000;
  2a:   50 e1           ldi r21, 0x10   ; 16
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:161

  PORTB = B00011000;
  2c:   88 e1           ldi r24, 0x18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:15
  delayMicroseconds(30);
  course_old = course;
}
if(course>0){

  PORTB = B00010001;
  2e:   21 e1           ldi r18, 0x11   ; 17
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:63
  PORTB = B00010001;
  PORTB = B00010001;

  PORTB = B00010000;

  PORTB = B00010010;
  30:   32 e1           ldi r19, 0x12   ; 18
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:8
uint8_t course;
uint8_t course_old;
PORTB = B0010000;
DDRB  = B00001111;
while(1){
course = (uint8_t) bitRead(PINB, 4);
  32:   46 b3           in  r20, 0x16   ; 22
  34:   42 95           swap    r20
  36:   41 70           andi    r20, 0x01   ; 1
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:9
if(course != course_old){
  38:   64 17           cp  r22, r20
  3a:   19 f0           breq    .+6         ; 0x42 <__SREG__+0x3>
_delay_us():
c:\users\user\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\util/delay.h:276
    #else
        //round up by default
        __ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
    #endif

    __builtin_avr_delay_cycles(__ticks_dc);
  3c:   60 e6           ldi r22, 0x60   ; 96
  3e:   6a 95           dec r22
  40:   f1 f7           brne    .-4         ; 0x3e <__SP_L__+0x1>
main():
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:13
  delayMicroseconds(30);
  course_old = course;
}
if(course>0){
  42:   44 23           and r20, r20
  44:   09 f4           brne    .+2         ; 0x48 <__SREG__+0x9>
  46:   5e c0           rjmp    .+188       ; 0x104 <__stack+0x65>
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:15

  PORTB = B00010001;
  48:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:16
  PORTB = B00010001;
  4a:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:17
  PORTB = B00010001;
  4c:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:18
  PORTB = B00010001;
  4e:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:19
  PORTB = B00010001;
  50:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:20
  PORTB = B00010001;
  52:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:21
  PORTB = B00010001;
  54:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:22
  PORTB = B00010001;
  56:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:23
  PORTB = B00010001;
  58:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:24
  PORTB = B00010001;
  5a:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:25
  PORTB = B00010001;
  5c:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:26
  PORTB = B00010001;
  5e:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:27
  PORTB = B00010001;
  60:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:28
  PORTB = B00010001;
  62:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:29
  PORTB = B00010001;
  64:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:30
  PORTB = B00010001;
  66:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:31
  PORTB = B00010001;
  68:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:32
  PORTB = B00010001;
  6a:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:33
  PORTB = B00010001;
  6c:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:34
  PORTB = B00010001;
  6e:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:35
  PORTB = B00010001;
  70:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:36
  PORTB = B00010001;
  72:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:37
  PORTB = B00010001;
  74:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:38
  PORTB = B00010001;
  76:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:39
  PORTB = B00010001;
  78:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:40
  PORTB = B00010001;
  7a:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:41
  PORTB = B00010001;
  7c:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:42
  PORTB = B00010001;
  7e:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:43
  PORTB = B00010001;
  80:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:44
  PORTB = B00010001;
  82:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:45
  PORTB = B00010001;
  84:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:46
  PORTB = B00010001;
  86:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:47
  PORTB = B00010001;
  88:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:48
  PORTB = B00010001;
  8a:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:49
  PORTB = B00010001;
  8c:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:50
  PORTB = B00010001;
  8e:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:51
  PORTB = B00010001;
  90:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:52
  PORTB = B00010001;
  92:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:53
  PORTB = B00010001;
  94:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:54
  PORTB = B00010001;
  96:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:55
  PORTB = B00010001;
  98:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:56
  PORTB = B00010001;
  9a:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:57
  PORTB = B00010001;
  9c:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:58
  PORTB = B00010001;
  9e:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:59
  PORTB = B00010001;
  a0:   28 bb           out 0x18, r18   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:61

  PORTB = B00010000;
  a2:   58 bb           out 0x18, r21   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:63

  PORTB = B00010010;
  a4:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:64
  PORTB = B00010010;
  a6:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:65
  PORTB = B00010010;
  a8:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:66
  PORTB = B00010010;
  aa:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:67
  PORTB = B00010010;
  ac:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:68
  PORTB = B00010010;
  ae:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:69
  PORTB = B00010010;
  b0:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:70
  PORTB = B00010010;
  b2:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:71
  PORTB = B00010010;
  b4:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:72
  PORTB = B00010010;
  b6:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:73
  PORTB = B00010010;
  b8:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:74
  PORTB = B00010010;
  ba:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:75
  PORTB = B00010010;
  bc:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:76
  PORTB = B00010010;
  be:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:77
  PORTB = B00010010;
  c0:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:78
  PORTB = B00010010;
  c2:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:79
  PORTB = B00010010;
  c4:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:80
  PORTB = B00010010;
  c6:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:81
  PORTB = B00010010;
  c8:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:82
  PORTB = B00010010;
  ca:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:83
  PORTB = B00010010;
  cc:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:84
  PORTB = B00010010;
  ce:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:85
  PORTB = B00010010;
  d0:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:86
  PORTB = B00010010;
  d2:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:87
  PORTB = B00010010;
  d4:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:88
  PORTB = B00010010;
  d6:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:89
  PORTB = B00010010;
  d8:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:90
  PORTB = B00010010;
  da:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:91
  PORTB = B00010010;
  dc:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:92
  PORTB = B00010010;
  de:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:93
  PORTB = B00010010;
  e0:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:94
  PORTB = B00010010;
  e2:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:95
  PORTB = B00010010;
  e4:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:96
  PORTB = B00010010;
  e6:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:97
  PORTB = B00010010;
  e8:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:98
  PORTB = B00010010;
  ea:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:99
  PORTB = B00010010;
  ec:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:100
  PORTB = B00010010;
  ee:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:101
  PORTB = B00010010;
  f0:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:102
  PORTB = B00010010;
  f2:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:103
  PORTB = B00010010;
  f4:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:104
  PORTB = B00010010;
  f6:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:105
  PORTB = B00010010;
  f8:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:106
  PORTB = B00010010;
  fa:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:107
  PORTB = B00010010;
  fc:   38 bb           out 0x18, r19   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:207
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;
  PORTB = B00011000;

  PORTB = B00010000;  
  fe:   58 bb           out 0x18, r21   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:8
uint8_t course;
uint8_t course_old;
PORTB = B0010000;
DDRB  = B00001111;
while(1){
course = (uint8_t) bitRead(PINB, 4);
 100:   64 2f           mov r22, r20
 102:   97 cf           rjmp    .-210       ; 0x32 <main+0x12>
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:113

  PORTB = B00010000; 

} else {

  PORTB = B00010100;
 104:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:114
  PORTB = B00010100;
 106:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:115
  PORTB = B00010100;
 108:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:116
  PORTB = B00010100;
 10a:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:117
  PORTB = B00010100;
 10c:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:118
  PORTB = B00010100;
 10e:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:119
  PORTB = B00010100;
 110:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:120
  PORTB = B00010100;
 112:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:121
  PORTB = B00010100;
 114:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:122
  PORTB = B00010100;
 116:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:123
  PORTB = B00010100;
 118:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:124
  PORTB = B00010100;
 11a:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:125
  PORTB = B00010100;
 11c:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:126
  PORTB = B00010100;
 11e:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:127
  PORTB = B00010100;
 120:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:128
  PORTB = B00010100;
 122:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:129
  PORTB = B00010100;
 124:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:130
  PORTB = B00010100;
 126:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:131
  PORTB = B00010100;
 128:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:132
  PORTB = B00010100;
 12a:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:133
  PORTB = B00010100;
 12c:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:134
  PORTB = B00010100;
 12e:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:135
  PORTB = B00010100;
 130:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:136
  PORTB = B00010100;
 132:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:137
  PORTB = B00010100;
 134:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:138
  PORTB = B00010100;
 136:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:139
  PORTB = B00010100;
 138:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:140
  PORTB = B00010100;
 13a:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:141
  PORTB = B00010100;
 13c:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:142
  PORTB = B00010100;
 13e:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:143
  PORTB = B00010100;
 140:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:144
  PORTB = B00010100;
 142:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:145
  PORTB = B00010100;
 144:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:146
  PORTB = B00010100;
 146:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:147
  PORTB = B00010100;
 148:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:148
  PORTB = B00010100;
 14a:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:149
  PORTB = B00010100;
 14c:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:150
  PORTB = B00010100;
 14e:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:151
  PORTB = B00010100;
 150:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:152
  PORTB = B00010100;
 152:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:153
  PORTB = B00010100;
 154:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:154
  PORTB = B00010100;
 156:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:155
  PORTB = B00010100;
 158:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:156
  PORTB = B00010100;
 15a:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:157
  PORTB = B00010100;
 15c:   98 bb           out 0x18, r25   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:159

  PORTB = B00010000;
 15e:   58 bb           out 0x18, r21   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:161

  PORTB = B00011000;
 160:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:162
  PORTB = B00011000;
 162:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:163
  PORTB = B00011000;
 164:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:164
  PORTB = B00011000;
 166:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:165
  PORTB = B00011000;
 168:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:166
  PORTB = B00011000;
 16a:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:167
  PORTB = B00011000;
 16c:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:168
  PORTB = B00011000;
 16e:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:169
  PORTB = B00011000;
 170:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:170
  PORTB = B00011000;
 172:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:171
  PORTB = B00011000;
 174:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:172
  PORTB = B00011000;
 176:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:173
  PORTB = B00011000;
 178:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:174
  PORTB = B00011000;
 17a:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:175
  PORTB = B00011000;
 17c:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:176
  PORTB = B00011000;
 17e:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:177
  PORTB = B00011000;
 180:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:178
  PORTB = B00011000;
 182:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:179
  PORTB = B00011000;
 184:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:180
  PORTB = B00011000;
 186:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:181
  PORTB = B00011000;
 188:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:182
  PORTB = B00011000;
 18a:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:183
  PORTB = B00011000;
 18c:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:184
  PORTB = B00011000;
 18e:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:185
  PORTB = B00011000;
 190:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:186
  PORTB = B00011000;
 192:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:187
  PORTB = B00011000;
 194:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:188
  PORTB = B00011000;
 196:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:189
  PORTB = B00011000;
 198:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:190
  PORTB = B00011000;
 19a:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:191
  PORTB = B00011000;
 19c:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:192
  PORTB = B00011000;
 19e:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:193
  PORTB = B00011000;
 1a0:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:194
  PORTB = B00011000;
 1a2:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:195
  PORTB = B00011000;
 1a4:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:196
  PORTB = B00011000;
 1a6:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:197
  PORTB = B00011000;
 1a8:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:198
  PORTB = B00011000;
 1aa:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:199
  PORTB = B00011000;
 1ac:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:200
  PORTB = B00011000;
 1ae:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:201
  PORTB = B00011000;
 1b0:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:202
  PORTB = B00011000;
 1b2:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:203
  PORTB = B00011000;
 1b4:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:204
  PORTB = B00011000;
 1b6:   88 bb           out 0x18, r24   ; 24
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_476804/sketch_jan12a.ino:205
  PORTB = B00011000;
 1b8:   88 bb           out 0x18, r24   ; 24
 1ba:   a1 cf           rjmp    .-190       ; 0xfe <__stack+0x5f>

000001bc <__bad_interrupt>:
__vector_1():
 1bc:   21 cf           rjmp    .-446       ; 0x0 <__vectors>

000001be <_exit>:
exit():
/home/jenkins-mingw32/workspace/avr-gcc-staging/label/Ubuntu14.04x64-mingw32/gcc-build/avr/avr25/tiny-stack/libgcc/../../../../../gcc/libgcc/config/avr/lib1funcs.S:2278
 1be:   f8 94           cli

000001c0 <__stop_program>:
__stop_program():
/home/jenkins-mingw32/workspace/avr-gcc-staging/label/Ubuntu14.04x64-mingw32/gcc-build/avr/avr25/tiny-stack/libgcc/../../../../../gcc/libgcc/config/avr/lib1funcs.S:2280
 1c0:   ff cf           rjmp    .-2         ; 0x1c0 <__stop_program>
MCUdude commented 1 year ago

I don't know what you want me to do.

Try adding cli(); before your loop, and replace delayMicroseconds, which is interrupt based, with _delay_us.

EmSerg74 commented 1 year ago

This foto is for the first post: IMG_20230113_091658_1

If you use this code:

// PRG_2 (MCUDUDE MicroCore 2.2.0 (ATINY13); int9.6MHz; Micros enable)
// PB4=1; PB3=644kHz; (0=1.44us; 1=104ns)
// PB4=0; PB0=540kHz; (0=1.52us; 1=320ns)
int main(void){
uint8_t course;
uint8_t course_old;
PORTB = B00010000;
DDRB  = B00001111;
while(1){
course = (uint8_t) bitRead(PINB, 4);    // ?=if not (uint8_t) then 32bit!
if(course != course_old){
    delayMicroseconds(30);
    course_old = course;
}
if(course>0){  
  PORTB = B00010001;
  PORTB = B00010000;  
  PORTB = B00010010;
  PORTB = B00010000;
} else {
  PORTB = B00010100;
  PORTB = B00010000;
  PORTB = B00011000;
  PORTB = B00010000;
}
}
}

then the result will be like this: IMG_20230113_095522 & IMG_20230113_102808

If you delete delay:

// PRG_2 (MCUDUDE MicroCore 2.2.0 (ATINY13); int9.6MHz; Micros disable)
// PB4=1; PB3=1207kHz; (0=720ns;  1=104ns)
// PB4=0; PB0=  880kHz; (0=816ns;  1=312ns)
int main(void){
uint8_t course;
uint8_t course_old;
PORTB = B00010000;
DDRB  = B00001111;
while(1){
course = (uint8_t) bitRead(PINB, 4);    // ?=if not (uint8_t) then 32bit!
if(course != course_old){
//  delayMicroseconds(30);                 //  
    course_old = course;
}
if(course>0){  
  PORTB = B00010001;
  PORTB = B00010000;  
  PORTB = B00010010;
  PORTB = B00010000;
} else {
  PORTB = B00010100;
  PORTB = B00010000;
  PORTB = B00011000;
  PORTB = B00010000;
}
} 
}

then we will get this result: IMG_20230113_103645 IMG_20230113_103208

I understand that the ARDUINO IDE code is much larger and contains a lot of garbage, so it is very slow. Why use conversion if it works chaotically? People think that their code works correctly, but they are mistaken and spend time on it, and then they get disappointed. Why give hope in this way that they will be able to learn programming? (as a result, they realize that they have been deceived and begin to study atmel studio.)

EmSerg74 commented 1 year ago

I think it is clear what we are talking about, in the last code, when the output PB4 = 0 or 1 on the pin, the signal on PB0-PB3 should have the same frequency and waveform - almost a meander due to the setting frequency of 9.6MHz. But this is not happening. Maybe I should use the WinAVR program instead of the cli()?

MCUdude commented 1 year ago

I understand that the ARDUINO IDE code is much larger and contains a lot of garbage, so it is very slow. Why use conversion if it works chaotically? People think that their code works correctly, but they are mistaken and spend time on it, and then they get disappointed.

That's why 3rd party cores exist. MicroCore is pretty much as efficient as C code can get for AVR. I also tend not to discuss with people that are not interested in a solution, and instead just want to be rude.

if you don't use void setup() and void loop() in your code, but instead use int main(), the compiler won't include any Arduino code, and you're working bare metal. What you decide to add to your program is your choice. You won't get significantly better performance by using WinAVR or Atmel Studio.

The only "Arduino code" in this program is bitRead, which is just this macro: #define bitRead(value, bit) (((value) >> (bit)) & 0x01). If your code is slow, you're to blame.

delayMicroseconds is a timer-based function, and there are good reasons to sometimes use this instead of _delay_us.

int main(void){
uint8_t course;
uint8_t course_old;
PORTB = B00010000;
DDRB  = B00001111;
while(1){
course = (uint8_t) bitRead(PINB, 4);    // ?=if not (uint8_t) then 32bit!
if(course != course_old){
//  delayMicroseconds(30);                 //  
    course_old = course;
}
if(course>0){  
  PORTB = B00010001;
  PORTB = B00010000;  
  PORTB = B00010010;
  PORTB = B00010000;
} else {
  PORTB = B00010100;
  PORTB = B00010000;
  PORTB = B00011000;
  PORTB = B00010000;
}
} 
}

If you really want code that can toggle a pin really fast, try this instead:

int main()
{
  DDRB |= 1 << PB2;
  while(1)
  {
    PINB = 1 <<PB2;
  }
}
EmSerg74 commented 1 year ago

I know about such a fast code, but it doesn't fit me by definition. I need to generate a signal with a frequency of 100kHz on two pins. When switching the input signal level, the signal generation should be on the other two pins. When switching the input signal, there should be a delay and on all pins the signal = 0. The maximum frequency on the Arduino IDE is 79kHz and 82kHz, depending on the input signal. It is the difference in the generated frequencies that creates the problem. With frequent switching, the difference of 3kHz is an audible sound range. This is the main problem, and the second problem is the inability to reach a frequency of 100 kHz using an internal quartz at 9.6 MHz.

When I tried to use the code faster (the command POTRB = 1; is executed in one clock cycle, and bitWrite(PORTB,0,1); or PORTB |= _BV(pin); are executed in two clock cycles,) I was never able to compensate for the frequency difference. How to make the signal generation be the same and equal to 100kHz?

MCUdude commented 1 year ago

If you need a stable 100kHz signal, this can be achieved using the internal timer. Note that the internal 9.6 MHz RC oscillator is usually a bit off, so you'll have two tweak the OCR0A/OCR0B values to get as close to 100kHz as possible. However, when using the timer, you'll stuck with pin PB0 and PB1.

void setup() {

// Disable all interrupts
TIMSK0 |= (0<< OCIE0B) | (0<<OCIE0A) | (0<<TOIE0);

// Define outputs
DDRB = (1<<DDB4) | (1<<DDB3) | (1<<DDB2) | (1<<DDB1) | (1<<DDB0);

// Enable CTC
TCCR0A |= (1<<WGM01) | (0<<WGM00); 
TCCR0B |= (0<<WGM02);

// 9.6MHz / 100kHz (should be 43 if the internal oscillator were accurate)
OCR0A = 44;
OCR0B = 44;

// Toggle on Compare Match
TCCR0A |= (0<<COM0A1) | (1<<COM0A0) | (0<<COM0B1) | (1<<COM0B0);

// No prescaler
TCCR0B |= (0<<CS02) | (0<<CS02) | (1<<CS00);

// Make it start
GTCCR |= (1<<PSR10);

// Force one invert
TCCR0B |= (1<<FOC0B);
}

void loop() {
}
mcuee commented 1 year ago

I think this issue can probably be closed.