Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
;--------------- ; Assembly Code ;--------------- #define __SFR_OFFSET 0x00 #include "avr/io.h" ;------------------------ .global start .global led ;------------------------ start: SBI DDRB, 4 ;set PB4 (D12) as o/p RET ;return to setup() function ;--------------------------------------------------------------------------- led: CPI R24, 0x00 ;value in R24 passed by caller compared with 0 BREQ ledOFF ;jump (branch) if equal to subroutine ledOFF SBI PORTB, 4 ;set D12 to high RCALL myDelay RET ;return to loop() function ;--------------------------------------------------------------------------- ledOFF: CBI PORTB, 4 ;set D12 to low RCALL myDelay RET ;return to loop() function ;--------------------------------------------------------------------------- .equ delayVal, 10000 ;initial count value for inner loop ;--------------------------------------------------------------------------- myDelay: LDI R20, 100 ;initial count value for outer loop outerLoop: LDI R30, lo8(delayVal) ;low byte of delayVal in R30 LDI R31, hi8(delayVal) ;high byte of delayVal in R31 innerLoop: SBIW R30, 1 ;subtract 1 from 16-bit value in R31, R30 BRNE innerLoop ;jump if countVal not equal to 0 ;-------------- SUBI R20, 1 ;subtract 1 from R20 BRNE outerLoop ;jump if R20 not equal to 0 RET ;---------------------------------------------------------------------------
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)