Need help! Timing simulation error an avr studio 4!!!

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

Hi freaks,
i'm making a servo motor controller using ATMEGA8-16PI running at 16Mhz crystal.

to control a servo we must give it a pulse that varies from 0.5ms to 2ms the center value for servo is 1.5ms. okay, i understand at this point.

then i made an algorithm that pulses the whole portc at 1.5ms high and 20ms low using timer1 interrupt.

in avr studio, i setup the speed from standard 4Mhz into 16Mhz. Wham! She shouts that AVR Simulator Frequency is set above maximum limit for device!

i ignored it and continue simulating, measuring the pulse and everthing went okay. It's correctly pulsing 1500us at simulator. then i write the hex into my avr and test it.

but what happen?!!! the servo seems rotating into the maximum position limit and starts shaking. looks like the servo got wrong pulse length. note that i setup the fuse bit to external crystal.

then i tried to setup the fuse bit to use internal clock running at 8Mhz and everything went okay. the servo is turning into center position. :shock:
i don't know which is wrong?

please notice, i made another algorithm that running at 16Mhz without using timer interrupt, just a simple delay to control servo. It shows the right behaviour.

Can you freaks tell me? thx very much. and sorry 4 bothering.

KISS - Keep It Simple Stupid!

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

hei, hei hei!
I'm sorry for crowding!
i just solved this problem. I installed new avrstudio, the warning message has gone. and i looked up my code carefully twice and twice and twice and i got a wrong algorithm

KISS - Keep It Simple Stupid!