Course Hero Logo

That youve gone to the trouble to construct the

  • No School
  • AA 1
  • scoorp
  • 300
  • 100% (1) 1 out of 1 people found this document helpful

This preview shows page 35 - 38 out of 300 pages.

that you’ve gone to the trouble to construct the hardware, and have ther modification you can run Blinky in the AVR Studio simulator and learn therogramming ideas in the next chapter without any of theo do things the hard way, ummm… hardware way becauseurings like LEDs, not virtual things like little boxes onyoue could have a whole slew of virtual things toonblown Cylon robots reeking havoc on youristake you, theimperious leader, for an enemy, would you?your code will run plenty fast to simulate,e things, such as the delay functions take too long to simulate. In Blinkye call _delay_loop_2(30000); We don’t know yet how this function works, butthing 30000 times. If we simulatecompile the C software. Try searching the forums before asking questionsomeone has probably already asked your question and received good responses.Forum helpers tend to get annoyed with newbies whobackground reseaSimulation with AVRStudioNowburned fingers to prove it… guess what? You didn’t need to do any of that to testBlinky or get an introduction to C programming for microcontrollers. With aminointroductory C pardware. I decided thogoal is to control ‘real’ thr PC screen. Theoretically, wtrol, from LEDs to motors to fullcscreen, which actually sounds kind of fun, but not nearly so much fun as having areal Cylon robot stomping around your neighborhood scaring the noodles out ofyour enemies. Fun aside, it is often more practical to simulate software beforerunning it in the real world. You wouldn’t want your Cylon to mThe simulator runs your program in a virtual environment that is MUCH slowerthan the real microcontroller. Most ofbut somwwe can guess that we are telling it to do some
Chapter 2: Quick Start Guidethe delay, the simulated LEDs will move at geologic speeds, making glaciersseem fast, so we remove the delay before simulation.36inmain():akefile in the Blinky directorythe AVRStudio Workspace window click the I/O ATmega169, then thePORTD, you should see: (the following image shows PORTB instead ofPORTDOpen Blinky.c in Programmers Notepad and save it to a new directory,SimBlinky, as SimBlinky.c.Put comment lines in front ofbothof the _delay_loop_2() function calls// _delay_loop_2(30000);Open the mChange the target: TARGET = SimBlinkySave the makefile to the SimBlinky directoryRun the Make All, then Make Extcoff.In the AVRStudio open the SimBlinky.coff file.In, -- live with it)In the tobar ctton:ollick the AutoStep bu
Chapter 2: Quick Start GuideThe simulator will run showing the LED scan as a scan of the PORTD andPIND items in the Workspace window:(this shows PORTB but you’llactually see PORTD)See, I told you it wasn’t as much fun as watching real LEDs blink.Spend some time with the AVR Studio simulator and associated help files;you’ll find the effort well worth it in the long run.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 300 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
NoProfessor
Tags
Test, Atmel AVR

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture