HELP NEEDED ASAP!!!!!!!!!

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

HELP NEEDED ASAP!!!!!!!!!

3,115件の閲覧回数
RChapman
Contributor I
This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.
 
Posted: Wed Apr 13, 2005 11:33 pm    
 
Im currently involved in a project for school. Im using the Hc12.

I need to set the Hc12 up to generate a pulse of 500usec width with 50% duty cycle.

Also I need to use the A/D to measure an incoming signal.


The pulse will be used to drive a laser diode. The A/D will be used to measure the voltage @ of an photodiode.
Any brights ideas would b greatly appreciated.

Thanx Guys
Posted: Thu Apr 14, 2005 12:52 pm    
 
Hi,

Is it for HCS12 or HC12 ?
You would have more chances if you change your subject to something more explanatory.

Where is your problem exactly ?
You can load Application Notes on Freescale website that will explain you how to generate PWM.
About the ATD, the datasheet states what's to be done.
Plus it depends on what you want to do with the measure: display, store...

Posted: Thu Apr 14, 2005 12:57 pm    
 
Sounds like a very simple task, set up a pwm chanel to the requred frequency and set the dyty cycle to 50%. If you do not have a PWM module then use a timer output compare function. For the measurement of the analogue signal simpley connect to the ADC (if it has a 0 to 5 volt range, if not scale with an op amp). Configure the ADC and make the reading.

Can I ask, have you even looked at the user manual.

You could also try using the Codewarrior Processor Expert to write all of the code for you, but thats not in the spirit of learning. Rolling Eyes
Posted: Thu Apr 14, 2005 3:32 pm    
 
Im using the HCS12,
I got some code that works all but this one command.

WTFLG: BRCLR TFLG1,#$04,WTFLG;

I get the error Label addressing mode not supported. Any suggestions?
 
Posted: Fri Apr 15, 2005 7:40 am    
 
Quote:
You could also try using the Codewarrior Processor Expert to write all of the code for you, but thats not in the spirit of learning. Rolling Eyes


Well, Processor Expert was designed for this purpose - to give you a headstart Smile
Create a new project in Code Warriror and select support of Processor Expert during creation of the project. From the bean selector select the TimerOut bean (CPU internal periherals/TImer) and set the required pulse width in the properties of the bean.
Then add another bean - ADC (CPU Internal Peripherals/Converter/ADC). Set conversion time, select which channel you want to measure, select if you want use interrupt or not, make the project and you are done.
To start measurement call Measure method of the ADC bean, to get results use GetValue method of the ADC bean.
So in five minutes you have a working project.
Regards
ラベル(1)
0 件の賞賛
返信
0 返答(返信)