Help with PWM Signal in Caterpillar Engine Simulator

enorrav

Joined Nov 22, 2006
1
Hi! I'm making a Caterpillar Engine Simulator project and for the throttle position sensor I need to create a PWM signal (I'm using a 16F887 pic) which goes to the electronic control module of the engine, the issue is that the duty cycle should be variable depending on the position of the pedal accelerator (from 5% to 95%), and I only know to put a constant value. I was hoping you guys could help me in this issue or to tell me if this could be possible through an A/D conversion of a range of 0-5V and then the digital value could go to the register of the pwm mode, in theory sounds good but please help me.

beenthere

Joined Apr 20, 2004
15,819
Hi,

A PWM signal consists of some arbitrary time period. I'll use 100 ms as an example. A 50% PWM signal would consist of a train of pulses 50 ms in duration. The frequency of the pulse train does not vary, only the pulse duration. The duration of the pulse width is the modulation.

You can put an encoder on the pedal to give you a digital value directly, as well as an analog signal from a pot that has to be digitized.

With the digital value in the PIC, all you have to do is calculate what percentage that value is compared to 256, and let that set the pulse width out to the control module.

phani kuamar k.s.v

Joined Mar 25, 2008
2
I HAVE A PROGRAM WHICH HAS 3 DIFFERENT INPUT VALUES AND THE OUTPUT WOULD BE A pwm SIGNAL WITH ITS FREQUENCY VARYING , DEPENDING ON THE INPUT VALUE.
FOR EXAMPLE IF INPUT IS 3 THE TIME WILL BE 1.5ms AND SO .. HENCE FREQUENCY CAN BE VARIED..

JUST WRITE A PROGRAM IN ANY COMPILER FOR EXAMPLE vc++ AND CHECK FOR ...

TAKE PORT B AS INPUT AND PORT C AS OUTPUT..

MAIL ME TO PHANI5016@GMAIL , TO GET THIS PROGRAM

WISH GOOD LUCK