Codewarrior Timer and converter

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Codewarrior Timer and converter

7,635 次查看
Nicom
Contributor I
I want to use this fonction to change the frequence of the timer but
i can't because there are always error
How use this function ?
 
byte Timer_SetFreqHz(word Freq)
 
 
I have the same problem to the converter i want to stock the value in variable  with that how do I do ?
 
byte AD1_GetValue16(word *Values)
 
help me please
thanks
Nico
 
标签 (1)
标记 (1)
0 项奖励
回复
8 回复数

2,431 次查看
Nicom
Contributor I
I don't know how change a frequency of timer
i think that is with this function but I'm not sure
if there are people to explain me how do I make?
thanks
Nico
 
Sorry for my english which is bad !
0 项奖励
回复

2,431 次查看
J2MEJediMaster
Specialist I
Sorry, I'm have a tough time tracking down that function. Is there a document file that you're getting that from? This way we can both be on the same page and determine what the function is doing.

---Tom
0 项奖励
回复

2,431 次查看
J2MEJediMaster
Specialist I
A little more information, please. What's the target processor/platform? What version of CodeWarrior are you using?

---Tom
0 项奖励
回复

2,431 次查看
Nicom
Contributor I

Sorry, I use a MC9S08GT16

44 QFP

and I work with codewarrior 5.7

My problem is I don't now how use this fonction

Timer_SetFreqHz()  ;

I want to change frequence with an input but i'm a newbee with codewarrior  

Thanks

Nico

 

0 项奖励
回复

2,431 次查看
ProcessorExpert
Senior Contributor III
SetFreqHz - this method sets the new frequency of the output signal. The frequency is expressed in Hz as a 16-bit unsigned integer number. This method is only available when the runtime setting type 'from interval' is selected in the Timing Dialog box of the Runtime setting area.

  • ANSIC prototype: byte SetFreqHz(word Freq)
  • Freq:word - Frequency to set [in Hz]
  • Return value:byte - Error code, possible codes:
    ERR_OK - OK
    ERR_SPEED - This device does not work in the active speed mode
    ERR_MATH - Overflow during evaluation
    ERR_RANGE - Parameter out of range

For more info see help for selected bean, especially Typical Usage page.

Best Regard, Jan Pospisilik, Processor Expert Support

0 项奖励
回复

2,431 次查看
Nicom
Contributor I

thanks i have ever seen this text about the fonction ,

my problem is : Iwnt use this fonction to change the frequency of timer

After the frequency will be using by a LED to blinking frequency

 int i=1;
       extern word ADCValue;
       byte err;

 
void main(void)
{
  
 /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
 PE_low_level_init();

while (i>0)   {

    
       err=Timer_SetFreqHz(AD1_GetValue16(&ADCValue));
       LedOutput_NegVal();
       
            }     
    

how use this fonction to change frequency ?

0 项奖励
回复

2,431 次查看
ProcessorExpert
Senior Contributor III

err=Timer_SetFreqHz(AD1_GetValue16(&ADCValue))  isn't  correctly, the GetVaule16 method returns error code, not measured value. Try to use e.g.:

err = AD1_GetValue16(&ADCValue); err = Timer_SetFreqHz(ADCValue);

The another incorrect thing is a location of "LedOutput_NegVal();", this command should be called from Timer event from event.c.

Best Regards,

Jan Pospisilik, Processor Expert Support

0 项奖励
回复

2,431 次查看
rocco
Senior Contributor II
Hi, Nico:

The function Timer_SetFreqHz() requires a word parameter, but according to the prototype in your first post, the function AD1_GetValue16() returns a byte.

You could try a caste:

err=Timer_SetFreqHz( (word)AD1_GetValue16(&ADCValue) );
0 项奖励
回复