Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/21/02 02:26
Read: times


 
#34812 - RE: Example code on howto control a serv
I've been able to figure out this much:

void timer1_ISR (void) interrupt 5 {
	TF2 = 0;
}

void init_timer2 (void) {
	/* Timer 2 prescaler 1/12 : 12Mhz/12 = 1MHz */
	T2PS = 0;
	
	/* Timer 2 mode 0 : Auto reload */
	T2R1 = 1;
	T2R0 = 0;

	/* Timer 2 input selection : Timer function */
	T2I1 = 0;
	T2I0 = 1;

	/* Timer 2 compare mode 0 */
	T2CM = 0;

	/* Enable capture/compare */
	CCEN = 8;

	/* Timer 2 count value: 65535 - 20000 = 45535 = 0xB1DF */
	/* Reload every 20000 system ticks  1MHz/20KHz = 50Hz */
	TL2 = 0xDF;
	TH2 = 0xB1;

	CCH1 = 0x01;
	CCL1 = 0x90;

	ET2 = 1;
	EAL = 1;
}


This kinda works... it jumps to a position and then continues moving in small steps.

What am I doing wrong here?

List of 15 messages in thread
TopicAuthorDate
Example code on howto control a servo            01/01/70 00:00      
RE: Example code on howto control a serv            01/01/70 00:00      
RE: Example code on howto control a serv            01/01/70 00:00      
RE: Example code on howto control a serv            01/01/70 00:00      
RE: Example code on howto control a serv            01/01/70 00:00      
RE: Example code on howto control a servo            01/01/70 00:00      
RE: Example code on howto control a servo            01/01/70 00:00      
RE: Example code on howto control a servo            01/01/70 00:00      
RE: Example code on howto control a serv            01/01/70 00:00      
RE: Example code on howto control a serv            01/01/70 00:00      
RE: Example code on howto control a serv            01/01/70 00:00      
RE: Example code on howto control a serv            01/01/70 00:00      
RE: Example code on howto control a serv            01/01/70 00:00      
RE: Example code on howto control a servo            01/01/70 00:00      
RE: Example code on howto control a servo            01/01/70 00:00      

Back to Subject List