Don_dody
Full Member level 1
- Joined
- Nov 4, 2012
- Messages
- 96
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,288
- Location
- Indonesia
- Activity points
- 1,921
I want to make 1s delay using TIMER0 and Here is the code:
I got error messages as follow:
1. undefined symbol 'delay'
2. the expression must be a modifiable lvalue
Whats wrong here?
Code:
#include <mega8535.h>
interrupt [TIM0_OVF] void timer0_ovf_isr(void)
{
delay = delay + 1
}
void main(void)
{
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: 3.906 kHz
// Mode: Normal top=FFh
TCCR0=0x05;
TCNT0=0xD9;
// Timer0 enable
TIMSK=0x01;
// Global enable interrupts
#asm("sei")
while (1)
{
delay(100); //(100*10ms=1000ms)
};
}
void delay(int delay_ms)
{
TCNT0=0xD9; //timer interval= 10 ms
delay=0
while(delay<=delay_ms)
{
}
}
I got error messages as follow:
1. undefined symbol 'delay'
2. the expression must be a modifiable lvalue
Whats wrong here?