2011-12-29 02:55 AM
I am working on st visual develop version 4.2.1 patch 2 with Cosmic
CxSTM8 32K 4.3.6.
I am having a problem regarding debuging the program:
the program builds well but during execution program curser doesn't execute the called routine(Function called: i.e void port() void
timer())
&sharpinclude''stm8s103f2p.h''
main()
{
void port ();
void timer();
void clock();
while(1);
}
void port()
{
PC_DDR= PC_DDR|(1<<6);
PC_CR1=PC_CR1|(1<<6);
PC_CR2=PC_CR2|(1<<6);
}
//clock init
void clock(void)
{
CLK_ICKR=CLK_ICKR|(1<<0);
CLK_ICKR=CLK_ICKR|(1<<1);
CLK_CKDIVR =0x00;
CLK_PCKENR1 =0x00;
CLK_PCKENR2=0x00;
CLK_PCKENR1=CLK_PCKENR1|(1<<7);
}
// timer
void timer(void)
{
TIM1_EGR=0x03;
TIM1_CCMR1=0x70;
TIM1_CCER1=0x01;
TIM1_PSCRH=0x00;
TIM1_PSCRL=0x00;
TIM1_ARRH=0x01;
TIM1_ARRL=0x3f;
TIM1_CCR1H=0x00;
TIM1_CCR1L=0xA0;
TIM1_CR1=TIM1_CR1|(1<<0);
TIM1_CR1=TIM1_CR1|(1<<7);
TIM1_BKR=TIM1_BKR|(1<<7);
}
#ashokkangna@gmail.com2011-12-29 09:45 AM
Your statement '' void port ();'' is a sort of prototype and not being interpreted by the compiler as a function call.
Try --> #include''stm8s103f2p.h'' void port (void); void timer(void); void clock(void); main() { port (); timer(); clock(); while(1); } ------------------- should work much better. NOTE I HAVE NOT VERIFIED IF YOUR PROGRAM DOES ANYTHING. Only that it makes the calls to port(), timer() & clock() jdf