Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:multiasm:exercisesbook:avr:sut:scenarios:avr1 [2026/05/02 12:10] pczekalskien:multiasm:exercisesbook:avr:sut:scenarios:avr1 [2026/05/03 19:19] (current) pczekalski
Line 2: Line 2:
  
 In this scenario, you will implement a classical "Hello World" application. For microcontrollers, the "Hello World" application is a blinking LED. Because we use remote observation via an integrated video camera stream, the proper LED frequency is at most 1 or 2Hz, depending on the connection quality. In this scenario, you will use blocking nested loops and manual calculation of the ticks needed to run them, to obtain precise ''delay'', as presented in the chapter [[..:..:..:arduinouno|]].\\\\ In this scenario, you will implement a classical "Hello World" application. For microcontrollers, the "Hello World" application is a blinking LED. Because we use remote observation via an integrated video camera stream, the proper LED frequency is at most 1 or 2Hz, depending on the connection quality. In this scenario, you will use blocking nested loops and manual calculation of the ticks needed to run them, to obtain precise ''delay'', as presented in the chapter [[..:..:..:arduinouno|]].\\\\
-** Target group **\\ 
-This scenario is for beginners. 
  
 ** Prerequisites **\\ ** Prerequisites **\\
Line 12: Line 10:
  
 ** Result **\\ ** Result **\\
-Observe flashing LED via the video stream.+Flashing LED, observable via video stream.
  
 ** Start **\\ ** Start **\\
 Mind to use AVR GCC syntax (as in the instruction): node compilation facilities are preconfigured, and you do not need to build a Makefile; still, it is necessary to follow the exact AVR GCC syntax, e.g., in the case of ''.equ''. Mind to use AVR GCC syntax (as in the instruction): node compilation facilities are preconfigured, and you do not need to build a Makefile; still, it is necessary to follow the exact AVR GCC syntax, e.g., in the case of ''.equ''.
  
-** Step **\\+** Step **\\
 Compose an empty application with an infinite loop: Compose an empty application with an infinite loop:
 <code asm> <code asm>
Line 30: Line 28:
 Compile and check for any errors. Correct errors (if any), re-compile, and upload to the device. Naturally, nothing will happen now: your code is dummy, but you will ensure proper toolkit operation. Compile and check for any errors. Correct errors (if any), re-compile, and upload to the device. Naturally, nothing will happen now: your code is dummy, but you will ensure proper toolkit operation.
  
-** Step **\\+** Step **\\
 Add to your code declarations regarding GPIO control ports for GPIO 13: Add to your code declarations regarding GPIO control ports for GPIO 13:
 <code asm> <code asm>
Line 39: Line 37:
 </code> </code>
  
-** Step **\\+** Step **\\
 Configure GPIO 13 for output: Configure GPIO 13 for output:
 <code asm> <code asm>
Line 49: Line 47:
 </code> </code>
  
-** Step **\\+** Step **\\
 Prepare your delay function and place it at the end of the code (after 'rjmp LOOP'). Also, modify it accordingly to meet your requested delay time. Note that the CPU's base frequency is 16 MHz. Refer to the chapter [[..:..:..:arduinouno|]] on how to calculate the number of loops. The function below gives you approximately a 0.5s delay (506ms). Prepare your delay function and place it at the end of the code (after 'rjmp LOOP'). Also, modify it accordingly to meet your requested delay time. Note that the CPU's base frequency is 16 MHz. Refer to the chapter [[..:..:..:arduinouno|]] on how to calculate the number of loops. The function below gives you approximately a 0.5s delay (506ms).
 <code asm> <code asm>
Line 69: Line 67:
 </code> </code>
  
-** Step **\\+** Step **\\
 Implement the main loop: Implement the main loop:
 <code asm> <code asm>
 +...
 LOOP: LOOP:
     sbi PORTB, PB5           ; Turn LED off     sbi PORTB, PB5           ; Turn LED off
Line 78: Line 77:
     rcall delay     rcall delay
     rjmp LOOP     rjmp LOOP
 +...
 </code> </code>
  
Line 84: Line 84:
  
 ** FAQ **\\ ** FAQ **\\
-When using the printed version of this manual, please refer to the latest online version of this document to obtain the most up-to-date list of FAQs.+When using the printed version of this manual, please refer to the latest online version of this document to obtain the most up-to-date list of FAQs.\\ 
 **It does not flash**: Did you compile and upload to the device? Those are separate steps: it is not enough to just compile, but you also need to "flash" the MCU. Also, check your video stream if it "ticks" - the time embedded into the video stream should change. Your code may be working OK, but the video stream can be frozen, so you cannot see it working properly! **It does not flash**: Did you compile and upload to the device? Those are separate steps: it is not enough to just compile, but you also need to "flash" the MCU. Also, check your video stream if it "ticks" - the time embedded into the video stream should change. Your code may be working OK, but the video stream can be frozen, so you cannot see it working properly!
 +
 +**I need a longer delay**: To obtain a delay function with a period of about 2.5s, you need to introduce a fourth loop (an outer loop) in the delay; 3 will not provide you enough ticks. Eventually, you can switch to 16-bit counters.
 // //
  
  
en/multiasm/exercisesbook/avr/sut/scenarios/avr1.1777713032.txt.gz · Last modified: by pczekalski
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0