ME Labs, Inc.
719-520-5323
 
Home:
  Developer Resources:

Programming Clues
    Sample Programs
   
    PICBASIC PRO™
Compiler Manual
    PICBASIC™ Compiler
Manual
    Serin2/Serout2 Modes
    ASCII Character Set
    Number Conversion
    Floating Point
Routines
    PBP Debug Monitor
    Articles and Tutorials

Hardware Clues
    Parts / Vendor List
    PICPROTO™ Boards
    LAB-X1 Docs
    LAB-X2 Docs
    LAB-X20 Docs
    LAB-X3 Docs
    LAB-X4 Docs
    LAB-XUSB Docs
    LAB-XT Docs
     
 

microEngineering Labs, Inc. | 1-719-520-5323 | Example Program - PULSOUT.pbp

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.
' 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

           

Download the program file.