Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[AVR] need help on attiny 24

Status
Not open for further replies.

farzinkalali

Newbie level 3
Joined
Oct 29, 2014
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
30
hi
I am trying to write a program in bascom for attiny24 that after counting 200 pulses set the pina.2
would you please help me
my program is like this do you find any mistake on it?
it compiled successfully on bascom with no errors
but when I load it on proteous 7 for simulation it doesn't work and it seems that get stuck on loop and do not exit the loop even when the pulses reaches to 200
please help me
thank you

Code:
Code dot - [expand]

1  $regfile = "attiny24.dat "
2  $crystal = 8000000
3  config pina.2 = output
4  Config Timer0 = Counter , Edge = Rising
5  Start:
6  Tcnt0 = 0
7  Do 
8  Loop Until Tcnt0 = 200
9  End
10  Set Pina.2
11 Wait 1
12 reset pina.2
13 End

thank you
 

I don't know BASCOM AVR programming. I don't have that Compiler. Where is your Timer Interrupt Routine ? Timerx and Global Interrupts have to be enabled and a counter has to be incremented in Timer ISR on every interrupt. When count reaches 200 you have to toggle an LED or do whatever you want.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top