' 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