I have a question please

General discussion on mikroC.
Post Reply
Author
Message
Moustafa
Posts: 1
Joined: 29 Aug 2011 16:01

I have a question please

#1 Post by Moustafa » 29 Aug 2011 16:13

Hallo ...

I am using PIC 16F877A and mikroC to develop a code that reads two inputs (V1 and V2) from port A using Adc_Read and then
the code should produce a PWM with variable duty cycle that can be calculated depending on the two inputs as follows:

e=(V1new - V1old)/(V2new - V2old)
Duty_cycle= 12/(54*e+36)

The problem is that how to implement multiplication, division, addition, and subtraction for the inputs with decimals like (12, 36, and 54) while PIC reads them as BCD
such that 0 input voltage is zero and 5 input voltage is 255.
It will be great if any body can support me with the answer..
Thank you so much..

Post Reply

Return to “mikroC General”