BNC 630 User Manual

Page 89

Advertising
background image

84

'------------------------------------------------------------------------------
'------------------------------------------------------------------------------
' Program Start
'------------------------------------------------------------------------------
'------------------------------------------------------------------------------

DECLARE SUB Delay (X%) ' Declare functions used below.
' (The Delay function waits
x mS then returns)
DECLARE SUB Pause () ' (The Pause fctn waits for a keypress then returns)

DIM Array(5) ' General purpose array

' -------------------------- User Entered Values -----------------------------------------

' By observing the signal from a remote control with an oscilloscope, the following
' parameters were recorded. To adapt this program to another remote control model, change
' the values below:

CarrierFreq$ = "32768" ' Type in the infrared carrier freq here.
' this value is in Hz
OnTime$ = "30" ' Type in the burst on time here.
' this value is in mS
OffTime$ = "10" ' Type in the burst off time here.
' this value is in mS

' These variables hold the number of pulses that form each command:

PowerToggle = 20 ' Turn the TV on and off (twenty pulses)
ChannelUp = 9 ' Go to next channel
ChannelDown = 12 ' Go to previous channel
VolumeUp = 3 ' Increase volume one notch
VolumeDown = 5 ' Decrease volume one notch

'--------------------------------------------------------------------------------
'--------------------------------------------------------------------------------

CLS ' Clear the screen

' This array is used as a data table which, given a command menu number as an index,
' returns the number of pulses in a given infrared pulse stream.

Array(1) = PowerToggle
Array(2) = ChannelUp
Array(3) = ChannelDown
Array(4) = VolumeUp
Array(5) = VolumeDown

' Open serial port 1 for communication with the 630 with these parameters:
' Ignore the CD,CTS,DCD flow control lines
' Set a 5 sec maximum time-out for basic to open the port
' Set the receive buffer to 2K bytes
' Disable the RTS flow control line
' Set the transmit buffer to 1K bytes
' File access type is Random
' Set random access buffer size to 2K

OPEN "COM1:9600,n,8,1,CD0,CS0,DS0,OP5000,RB2048,RS,TB1024" FOR RANDOM AS #1 LEN = 2048

Advertising