'********************************************************************************************* ' radio-analysis.bas ' Program to measure the pulse widths of 2 channels from the R700 radio receiver and then ' display the results on the LCD display. '********************************************************************************************* Include "modedefs.bas" ' Include serial modes trisa = %00000011 ' set porta pins 0&1 to inputs trisb = %00001000 ' set portb pin 3 to input lcd var PORTA.3 ' define variables and constants piezo var PORTB.4 left_led var PORTB.0 right_led var PORTB.1 chan_1 var PORTA.0 chan_2 var PORTA.1 baud con N2400 Channel_1 var byte Channel_2 var byte low left_led ' turn off left LED low right_led ' turn off right LED Serout lcd,baud,[254,1] ' clear lcd screen pause 1000 ' give time to initialize lcd Serout lcd,baud,[254,128,"Radio Control"] ' display program title on the LCD sound piezo,[100,10,50,5,70,10,50,2] ' Make startup sound pause 1000 ' wait for 1 second Serout lcd,baud,[254,128,"channel-1: "] ' set up the LCD display Serout lcd,baud,[254,192,"Channel-2: "] main: pulsin chan_1,1,channel_1 pulsin chan_2,1,channel_2 Serout lcd,baud,[254,138,#channel_1," "] ' display channel 1 pulse width value Serout lcd,baud,[254,202,#channel_2," "] ' display channel 2 pulse width value Goto main End