100% found this document useful (1 vote)
153 views4 pages

PIC Basic Commands

The document provides a list of commands that can be used in PIC Basic programs. Some key commands include: - ADIN to read the analog to digital converter - BUTTON to detect and debounce key presses - DELAYMS and DELAYUS to add delays in milliseconds or microseconds - IF/THEN/ELSEIF/ELSE/ENDIF for conditional execution - INPUT and OUTPUT to set pins as inputs or outputs - PRINT to display text on an LCD - PULSIN to measure pulse widths

Uploaded by

vanjalujic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
153 views4 pages

PIC Basic Commands

The document provides a list of commands that can be used in PIC Basic programs. Some key commands include: - ADIN to read the analog to digital converter - BUTTON to detect and debounce key presses - DELAYMS and DELAYUS to add delays in milliseconds or microseconds - IF/THEN/ELSEIF/ELSE/ENDIF for conditional execution - INPUT and OUTPUT to set pins as inputs or outputs - PRINT to display text on an LCD - PULSIN to measure pulse widths

Uploaded by

vanjalujic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Home ElectronicStore ElectronicBlog ElectronicSchematics Tutorials Downloads Contact

ListofPICBasicCommands

ADIN Readonchipanaloguetodigitalconverter.

ASMENDASM It'salwayspossibletoinsertassemblylanguage.

BOX DrawasquareonagraphicLCD.

ComputedGOTOforPICdeviceswithonlyonepagememory.(=ONGOTO,see
BRANCH
there)

ComputedGOTOforPICdeviceswithmorethanonepagememoryor16bitcore
BRANCHL
PICdevices.(=ONGOTOL,seethere)

BREAK ExitaFORNEXT,REPEATUNTILorWHILEWENDloopearly.

BSTART SendaSTARTconditiontotheI2Cbus.

BSTOP SendaSTOPconditiontotheI2Cbus.

BRESTART SendaRESTARTconditiontotheI2Cbus.

BUSACK SendaACKNOWLEGDEconditiontotheI2Cbus.

BUSIN ReadbytesfromI2Cdevice.

BUSOUT WritebytestoI2Cdevice.

BUTTON Detectanddebounceakeypress.

CALL Callassemblylanguagesubroutine.

CDATA Defineinitialcontentsinmemory.

CF_INIT InitialisethelinesusedforCompactFlashcard.

SetupthesectorintheCompactFlashcardthatistobewrittenorreadbythe
CF_SECTOR
commandsCF_READandCF_WRITE.

CF_READ ReaddatafromaCompactFlashcard.

CF_WRITE WritedatatoaCompactFlashcard.

CIRCLE DrawacircleonagraphicLCD.

CLEAR PlaceavariableorbitinalowstateorclearallRAMarea.

CLEARBIT Clearabitoraportorvariable,usingavariableindex.

CLS ClearaLCD.

CONFIG Adjustprogrammingfuseconfigurations.

COUNTER Countnumberofpulsesonapin.

CREAD Readwordfromcodememory.

CURSOR PositionthecursoronaLCD.

CWRITE Writewordtocodememory.

DATA Defineinitialcontentsinmemory.

DEC Variable=Variable1(Decrement).

DECLARE Adjustlibraryroutineparameters.

DELAYMS Delaywithmillisecondresolution(ms).

DELAYUS Delaywithmicrosecondresolution(2s).

DEVICE ChoosethetypeofPICtocompilewith.

DIG Returnthevalueofadecimaldigit.

DIM Createavariable.

DISABLE DISABLEsoftwareinterruptsthatwerepreviouslyENABLED.

DTMFOUT ProduceaDTMFtouchtonesequenceonapin.

EDATA DefineinitialcontentsofonchipEEPROM.

ENABLE ENABLEsoftwareinterruptsthatwerepreviouslyDISABLED.

END Stopexecution.

EREAD Readbyte,wordordwordfromonchipEEPROM.
EWRITE Writebyte,wordordwordtoonchipEEPROM.

FOR...TO...NEXT... Repeatedlyexecutestatements.
STEP

FREQOUT Generateoneortwotonesofdifferingorthesamefrequencies.

GETBIT Examineabitofaportorvariable,usingavariableindex.

GOSUB CallBASICsubroutineatspecifiedlabel.

GOTO Continueexecutionatspecifiedlabel.

HBRESTART SendaRESTARTconditiontotheI2CbususingtheMSSPmodule.

HBSTART SendaSTARTconditiontotheI2CbususingtheMSSPmodule.

HBSTOP SendaSTOPconditiontotheI2CbususingtheMSSPmodule.

HBUSACK SendaACKNOWLEDGEconditiontotheI2CbususingtheMSSPmodule.

HBUSIN ReadbytesfromI2CdeviceusingtheMSSPmodule.

HBUSOUT WritebytestoI2CdeviceusingtheMSSPmodule.

HIGH Makepinorporthigh.

HPWM GenerateaPWMsignalusingtheCCPmodule.

HRSIN ReceivedatafromtheserialportondevicesthatcontainaUSART.

HRSOUT TransmitdatatotheserialportondevicesthatcontainaUSART.

HSERIN ReceivedatafromtheserialportondevicesthatcontainaUSART.

HSEROUT TransmitdatatotheserialportondevicesthatcontainaUSART.

HRSIN2 SameasHRSINbutusinga2ndUSARTifavailable.

HRSOUT2 SameasHRSOUTbutusinga2ndUSARTifavailable.

HSERIN2 SameasHSERINbutusinga2ndUSARTifavailable.

HSEROUT2 SameasHSEROUTbutusinga2ndUSARTifavailable.

IF...THEN...ELSEIF... Conditionallyexecutestatements.
ELSE...ENDIF

INC Variable=Variable+1(Increment)

INCLUDE LoadaBASICfileintothesourcecode.

INKEY Scanamatrixkeypad.

INPUT Makeapinorportaninput.

LCDREAD ReadasinglebytefromagraphicLCD.

LCDWRITE WritebytestoagraphicLCD.

LDATA Placeinformationintocodememory.

Extractnamountofcharactersfromtheleftofasourcestringandcopytheminto
LEFT$
adestinationstring.

LEN Findthelengthofastring,NULLterminatornotincluded.

[LET] LETisoptional(notnecessary).Assignresultofanexpressiontoavariable.

LINE DrawastraightlineinanydirectiononagraphicLCD.

DrawastraightlineinanydirectiononagraphicLCD,startingfromtheprevious
LINETO
LINEcommand'sendposition.

LOADBIT Setorclearabitofaportorvariable,usingavariableindex.

LOOKDOWN Searchconstantintableforvalue.

LOOKDOWNL Searchconstantorvariableintableforvalue.

LOOKUP Fetchconstantvaluefromtable.

LOOKUPL Fetchconstantorvariablevaluefromtable.

LOW Makepinorportlow.

LREAD ReadavaluefromaLDATAtable.

LREAD8 Access8bitvaluesfromanLDATAtable.

LREAD16 Access16bitvaluesfromanLDATAtable.

LREAD32 Access32bitvaluesfromanLDATAtable,thisalsoincludesfloatingpointvalues.

Extractnamountofcharactersfromasourcestringbeginningatncharactersfrom
MID$
theleft,andcopythemintoadestinationstring.

ONGOSUB CausetheprogramtoCallasubroutinebasedonanindexvalue

Causetheprogramtojumptodifferentlocationsbasedonavariableindex.Ona
ONGOTO PICmicrodevicewithonlyonepageofmemory.(SeeBRANCH)

Causetheprogramtojumptodifferentlocationsbasedonavariableindex.Ona
ONGOTOL PICmicrodevicewithmorethanonepageofmemoryor16bitcoredevices.(See
BRANCHL)

ONINTERRUPT ExecuteasubroutineonaSOFTWAREinterrupt.

ON_INTERRUPT ExecuteasubroutineonaHARDWAREinterrupt.

ExecuteasubroutinewhenaLOWPRIORITYHARDWAREinterruptoccursona16
ON_LOW_INTERRUPT
bitcoredevice.

OUTPUT Makeapinorportoutput.

OREAD ReceivedatafromadeviceusingtheDallas1wireprotocol.(Onewireprotocol)

ORG Setprogramorigin.

OWRITE TransmitsdatatoadeviceusingtheDallas1wireprotocol.(Onewireprotocol)

PAUSE BetterisusingDELAYMS.

PEEK Readbytefromregister.

PIXEL ReadasinglepixelfromagraphicLCD.

PLOT SetasinglepixelonagraphicLCD.

POKE Writebytetoregister.

POP Pullasinglevariableormultiplevariablesfromasoftwarestack

POT Readpotentiometeronaspecifiedpin.

PRINT DisplaycharactersonaLCD.

PULSIN Measurepulsewidthonapin.

PULSOUT Generatepulsetoapin.

PUSH Placeasinglevariableormultiplevariablesontoasoftwarestack.

PWM Outputpulsewidthmodulatedpulsetraintoapin.

RANDOM Generateapseudorandomnumber.

ReadinfraredsignalfromPhilipsremotecontrols(TV,audio,etc.)(RC5protocol)see
RC5IN
alsoSONYIN.

RCIN Measurepulsewidthonapin.

READ Readbyteorwordfrommemory.

Addaremarktothesourcecode,useasmanytextasyoulike.Moreclearistouse
REM
theapostrof(')orthepointcomma()

REPEAT...UNTIL Executeablockofinstructionsuntilaconditionistrue.

RESTORE AdjustthepositionofdatatoREAD.

RESUME Reenablesoftwareinterruptsandreturn.

RETURN ContinueatstatementfollowinglastGOSUB.

Extractnamountofcharactersfromtherightofasourcestringandcopythem
RIGHT$
intoadestinationstring.

RSIN Asynchronousserialinputfromfixedpinandbaud.

RSOUT Asynchronousserialoutputtofixedpinandbaud.

SEED Seedtherandomnumbergenerator.

SELECT...CASE... Conditionallyrunblocksofcode.
ENDSELECT

SERIN Receiveasynchronousserialdata(i.e.RS232data).

SEROUT Transmitasynchronousserialdata(i.e.RS232data).

SERVO Controlaservomotor.

SET Placeavariableorpininahighstate.

SET_OSCCAL Calibratetheonchiposcillator.(Adjustinternoscillator)

SETBIT Setabitofaportorvariable,usingavariableindex.

SHIN Synchronousserialinput(SHIFTIN).

SHOUT Synchronousserialoutput(SHIFTOUT).

SLEEP Powerdownprocessorforaperiodoftime.

SNOOZE Powerdownprocessorforshortperiodoftime.

ReadinfraredsignalfromSonyremotecontrols(TV,audio,etc.)(SIRC)seealso
SONYIN
RC5IN.
SOUND Generatetoneorwhitenoiseonspecifiedpin.

SOUND2 Generate2tonesto2separatepins.

STOP Stopprogramexecution.

STRN CreateaNULLterminatedbytearray.

STR$ ConvertthecontentsofavariabletoaNULLterminatedstring.

SWAP Exchangethevaluesoftwovaribales.

SYMBOL Createanaliasforavariableorgivesanametoaconstant,port,pinorregister.

Reversethestateofaportbit.Makesanoutputhighwhenitwasloworlowwhen
TOGGLE
itwashigh.

TOLOWER Convertthecharactersfromasourcestringtolowercase.

TOUPPER Convertthecharactersfromasourcestringtouppercase.

UNPLOT ClearasinglepixelonagraphicLCD.

USBINIT InitialisetheUSBinterruptondevicesthatcontainaUSBmodule.

USBIN ReceivedataviaaUSBendpointondevicesthatcontainUSB.

USBOUT TransmitdataviaaUSBendpointondevicesthatcontainUSB.

VAL ConvertaNULLterminatedstringtoanintegervalue.

VARPTR Locatetheaddressofavariable.

WHILE...WEND Executestatementswhileconditionistrue.

XIN ReceivedatausingtheX10protocol.

XOUT TransmitdatausingtheX10protocol.

AccurateLCMeter PICVoltAmpereMeter

BuildyourownAccurateLCMeter(CapacitanceInductance VoltAmpereMetermeasuresvoltageof070Vor0500Vwith
Meter)andstartmakingyourowncoilsandinductors.ThisLC 100mVresolutionandcurrentconsumption010Aormorewith
Meterallowstomeasureincrediblysmallinductancesmakingit 10mAresolution.Themeterisaperfectadditiontoanypower
perfecttoolformakingalltypesofRFcoilsandinductors.LC supply,batterychargersandotherelectronicprojectswhere
Metercanmeasureinductancesstartingfrom10nH1000nH, voltageandcurrentmustbemonitored.Themeteruses
1uH1000uH,1mH100mHandcapacitancesfrom0.1pFup PIC16F876Amicrocontrollerwith16x2backlightedLCD.
to900nF.Thecircuitincludesanautorangingaswellasreset
switchandproducesveryaccurateandstablereadings.

60MHzFrequencyMeter/Counter 1Hz2MHzXR2206FunctionGenerator

FrequencyMeter/Countermeasuresfrequencyfrom10Hzto 1Hz2MHzXR2206FunctionGeneratorproduceshighquality
60MHzwith10Hzresolution.Itisaveryusefulbenchtest sine,squareandtrianglewaveformsofhighstabilityand
equipmentfortestingandfindingoutthefrequencyofvarious accuracy.Theoutputwaveformscanbebothamplitudeand
frequencymodulated.Outputof1Hz2MHzXR2206Function

You might also like