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
     
 

ME Labs, Inc. | 1-719-520-5323 | Example Program - HSERX18.pbp

PICBASIC PRO program to Send and receive from the hardware serial port. LED counts characters and flashes error if none received for 10 seconds.
' Name        : HSERX18.pbp
' Compiler    : PICBASIC PRO Compiler 2.6
' Assembler   : PM or MPASM
' Target PIC  : PIC16F88 or similar
' Hardware    : LAB-X18 Experimenter Board
' Oscillator  : 4MHz external crystal
' Keywords    : HSERIN, HSEROUT
' Description : PICBASIC PRO program to Send and receive from the hardware
' serial port. LED counts characters and flashes error if none received for
' 10 seconds.
'

char Var Byte           ' Storage for serial character
led  Var PORTB.0        ' Alias LED pin

   TRISB = %11111110    ' Set PORTB.0 to output
   LED = 0              ' Turn off LED

loops:
   Hserin 10000, allon, [char]  ' Get a char from serial port
   Hserout [char]       ' Send char out serial port

   TOGGLE led           ' Toggle LED
   Goto loops           ' Do it all over again

allon:
   HIGH led             ' Error - no character received
   Pause 500            ' Blink LED
   LOW led
   Pause 500
   Goto allon

   End

           

Download the program file.