--
-- file : jPWMpin.jal
-- author : Branko Karaklajic
-- date : 21-MAY-2000
-- purpose : PWM-Output on PIC pin
-- requires : jPWMpin.jal
--
-- Copyright (C) 2000 Branko Karaklajic, branek@eunet.yu
--
-- This library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Library General Public
-- License as published by the Free Software Foundation; either
-- version 2 of the License, or (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Library General Public License for more details.
--
-- You should have received a copy of the GNU Library General Public
-- License along with this library; if not, write to the
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- Boston, MA 02111-1307, USA.
include jPWMpin
procedure PWM_OUT(byte in PWM, byte in TRA) is
var byte LoPWM
var byte HiPWM
PWM_out_pin_direction = output
assembler
local PWMa
local PWMb
local PWMtra
local PWMend
bsf status, status_rp0
movlw 0b_1000_0011
OPTION
bcf status, status_rp0
movf PWM, W
movwf LoPWM
sublw 0xFF
movwf HiPWM
PWMa:
bcf INTCON, intcon_t0if
movf HiPWM, W
movwf TMR0
PWMb:
bsf PWM_out_pin
call PWMtra
bcf INTCON, intcon_t0if
movf LoPWM, W
movwf TMR0
bcf PWM_out_pin
call PWMtra
decfsz TRA,f
goto PWMa
goto PWMend
PWMtra:
btfss INTCON, intcon_t0if
goto PWMtra
return
PWMend:
end assembler
PWM_out_pin_direction = input
end procedure
file: /Techref/piclist/jal/jPWM.jal, 1KB, , updated: 2000/8/15 11:02, local time: 2024/9/18 16:22,
|
| ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://linistepper.com/techref/piclist/jal/jPWM.jal"> piclist jal jPWM</A> |
Did you find what you needed?
|