SlideShare une entreprise Scribd logo
1  sur  24
AVR Assembly
The Ultimate code
Nick Timkovich
ChiPy October 2016 Meeting: Ultimate Language Shootout @ Sully’s House, Chicago, IL
Premise
p = 1
Sun goes nova
1_500_000_000
CE
100,000
BCE
p = 0
Dawn of humanity
Most of the world will be post-apocalyptic with scarce resources
Source: Wikipedia’s list of dates for apocalyptic events
Now
Probability of Apocalypse over time
Premise
Programming machine code for an AVR can be done with minimal resources
Premise
Merriam-Webster, keeper of the American English language, agrees
✔
✔
✔
✔
✔
✔✔
≈
The Scenario
You are in a post-apocalyptic world and you must make a machine that
can tell if a number is divisible by 7 to demonstrate your magic for the
local warlord so he doesn’t strap you to his bumper.
The Bootstrapping problem
• How do you program a computer in a world without computers?
• There are billions of computers in perfect working order,
they’re in landfills and junkyards.
Step 1:
Gather Materials
Step 1: Gather materials
• One of the billions and billions of AVRs produced
• Arduinos mean there are a disproportionate number of DIP packaged AVRs
Step 1: Gather materials
• Two different metals
• one of them should be long & thin
• Electrolytes
• what plants crave
Vcc (+) GND (−)
Step 1: Gather materials
• Reference material you’ve stashed
• Where to keep copies of it
• in your go-bag
• in your cabin in the woods
• buried outside
Step 2:
Write the Program
Step 2: Create your program
• AVR features:
• 16-bit instructions
• Most run within one clock cycle
• (32) 8-bit general-purpose registers
• Modified Harvard Architecture
Step 2: Create your program
• Spec
• When a switch is pressed, read a 16-bit number from input pins
• If divisible by 7, make a noise (oscillate a pin), otherwise be silent
Step 2: Create your program
• Loop and wait for switch on Port C (0x08), Pin 0 to go low
• A “while” loop
SBIS $08, 0
RJMP -2
; prog...
Step 2: Create your program
• Read ports into register space
• Port B & D (0x05 & 0x0B, respectively) are usually the widest
IN r20, $05
IN r21, $0B
Step 2: Create your program
• Divide? Woah, woah, don’t make it complicated.
SUBI r20, 7
SBCI r21, 0
BRMI 1000
; fail
BRNE -4
TST r20
BRNE -6
; success!
Step 2: Create your program
• Set Port C, Pin 1 to Output (DDRC = 0x07)
• Oscillate pin.
• Use NO-OPs to tune frequency.
SBI $07, 1
SBI $08, 1
NOP
NOP
CBI $08, 1
RJMP -5
Step 3:
Flash the Micro
Step 3: Flash the microcontroller
• Make a battery (3-4 cells of most junk should be OK)
• Physically toggle wires between power and ground
• Consult AVR Reference Manuals and App Notes in your Go Bag
Step 3: Flash the microcontroller
Take as much time as
you need to get it right
Step 3: Flash the microcontroller
• Make a battery (3-4 cells of most junk should be OK)
• Physically toggle wires between power and ground
• Consult AVR Reference Manuals and App Notes in your Go Bag
Average state transitions: 5x size of program in bits
• Print off the AVR Reference Manuals & App Notes, put them in your
Bug-Out Bag
• Atmel AVR 8-bit Instruction Set
• AVR200: Multiply and Divide Routines
• AVR910: In-System Programming
• AVR Assembly is the Ultimate language
Takeaways
Sources
Pixabay. “Lemon fruit yellow food citrus 25244.”
Accessed October 15, 2016.
https://pixabay.com/en/lemon-fruit-yellow-
food-citrus-25244/ CC0
Pixabay. “Screws screw nail repair rivet 24244.”
Accessed October 15, 2016.
https://pixabay.com/en/screws-screw-nail-
repair-rivet-24244/ CC0
Red Cross. 37173 - Red Cross "ready to Go"
Preparedness Kit. March 7, 2006. FEMA.
In Wikimedia Commons. October 12, 2009.
Accessed October 14, 2016. Public Domain.
https://commons.wikimedia.org/wiki/File:FE
MA_-_37173_-
_Red_Cross_^quot,ready_to_go^quot,_prepa
redness_kit.jpg
SparkFun Electronics. "Arduino Uno - R3." SparkFun
Electronics Shop. Accessed October 14, 2016.
https://www.sparkfun.com/products/11021.
Images CC BY-NC-SA 3.0
United States Mint. “United States One Cent Obverse”
February 10, 2014. United States Department
of the Treasury. In Wikimedia Commons.
Accessed October 15, 2016. Public Domain.
https://commons.wikimedia.org/wiki/File:US
_One_Cent_Obv.png
All Rights Reserved their respective owners
Use is authorized under 17 U.S.C. § 107:
Limitations on exclusive rights: Fair use
Freely Licensed
Atmel Corporation, Appl. Note “AVR200: Multiply and Divide Routines”. Rev. 0936D-AVR-09/09
Atmel Corporation, Appl. Note “AVR910: In-System Programming”. Rev. 0943E-AVR-08/08
Atmel Corporation, “Atmel 8-bit Microcontroller with 4/8/16/32KBytes In-System Programmable Flash”
ATmega48A/PA/88A/PA/168A/PA/328/P Datasheet. Rev 8271J, 11/2015
Atmel Staff, Atmel AVR 8-bit Instruction Set. Atmel Corporation. Rev. 0856K-AVR-05/2016
Idiocracy. Directed by Mike Judge. Performed by Luke Wilson, Maya Ruldoph. United States: Twentieth Century Fox
Film Corp., 2007. http://www.imdb.com/title/tt0387808
Justice League: The Flashpoint Paradox. Directed by Jay Oliva. Performed by Justin Chambers, C. Thomas Howell.
United States: DC Entertainment, 2013. http://www.imdb.com/title/tt2820466
Life After People. Directed by David de Vries. Performed by James Lurie. United States: Flight 33 Productions, 2008.
http://www.imdb.com/title/tt1173907
Mad Max: Fury Road. Directed by George Miller. Performed by Tom Hardy, Charlize Theron, Nicholas Hoult.
Australia: Warner Brothers Pictures, 2015. http://www.imdb.com/title/tt1392190
The Matrix Revolutions. Directed by The Wachowskis. Performed by Keanu Reeves, Laurence Fishburne, Carrie-Anne
Moss. United States: Warner Bros., 2003. http://www.imdb.com/title/tt0242653
The Office. Performed by Rainn Wilson, John Krasinski, Jenna Fischer. United States: Reveille Productions, 2005-
2013. Created by Greg Daniels, Ricky Gervais, Stephen Merchant. http://www.imdb.com/title/tt0386676
Turbo Kid. Directed by François Simard and Anouk Whissell. Performed by Munro Chambers, Laurence Leboeuf,
Michael Ironside. Canada: EMA Films, 2015. http://www.imdb.com/title/tt3672742
WALL·E. Directed by Andrew Stanton. Performed by Ben Burtt, Elissa Knight, Jeff Garlin. United States: Walt Disney
Pictures, 2008. http://www.imdb.com/title/tt0910970

Contenu connexe

Similaire à AVR Assembler - ChiPy Ultimate Language Shootout 2016

JavaOne 2016 - Faces Counter
JavaOne 2016 -  Faces CounterJavaOne 2016 -  Faces Counter
JavaOne 2016 - Faces CounterCoritel
 
Exploring the Internet of Things Using Ruby
Exploring the Internet of Things Using RubyExploring the Internet of Things Using Ruby
Exploring the Internet of Things Using RubyMike Hagedorn
 
IT vocabulary in Spanish
IT vocabulary in SpanishIT vocabulary in Spanish
IT vocabulary in SpanishSpanishviaSkype
 
Arm cross development_with_eclipse
Arm cross development_with_eclipseArm cross development_with_eclipse
Arm cross development_with_eclipseWalmar de Paula
 
We Should Start Overclocking Mobile Devices!
We Should Start Overclocking Mobile Devices!We Should Start Overclocking Mobile Devices!
We Should Start Overclocking Mobile Devices!HWBOT
 
UI Beyond the Browser - Software for Hardware Projects
UI Beyond the Browser - Software for Hardware ProjectsUI Beyond the Browser - Software for Hardware Projects
UI Beyond the Browser - Software for Hardware Projectspchristensen
 
Raspberry pi 3
Raspberry pi 3Raspberry pi 3
Raspberry pi 3Vipin V
 
My Minecraft Smart Home: Prototyping the internet of uncanny things - Sascha ...
My Minecraft Smart Home: Prototyping the internet of uncanny things - Sascha ...My Minecraft Smart Home: Prototyping the internet of uncanny things - Sascha ...
My Minecraft Smart Home: Prototyping the internet of uncanny things - Sascha ...Codemotion Tel Aviv
 
My Minecraft-Smart-Home: Prototyping the Internet of Uncanny Things
My Minecraft-Smart-Home: Prototyping the Internet of Uncanny ThingsMy Minecraft-Smart-Home: Prototyping the Internet of Uncanny Things
My Minecraft-Smart-Home: Prototyping the Internet of Uncanny ThingsSascha Wolter
 
DEFCON 23 - Ian Latter - remote access the apt
DEFCON 23 - Ian Latter - remote access the aptDEFCON 23 - Ian Latter - remote access the apt
DEFCON 23 - Ian Latter - remote access the aptFelipe Prado
 
playaround workshop 2010 - internet of the real things
playaround workshop 2010 - internet of the real thingsplayaround workshop 2010 - internet of the real things
playaround workshop 2010 - internet of the real thingsplayaround.cc
 
12feb: Most Complex Machines - Uo.Liverpool
12feb: Most Complex Machines - Uo.Liverpool12feb: Most Complex Machines - Uo.Liverpool
12feb: Most Complex Machines - Uo.LiverpoolIan Phillips
 
Introduction and history of computers.
Introduction and history of computers.Introduction and history of computers.
Introduction and history of computers.Shahariar Rabby
 
SUAS & Arduino Presentation - Staples - 20140403 - CLEARED
SUAS & Arduino Presentation - Staples - 20140403 - CLEAREDSUAS & Arduino Presentation - Staples - 20140403 - CLEARED
SUAS & Arduino Presentation - Staples - 20140403 - CLEAREDGabriel Staples
 
Land And Underwater Rover Using Raspberry Pi
Land And Underwater Rover Using Raspberry PiLand And Underwater Rover Using Raspberry Pi
Land And Underwater Rover Using Raspberry PiIRJET Journal
 
DN 2017 | Machines are Learning - Bringing Powerful Artificial Intelligence t...
DN 2017 | Machines are Learning - Bringing Powerful Artificial Intelligence t...DN 2017 | Machines are Learning - Bringing Powerful Artificial Intelligence t...
DN 2017 | Machines are Learning - Bringing Powerful Artificial Intelligence t...Dataconomy Media
 

Similaire à AVR Assembler - ChiPy Ultimate Language Shootout 2016 (20)

JavaOne 2016 - Faces Counter
JavaOne 2016 -  Faces CounterJavaOne 2016 -  Faces Counter
JavaOne 2016 - Faces Counter
 
Exploring the Internet of Things Using Ruby
Exploring the Internet of Things Using RubyExploring the Internet of Things Using Ruby
Exploring the Internet of Things Using Ruby
 
IT vocabulary in Spanish
IT vocabulary in SpanishIT vocabulary in Spanish
IT vocabulary in Spanish
 
Arm cross development_with_eclipse
Arm cross development_with_eclipseArm cross development_with_eclipse
Arm cross development_with_eclipse
 
We Should Start Overclocking Mobile Devices!
We Should Start Overclocking Mobile Devices!We Should Start Overclocking Mobile Devices!
We Should Start Overclocking Mobile Devices!
 
Arduino1.0 RC
Arduino1.0 RCArduino1.0 RC
Arduino1.0 RC
 
UI Beyond the Browser - Software for Hardware Projects
UI Beyond the Browser - Software for Hardware ProjectsUI Beyond the Browser - Software for Hardware Projects
UI Beyond the Browser - Software for Hardware Projects
 
Raspberry pi 3
Raspberry pi 3Raspberry pi 3
Raspberry pi 3
 
My Minecraft Smart Home: Prototyping the internet of uncanny things - Sascha ...
My Minecraft Smart Home: Prototyping the internet of uncanny things - Sascha ...My Minecraft Smart Home: Prototyping the internet of uncanny things - Sascha ...
My Minecraft Smart Home: Prototyping the internet of uncanny things - Sascha ...
 
My Minecraft-Smart-Home: Prototyping the Internet of Uncanny Things
My Minecraft-Smart-Home: Prototyping the Internet of Uncanny ThingsMy Minecraft-Smart-Home: Prototyping the Internet of Uncanny Things
My Minecraft-Smart-Home: Prototyping the Internet of Uncanny Things
 
DEFCON 23 - Ian Latter - remote access the apt
DEFCON 23 - Ian Latter - remote access the aptDEFCON 23 - Ian Latter - remote access the apt
DEFCON 23 - Ian Latter - remote access the apt
 
playaround workshop 2010 - internet of the real things
playaround workshop 2010 - internet of the real thingsplayaround workshop 2010 - internet of the real things
playaround workshop 2010 - internet of the real things
 
IoT Aquarium 2
IoT Aquarium 2IoT Aquarium 2
IoT Aquarium 2
 
12feb: Most Complex Machines - Uo.Liverpool
12feb: Most Complex Machines - Uo.Liverpool12feb: Most Complex Machines - Uo.Liverpool
12feb: Most Complex Machines - Uo.Liverpool
 
Introduction and history of computers.
Introduction and history of computers.Introduction and history of computers.
Introduction and history of computers.
 
Internet of Things
Internet of ThingsInternet of Things
Internet of Things
 
SUAS & Arduino Presentation - Staples - 20140403 - CLEARED
SUAS & Arduino Presentation - Staples - 20140403 - CLEAREDSUAS & Arduino Presentation - Staples - 20140403 - CLEARED
SUAS & Arduino Presentation - Staples - 20140403 - CLEARED
 
Let's begin io t with $10
Let's begin io t with $10Let's begin io t with $10
Let's begin io t with $10
 
Land And Underwater Rover Using Raspberry Pi
Land And Underwater Rover Using Raspberry PiLand And Underwater Rover Using Raspberry Pi
Land And Underwater Rover Using Raspberry Pi
 
DN 2017 | Machines are Learning - Bringing Powerful Artificial Intelligence t...
DN 2017 | Machines are Learning - Bringing Powerful Artificial Intelligence t...DN 2017 | Machines are Learning - Bringing Powerful Artificial Intelligence t...
DN 2017 | Machines are Learning - Bringing Powerful Artificial Intelligence t...
 

Dernier

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 

Dernier (20)

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 

AVR Assembler - ChiPy Ultimate Language Shootout 2016

  • 1. AVR Assembly The Ultimate code Nick Timkovich ChiPy October 2016 Meeting: Ultimate Language Shootout @ Sully’s House, Chicago, IL
  • 2. Premise p = 1 Sun goes nova 1_500_000_000 CE 100,000 BCE p = 0 Dawn of humanity Most of the world will be post-apocalyptic with scarce resources Source: Wikipedia’s list of dates for apocalyptic events Now Probability of Apocalypse over time
  • 3. Premise Programming machine code for an AVR can be done with minimal resources
  • 4. Premise Merriam-Webster, keeper of the American English language, agrees ✔ ✔ ✔ ✔ ✔ ✔✔ ≈
  • 6. You are in a post-apocalyptic world and you must make a machine that can tell if a number is divisible by 7 to demonstrate your magic for the local warlord so he doesn’t strap you to his bumper.
  • 7. The Bootstrapping problem • How do you program a computer in a world without computers? • There are billions of computers in perfect working order, they’re in landfills and junkyards.
  • 9. Step 1: Gather materials • One of the billions and billions of AVRs produced • Arduinos mean there are a disproportionate number of DIP packaged AVRs
  • 10. Step 1: Gather materials • Two different metals • one of them should be long & thin • Electrolytes • what plants crave Vcc (+) GND (−)
  • 11. Step 1: Gather materials • Reference material you’ve stashed • Where to keep copies of it • in your go-bag • in your cabin in the woods • buried outside
  • 12. Step 2: Write the Program
  • 13. Step 2: Create your program • AVR features: • 16-bit instructions • Most run within one clock cycle • (32) 8-bit general-purpose registers • Modified Harvard Architecture
  • 14. Step 2: Create your program • Spec • When a switch is pressed, read a 16-bit number from input pins • If divisible by 7, make a noise (oscillate a pin), otherwise be silent
  • 15. Step 2: Create your program • Loop and wait for switch on Port C (0x08), Pin 0 to go low • A “while” loop SBIS $08, 0 RJMP -2 ; prog...
  • 16. Step 2: Create your program • Read ports into register space • Port B & D (0x05 & 0x0B, respectively) are usually the widest IN r20, $05 IN r21, $0B
  • 17. Step 2: Create your program • Divide? Woah, woah, don’t make it complicated. SUBI r20, 7 SBCI r21, 0 BRMI 1000 ; fail BRNE -4 TST r20 BRNE -6 ; success!
  • 18. Step 2: Create your program • Set Port C, Pin 1 to Output (DDRC = 0x07) • Oscillate pin. • Use NO-OPs to tune frequency. SBI $07, 1 SBI $08, 1 NOP NOP CBI $08, 1 RJMP -5
  • 20. Step 3: Flash the microcontroller • Make a battery (3-4 cells of most junk should be OK) • Physically toggle wires between power and ground • Consult AVR Reference Manuals and App Notes in your Go Bag
  • 21. Step 3: Flash the microcontroller Take as much time as you need to get it right
  • 22. Step 3: Flash the microcontroller • Make a battery (3-4 cells of most junk should be OK) • Physically toggle wires between power and ground • Consult AVR Reference Manuals and App Notes in your Go Bag Average state transitions: 5x size of program in bits
  • 23. • Print off the AVR Reference Manuals & App Notes, put them in your Bug-Out Bag • Atmel AVR 8-bit Instruction Set • AVR200: Multiply and Divide Routines • AVR910: In-System Programming • AVR Assembly is the Ultimate language Takeaways
  • 24. Sources Pixabay. “Lemon fruit yellow food citrus 25244.” Accessed October 15, 2016. https://pixabay.com/en/lemon-fruit-yellow- food-citrus-25244/ CC0 Pixabay. “Screws screw nail repair rivet 24244.” Accessed October 15, 2016. https://pixabay.com/en/screws-screw-nail- repair-rivet-24244/ CC0 Red Cross. 37173 - Red Cross "ready to Go" Preparedness Kit. March 7, 2006. FEMA. In Wikimedia Commons. October 12, 2009. Accessed October 14, 2016. Public Domain. https://commons.wikimedia.org/wiki/File:FE MA_-_37173_- _Red_Cross_^quot,ready_to_go^quot,_prepa redness_kit.jpg SparkFun Electronics. "Arduino Uno - R3." SparkFun Electronics Shop. Accessed October 14, 2016. https://www.sparkfun.com/products/11021. Images CC BY-NC-SA 3.0 United States Mint. “United States One Cent Obverse” February 10, 2014. United States Department of the Treasury. In Wikimedia Commons. Accessed October 15, 2016. Public Domain. https://commons.wikimedia.org/wiki/File:US _One_Cent_Obv.png All Rights Reserved their respective owners Use is authorized under 17 U.S.C. § 107: Limitations on exclusive rights: Fair use Freely Licensed Atmel Corporation, Appl. Note “AVR200: Multiply and Divide Routines”. Rev. 0936D-AVR-09/09 Atmel Corporation, Appl. Note “AVR910: In-System Programming”. Rev. 0943E-AVR-08/08 Atmel Corporation, “Atmel 8-bit Microcontroller with 4/8/16/32KBytes In-System Programmable Flash” ATmega48A/PA/88A/PA/168A/PA/328/P Datasheet. Rev 8271J, 11/2015 Atmel Staff, Atmel AVR 8-bit Instruction Set. Atmel Corporation. Rev. 0856K-AVR-05/2016 Idiocracy. Directed by Mike Judge. Performed by Luke Wilson, Maya Ruldoph. United States: Twentieth Century Fox Film Corp., 2007. http://www.imdb.com/title/tt0387808 Justice League: The Flashpoint Paradox. Directed by Jay Oliva. Performed by Justin Chambers, C. Thomas Howell. United States: DC Entertainment, 2013. http://www.imdb.com/title/tt2820466 Life After People. Directed by David de Vries. Performed by James Lurie. United States: Flight 33 Productions, 2008. http://www.imdb.com/title/tt1173907 Mad Max: Fury Road. Directed by George Miller. Performed by Tom Hardy, Charlize Theron, Nicholas Hoult. Australia: Warner Brothers Pictures, 2015. http://www.imdb.com/title/tt1392190 The Matrix Revolutions. Directed by The Wachowskis. Performed by Keanu Reeves, Laurence Fishburne, Carrie-Anne Moss. United States: Warner Bros., 2003. http://www.imdb.com/title/tt0242653 The Office. Performed by Rainn Wilson, John Krasinski, Jenna Fischer. United States: Reveille Productions, 2005- 2013. Created by Greg Daniels, Ricky Gervais, Stephen Merchant. http://www.imdb.com/title/tt0386676 Turbo Kid. Directed by François Simard and Anouk Whissell. Performed by Munro Chambers, Laurence Leboeuf, Michael Ironside. Canada: EMA Films, 2015. http://www.imdb.com/title/tt3672742 WALL·E. Directed by Andrew Stanton. Performed by Ben Burtt, Elissa Knight, Jeff Garlin. United States: Walt Disney Pictures, 2008. http://www.imdb.com/title/tt0910970