Copy pins at ATmega16

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

Hello All,

 

Does anyone has a code to copy pins from an atmega16 in C.

 

I want to define PortD pin 5 the same as PortD pin 4. to use 2 outputs to drive two servo motors with PWM.

 

Thanks in advance,

 

Nick.

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

meganickkk wrote:
I want to define PortD pin 5 the same as PortD pin 4.

Surely, that's simply a matter of reading PortD pin 5 and then writing whatever value you read (which can only ever be 0 or 1) to PortD pin 4 ?

 

How is that difficult?

 

to use 2 outputs to drive two servo motors with PWM

That is an entirely different question!

 

How is that related to the first question - or to the title of the thread??

 

EDIT

 

typo

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. Sep 20, 2017 - 06:58 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think the OP has missed out some important information.

 

On a mega16, PD5 is OC1A and PD4 is OC1B. I wonder if they have some code using OC1A to drive a PWM motor and want to do something.......................(I trail off here as I have no idea what they want to do).

 

Perhaps the OP would like to explain what they want to do and why.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

Last Edited: Wed. Sep 20, 2017 - 08:02 AM