Pages: [1]   Go Down
Author Topic: attiny 45/85 delay error  (Read 525 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 250
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i have a simple code like this on attiny45/85 mic, using arduino as ISP
Code:
    digitalWrite(output_CH_A,0);
     delayMicroseconds(900);
     digitalWrite(output_CH_A,1);  
     delayMicroseconds(900);    

it is a simple code that sends small pulses all time

when i am trying to read the width of the pulse (on that pin) from another arduino  (via serial monitor), i get all time 7100-7200 microseconds), that it is wrong

when i am using the same code for arduino 328 or MEGA i get about 900milliseconds as it must be,


why there is this error? how can i fix it?



Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 603
Posts: 33408
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
i have a simple code like this on attiny45/85 mic
It sounds like that processor has not been set up correctly, what clock speed is it running at? It is likely that the delayMicroseconds is using the wrong value in the timer to work correctly on your system.
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 250
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i dont know, to solve the problem when i need 700microseconds i use 70.
I dont know if that have to do with it's internal clock
Logged

Pages: [1]   Go Up
Jump to: