Forum : ST7/STM8
Original Post
Post Information | Post |
---|---|
November 3, 2009 - 6:13am
|
Hi all, I'm working on the firmware for STM8S103K3 and I'd like to set up the PWM output on TIM1 and I tried one of the example from the Lib. When I compiled, Ride7 send me an error " Fatal Error C200 in Line 922 of C:\Program files\Raisonance\Ride\Examples\STM8\5601058\stm8s_tim1.c : evaluation file size has reached (1024 byes)" Why'd stm8s_tim1.c has to do with the file size ? since I only compile the main.c file ? please help, how to resolve this issue. This is the code I wrote : /* Includes ------------------------------------------------------------------*/ #include "stm8s.h" #include "stm8s_tim1.h" /*I/Os configuration */ #define Output (GPIOB) #define Dimmer_Enable (GPIO_PIN_3) #define Dimmer_Out (GPIO_PIN_2) #define Dimmer_Stat (GPIO_PIN_1) /*Timer 1 definition*/ #define CCR1_Val ((u16)2047) #define CCR2_Val ((u16)1535) #define CCR3_Val ((u16)1023) #define CCR4_Val ((u16)511) u8 Dimmer_val = 0x0 ; /* Public functions ----------------------------------------------------------*/ void main(void) { /*Initialize I/Os in Output Mode */ GPIO_Init(Output, (Dimmer_Out|Dimmer_Stat), GPIO_MODE_OUT_PP_LOW_FAST); /*Initialize I/Os in input Mode- Pull up without interupt */ GPIO_Init(Output, Dimmer_Enable, GPIO_MODE_IN_PU_NO_IT); /*TIM1 Peripheral Configuration */ TIM1_DeInit(); /* Time Base Configuration */ /* TIM1_Period = 4095 TIM1_Prescaler = 0 TIM1_CounterMode = TIM1_COUNTERMODE_UP TIM1_RepetitionCounter = 0 */ TIM1_TimeBaseInit(0, TIM1_COUNTERMODE_UP, 4095, 0); /* Channel 1 Configuration in PWM mode */ /* TIM1_OCMode = TIM1_OCMode_PWM2 TIM1_OutputState = TIM1_OUTPUTSTATE_ENABLE TIM1_OutputNState = TIM1_OUTPUTNSTATE_ENABLE TIM1_Pulse = CCR1_Val TIM1_OCPolarity = TIM1_OCPOLARITY_LOW TIM1_OCNPolarity = TIM1_OCNPOLARITY_HIGH TIM1_OCIdleState = TIM1_OCIDLESTATE_SET TIM1_OCNIdleState = TIM1_OCIDLESTATE_RESET */ TIM1_OC1Init(TIM1_OCMODE_PWM2, TIM1_OUTPUTSTATE_ENABLE, TIM1_OUTPUTNSTATE_ENABLE, CCR1_Val, TIM1_OCPOLARITY_LOW, TIM1_OCNPOLARITY_HIGH, TIM1_OCIDLESTATE_SET, TIM1_OCNIDLESTATE_RESET); /*TIM1_Pulse = CCR2_Val */ TIM1_OC2Init(TIM1_OCMODE_PWM2, TIM1_OUTPUTSTATE_ENABLE, TIM1_OUTPUTNSTATE_ENABLE, CCR2_Val, TIM1_OCPOLARITY_LOW, TIM1_OCNPOLARITY_HIGH, TIM1_OCIDLESTATE_SET, TIM1_OCNIDLESTATE_RESET); /*TIM1_Pulse = CCR3_Val */ TIM1_OC3Init(TIM1_OCMODE_PWM2, TIM1_OUTPUTSTATE_ENABLE, TIM1_OUTPUTNSTATE_ENABLE, CCR3_Val, TIM1_OCPOLARITY_LOW, TIM1_OCNPOLARITY_HIGH, TIM1_OCIDLESTATE_SET, TIM1_OCNIDLESTATE_RESET); /*TIM1_Pulse = CCR4_Val */ //TIM1_OC4Init(TIM1_OCMODE_PWM2, TIM1_OUTPUTSTATE_ENABLE, TIM1_OUTPUTNSTATE_ENABLE, CCR4_Val, TIM1_OCPOLARITY_LOW, TIM1_OCNPOLARITY_HIGH, TIM1_OCIDLESTATE_SET, TIM1_OCNIDLESTATE_RESET); /* TIM1 Counter enable */ TIM1_Cmd(ENABLE); /* TIM1 Main Output Enable */ TIM1_CtrlPWMOutputs(ENABLE); while (1) { Dimmer_val = GPIO_ReadInputPin(Output, Dimmer_Enable); if (Dimmer_val == 1) { GPIO_WriteHigh(Output, Dimmer_Out|Dimmer_Stat); // set Dimmer output high } else { GPIO_WriteLow(Output, Dimmer_Out|Dimmer_Stat); // set Dimmer output low } } } |
Hi Snake,
Can you try to preprocess your file (using the PREPRINT directive) and post it here? I do not see why stm8s_tim1.c enters the compilation game if you just compile main.c.
Bruno
Bruno,
I tried the Preprint directive at the beginning of my main.c file and it did not work. I placed "Preprint("C:\Program Files\Raisonance\Ride\Examples\STM8\5601058\main.i")" at the beginning of my main.c file.
The path of my main.c is C:\Program Files\Raisonance\Ride\Examples\STM8\5601058\main.c
You need to add #pragma in front of the directive if you put it in the C file, as follows:
#pragma preprint("C:\Program Files\Raisonance\Ride\Examples\STM8\5601058\main.i")
And the output path must exist (which is your case)
Regards,
Bruno
Bruno,
This is the preprocess file
Let me know how to make it compiled w/o errors. By the way, what's the preprocess file used for ?
Thanks,
Hi Snake,
Sorry for the delay in the response.
You need to register your RKit-STM8, which will give you access to 16KB of code. The free (unregistered) version is not large enough to compile stm8_tim1.c
Registration is free from the Raisonance web site.
BTW, we often ask for preprocessed source files so that we can reproduce customer problems without any interference with their .h files, include path or the like...
Regards,
Bruno
Thanks a lot Bruno,
I registered and got the activation code, compiled and it's errors free now.
Thanks again for all the support.