[TUT] ATTiny817, 12-bit timer, TCD, servos, 1 & 2 Ramp PWM, HXT900

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

This about using an ATTiny817 Xplained mini to drive 2 HXT900 servos using the 12-bit timer.

 

There is a One Ramp mode example and a Two Ramp mode example.

 

                                   One Ramp               Two Ramp

Degree/step                   0.44                       0.22

Attachment(s): 

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

I apologize, I made a mistake in my explanation of the Clock system in the ATtiny817. The codes are correct except for the define for F_CPU when using a Peripheral Clock divisor

other than 1.

 

Refer to figure 11-1 in the Datasheet.

 

#define F_CPU should be the MAIN Clock divided by the System Clock Prescaler.  The default setting is  20000000 / 6 = 3333333.

Attachment(s):