Maker Pro
Maker Pro

PWM - pic18f4550 - led + potentiometer

Bellon

Sep 20, 2015
10
Joined
Sep 20, 2015
Messages
10
Hello. I'm doing my first program with pwm and am encountering some difficulties to do a small project. I want to vary the voltage of an LED as the turning of a potentiometer. However, the examples I found are with PWM own libraries, which I have not. I'm using a PIC18F4550 in MPLAB X.
If anyone can help me, I will be very grateful.
 

Bellon

Sep 20, 2015
10
Joined
Sep 20, 2015
Messages
10
The "Library Routines" are these (available in MikroC):
PWM1_Init
PWM1_Set_Duty
PWM1_Start
PWM1_Stop

I can use these in MikroC but do not know what to use to program the MPLAB.
 

pgib8

Jul 26, 2015
107
Joined
Jul 26, 2015
Messages
107
Forget the library, just write your own code. You will learn so much more, or do you want to be one of these people that do such exciting projects they talk about but in reality they just used a bunch of libraries and copy and pasted some code from the internet?

setting up the PWM should take you maybe an hour or two.
setting up the ADC to read the potentiomenter, probably 30 minutes.
tweaking some numbers, maybe another hour.
that's a very conservative estimate, in other words you can do it.
i myself could do the whole thing in probably 15 minutes or less. finding the right libraries and learning how to use them would actually take me longer... just some thoughts.
 
Top