Need help to get start with Atmel Microcontroller Programming

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Guys,

I have a task and i am primarily new to micro controllers, i am using an atmega 256 rfr microcontroller and what i want to do is:

connect a sensor having a switch to its port pE0 , i couldn't find the pin diagram of the microcontroller otherwise , i would have posted here. Can you please guide me how to get started with this project.

What i want is:

whenever the switch is closed, the microntroller should show True or logic 1 on the terminal and whenever the switch is open it should show False or logic 0.

i Just need the basic overview or a pseudo code would be great, so that i can really know how to play around with this stuff. 

 

Thanks a lot

Regards

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Google mega256rfr datasheet....you will get a hit to a pdf that contains the pin diagram you say you cannot find.

Are you actually going to use the RF section of the AVR or are you looking to conect to the terminal via the USART?

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


abu1194 wrote:
i couldn't find the pin diagram of the microcontroller
Surely you have the datasheet?

 

http://ww1.microchip.com/downloa...

 

Page 2 of that is:

 

 

So PE0 is pin 46.

 

To read an input you would ensure that bit 0 of DDRE is 0 (should be at power on anyway). This makes it an input. Then you read the PINE register and mask out the state of bit 0. That is PINE & (1 << 0) to see if the input is high/low.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First welcome to AVRFreaks!

 

Second I would highly recommend you take a look at the Arduino Uno, it is designed for beginners like you and you will find many many many examples to learn from!

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Forgive me for asking the obvious question, but why not just connect the switch directly to wherever you're connecting your AVR output pin, and bypass the AVR completely?  By connecting the switch properly you can get the behavior you want.  Or, as I suspect, is there much more that you eventually need to accomplish with the AVR?