'------------------------------------------------------------------------------- ' WCSPrismV21.BAS, for QB64 compiler for Windows ' Example code for sending simple messages to the USB BetaBrite Prism ' Copyright 2012, provided courtesy of Walker Consulting Solutions ' ' Based on PRISMMES.BAS - Gary Peek - IndustroLogic, Inc. ' ' Requires betabriteusb.dll in the same folder as QB64 exe. ' betabriteusb.dll copyright Adaptive Micro Systems. ' ' See SEGGER Microcontroller Systemes GmbH USB Bulk Stack documentation for info ' on USBBULK_ functions. '------------------------------------------------------------------------------- DECLARE DYNAMIC LIBRARY "betabriteusb" FUNCTION USBBULK_Open () FUNCTION USBBULK_Close () FUNCTION USBBULK_Write (msg AS STRING, BYVAL SIZE AS LONG) END DECLARE DIM bbMode AS STRING DIM bbColor AS STRING DIM bbText AS STRING DIM bbString AS STRING DIM returnval AS INTEGER DIM autobaud AS STRING autobaud = CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) 'autobaud NULL characters bbMode = "a" ' mode = rotate bbColor = CHR$(28) + "Z" + "40FFFF" ' extended RGB color (whitish blue) 'This program can be run from the command line by typing the name of the executable to display 'the default text or a custom message can be included after the executable name. bbText = "Betabrite Prism Test v2.1 by Walker Consulting Solutions www.WalkerConsulting.net" IF LEN(COMMAND$) > 0 THEN bbText = COMMAND$ ELSE PRINT "Type your custom message after the command line call to this program" END IF PRINT "DISPLAY PROPERTIES" PRINT "Display Mode = " + bbMode PRINT "Display Color = " + bbColor PRINT "Display Text = " + bbText PRINT "" PRINT "Attempting to open USB" IF USBBULK_Open = 0 THEN PRINT "There was a problem opening the USB connection" returnval = USBBULK_Close ELSE PRINT "USB Connection Successful" END IF PRINT "" 'build simple Alpha transmission packet (Letters in parens reference Alpha protocol document) bbString = autobaud 'autobaud NULL characters (A) bbString = bbString + CHR$(1) 'SOH character (B) bbString = bbString + "Z" 'Type Code: All Signs (C) bbString = bbString + "00" 'Sign Address: Broadcast (D) bbString = bbString + CHR$(2) 'STX Character (E) bbString = bbString + "A" 'Command Code: A - TEXT file (F) bbString = bbString + "A" 'File Label: A (G-B) bbString = bbString + CHR$(27) 'ESC Character (G-C) bbString = bbString + " " 'Display Position (reqd, ignored on 1-line signs) (G-D) bbString = bbString + bbMode 'Display mode (from variable above) (G-E) bbString = bbString + bbColor + bbText 'ASCII Message (G-G) bbString = bbString + CHR$(4) 'EOT Character (H) PRINT "Write bbString = " + bbString returnval = USBBULK_Write(bbString, LEN(bbString)) PRINT "Close USBBulk Device" PRINT "" returnval = USBBULK_Close 'Uncomment the SYSTEM call to automatically close the window after the message has been sent 'Leave it commented to show debugging information 'SYSTEM