PIC JAL IO Routine

PWM Out

by Branko Karaklajic [branek at EUnet.yu]

jPWM.jal - main library 
jPWMpin.jal - configuration pin library (default: pin A2)
 
    syntax is:
 
    PWM_OUT (DUTY, CYCLE) where is:
 
    DUTY - (0 - 255), duty cycle --- 0 = 0v, 255 = 5V (+ few percent)
 
    CYCLE - (1 - 255), number of times to do PWM_OUT --- 1 = 4,17 ms, 255 = 1,063s (+ few percent)
 
I tryed that this command be like a BASICSTAMP PWM command. 
 
    On this list a saw before a question for PWM speed controller. Guy can not to solve a pwm output to control a motor. I think this can do a job.
 
A quick example for LED dimmer:
--------------------
include 16f84_4
include jpic
include jlib
include jpwm 
 
-- This example turn ON LED on A2 and then dimmer it to OFF for 2 sec
 
var byte PRO = 255 -- start PWM with 5V
 
forever loop
 
 pwm_out(PRO, 10) -- PWM out to LED for 41.7 ms
 PRO = PRO - 5 -- decrement PRO  
 
end loop
--------------------
 
#########################################
#          branek@eunet.yu
# http://solair.eunet.yu/~branek - not working yet
#            ICQ: 15616778
#            www.otpor.com
#########################################

See:

See also: