' Name : PULSOUT.pbp ' Compiler : PICBASIC PRO Compiler 2.6 ' Assembler : PM or MPASM ' Target PIC : 12F, 16F, 18F ' Hardware : 2 x normally-open push button switches ' Oscillator : 4MHz internal or external ' Keywords : PULSOUT ' Description : PICBASIC PRO program to demonstrate use of PULSOUT command ' for a variable pulse generator. Two buttons adjust from off to 10mSec in ' 10 uSec steps. ' Include "bs1defs.bas" ' Include BS1 variables and serial modes DN Con 5 ' Define frequency down button UP Con 4 ' Define frequency up button PO Con 3 ' Define pulse output pin W0 = 0 Low PO ' Initialize output polarity inc: If (Pin4 = 1) Or (W0 = 1000) Then decr ' Increment freq on button W0 = W0 + 1 decr: If (Pin5 = 1) Or (W0 = 0) Then pulse ' Decrement freq on button W0 = W0 - 1 pulse: Pulsout 3,W0 ' Generate pulse Pause 10 ' Intra-pulse delay Goto inc ' Forever End