Home

AIS Cube

image

Contents

1. Code R Dim S As String 02 Dim I As Integer 03 04 Public Sub Man OS S The Number Is OGe I 5 Oye Debug Print Hello World 08 rele roi Bie Manes ee 09 Debug Print Cstr I 10 pne Sub m Of course the Debug Statement accepts a mix of all the above You may put the Cstr I after the semicolon on line a BCORE USER MANUAL REV B JUNE 2010 RELEASE BLAZINGCORE COMMAND SET BIT BYTE amp WORD MANIPULATION System commands are provided to enable users to manipulate values in bit byte or word format The following table lists the available operations and their respective description lt Operator gt value Operator Description Abs Returns the absolute value of its argument Set an individual bit at a specified position to logical 1 Bit Position 0 31 SCOUDLULUOZ LU IS S SetBit Fg SetBit variable as integer bit position e Set an individual bit at a specified position to logical O Bit Position 0 31 Eg ClrBit variable as integer bit position GetBit Get the logical state of an individual bit at a specified position HI Returns the High Byte in the Low Word Portion of a 32bit Integer Value L Returns the Low Byte in the Low Word Portion of a 32bit Integer Value HiHiByte Returns the High Byte in the High Word Portion of a 32bit Integer Value HiLoByte Returns the Low Byte in the High Word Portion of a 32bit Integer Value HiW
2. ALL OTHER TRADEMARKS OR REGISTERED TRADEMARKS ARE THE PROPERTY OF THEIR RESPECTIVE OWNERS
3. ETA sdqoozs HL jE 600000 sir ir eee MELR MCLR Power Swibeh crer Indicador dd 9 O31 739 ad Ta aa 09 BCORE USER MANUAL REV B JUNE 2010 RELEASE Li C O O N lt cn SCHEMATIC NOWYdI3 ONO la Noung 13534 419 9310 as la sl 810d ON9 STA 0394 0394 SYANS 9 UY YLLYYN wen YELYYN ch QC 1 i eet UNS D lt OY Ovd 1N aed OYd L ON9 01019800 D EO DE JH AYALA UYA LNHOW YU 10M LH O BCORE USER MANUAL REV B JUNE 2010 RELEASE MEMORY MANAGEMENT ONBOARD MEMORY SRAM 110K There is a total of 110K of SRAM Memory for User User Code Code User Variable and the Program Stack The amount of memory allocated for the code and variable is user defined F Users are able to define the amount of memory to User Variable o l allocate for code and data within the IDE using the configurations page The Program Stack grows and shrinks during program run time as variables are declared assigned and disposed EXTERNAL MEMORY BCOREI00 DataFlash Size 1 2 4 8 16MB The BCore100 uses a DataFlash chip for i
4. OLED Cursor Y DRAW Uses inbuilt native libraries in BCore to draw primitives and bitmaps on to the screen All primitives are drawn using the specified foreground colour Member Description Point Plots a pixel at a specified point on the OLED Screen Points Plots an array of points Line Draws a Line Lies Draws an array of Lines Rectangle Draws a Rectangle of specified sizing at a specified position FillRectangle Draws a Filled Rectangle of specified sizing at a specified position Circle Draws a Circle of specified sizing at a specified position BitmapFromDFlash Draws a bitmap file from the data flash memory chip BitmapFromMemCard Draws a bitmap from External Memory Card MMC to the Screen BCORE USER MANUAL REV B JUNE 2010 RELEASE OLED COMMAND REFERENCE SONU MOIG AO POINT 7 Plots a single pixel at a specified point on the OLED Screen ka Point1 lt x1 y1 gt OLED Draw POint point POINTS gt Plots an array of pixels Points 1 lt x1 y1 gt Parameters e Points 2 lt x2 y2 gt e Points point array 0 ka e Zero offset start zero offset start index of point array to start plotting from Points 0 lt x0 yO gt e Number of points number of points to plot Points 3 lt x3 y3 gt OLED Draw Points points zero offset start number of points LINE Ra Point2 lt x2 y2 gt Draws a Line from point1 to point2 on the OLED Screen nn OLED Draw Line pointi point2 Point1 lt x
5. Arr2 1 3 ROR For I 0 To ii DEBUG PRINT CSTR Arr2 I 125 Next l gt Le macl Sul FINDFIRST Performs a search function into specified data arrays Methods Description Min Returns index of first occurrence of the smallest number in a specified range of elements Max Returns index of first occurrence of the largest number in a specified range of elements MIN Returns index of first occurrence of the smallest number in a specified range of elements Variable OS Memory FindFirst Min Memory Start Length Parameter s Memory Data array to carry out the search Start Index of Data Array to start searching from Length Number of elements to search Returns Index of element at which the condition was satisfied Code ME Dim Arr1 20 as Integer 1 2 Dim Arr2 20 as Integer Ose Public Sub Main 04 Dim I as Integer DIS Initialise the Array with some values 06 For I 0 To 5 9755 Arr Ty I OS Next 09 I OS MEMORY FINDFIRST Min ARR1 0 10 L10 debug print pos cstr 1 IAM 12 MN End Sub BCORE USER MANUAL REV B JUNE 2010 RELEASE OS COMMAND REFERENCE MAX Returns index of first occurrence of the largest number in a specified range of elements Variable OS Memory FindFirst Max Memory Start Length Parameter s Memory Data array to carry out the search S
6. Byte 8bits 1 Byte 0 255 Integer 16bits 2 Bytes 32 768 to 32 767 Long 32bits 4 Bytes 65 536 to 65 535 Single String 64Bytes Max 64 Chars Point Points 32bit 16bit X 16bit Y X amp Y Point X Point Y Rectangle Rectangles 2 Points Point1 Point2 BCORE USER MANUAL REV B JUNE 2010 RELEASE VB NET LANGUAGE REFERENCE 3 SI8qu7 sjubsuos SUOISSOJOX CONSTANTS For constants declared in module level code Public Private Const constant_name As lt Data_Type gt lt literal gt By default a declaration is private Labels serve as targets for the goto statements Mark the desired statement with a label and colon like this label_identifier statement Code Ol Dim Count As Integer DZ Public sub Maia 03 Count 0 04 AGAIN LS Count Count 1 06 IE Count lt gt 5 Then OTa Goto AGAIN 08 End If 09 End Sub An expression is a sequence of operators operands and punctuators that returns a value Code 01 MM ass variable OZ SETS ve ai Position Ose CLRBIT variable position 04 GHIBLI variable positerzon 05 06 HIGH variable 07 LOW variable 08 09 BCORE USER MANUAL REV B JUNE 2010 RELEASE S DIV VB NET LANGUAGE REFERENCE ARRAYS An array represents an indexed collection of elements of the same type called the base type Note Maximum dime
7. Convert non string data type variables to its hexadecimal equivalent in a string Len Returns length of String Mid Returns a string containing a specified range of characters from a string ADD Strings can be concatenated by adding them together using the plus operator Additions of strings are also allowed between strings of different memory sources as well as in conjunction with other string methods Code OL Dim StringA StringB StringC As String 1 WAS Public Subp Main UZ StringA This Is 04 SuLings A Strang 05 StringC StringA StringB Wer Debug Print Sebring or End Sub Output 01 PB this s A string COMPARE Compares two strings Returns True if strings match False if it does not Variable String Compare string_A string_B CHR Returns the character associated with the specified character code as string Valid range for character code is O through 255 Chr Character Code Code 01 Ml bin STR1 as string E SI EEE 03 DEEUG See SIRI Output o ESE BCORE USER MANUAL REV B JUNE 2010 RELEASE VB NET LANGUAGE REFERENCE CSTR Convert non string data type variables to string SOULS Cstr variable Code D Dim I As Integer UZ Public Sub Main MS 100 04 Debug Print Cetr I DS End Sub Output ok CSTRHEX Convert non string data type variables to its hexadecimal equivalent in a
8. MMC SD Compatible OLED Draw BitmapFromMemCard FileName Position Parameters e FileName Name of Bitmap File in String e Position Point XY location to draw bitmap Code lls Dim Pl As Point UZ Publie Sub Main 5 Dim 1 As Integer 04 DNS TRAS SO MEANS 050 OLED INIT O 06 OLED SETCOLOUR FOREGROUND 31 Os I OS MEMCARD INIT 08 STR BoPLAYRR BME 09 P1 X 50 OS PLY 20 1S I OLED DRAW BITMAPFROMMEMCARD STR1 Pl 2 End Sub BCORE USER MANUAL REV B JUNE 2010 RELEASE INOJ OLED COMMAND REFERENCE FONTTYPE 7 Sets the font size of text printed to the screen T Available font sizes are 8x8 10x12 16x16 pixels BO OLED Font Type Assignment e OLED FontType font size 0 8X8 pixel 1 10x12 pixel 2 16x16 pixel A BCore Constant that stores the font size values is available to make the code more readable The following shows a code comparison on how to set the font size using direct assignment of values and using the BCore Constants Both codes achieve the same effect Code Code One OLED FontType 0 all OLED FontType BCK Font Small 0 OLED FontType 1 02a OLED FontType BCK Font Medium 03 OLED FontType 2 Sere OLED FontType BCK Font Large FOREGROUND Set the foreground colour of the OLED OLED Foreground Colour Code om CODE1 O22 Public Sub Main 03 INIT THE OLED AND SET THE BACKGROUND COLOUR TO BLACK 04 OLED Init BCK COLOURS BLACK 05 OLED Fore
9. case B Player as per the example code under the OLED Draw BitmapDF lash Command Note The data file downloads directly to the external data flash chip separate from downloading the actual program Downloading your program does NOT download the data from the data file to the external data flash chip at the same time External Memory Card 1 To store Bitmap files in the External Memory Card MMC SD Compatible make sure you slot an MMC card into your card reader on your Laptop PC and open it up using Windows Explorer 2 Drag and Drop your Bitmap files into the External Memory Card 3 When you re done eject the External Memory Card and slot it into the External Memory Card Socket onboard the OLED interface board 4 The bitmap files in the External Memory Card are now programmatically accessible using the Bitmap File Name as per the example code under the OLED Draw BitmapFromMemCard Command Please note that the file name length must be kept to 8 characters Files with names longer than that may fail to open BCORE USER MANUAL REV B JUNE 2010 RELEASE HOY INDSV APPENDIX B ASCII CHART The following is a standard extended ascii chart supported by the BCore Font Library 0 1 7 3 4 5 6 7 8 9 mM RN fj gq 0 T QJ 4 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 76 27 28 29 BCORE USER MANUAL REV B JUNE 2010 H rr LEASE LATEST DOCUMENTATION All of our documentations are constantly
10. first occurrence of the largest number in a specified range of elements COPY Copies elements from one array to another OS Memory Copy Source Destination Length Parameter s Source Variable Array to copy from Destination Variable Array to copy to Length Number of elements to copy over Code oil Dim Arri 20 as Integer 1 O22 Dim Arr2 20 as Integer 03 Public Sub Main 04 Dim I as Integer US Initialise the Array with some values 06 For I 0 To 5 OTe Arri I I US Next 09 OS Memory Copy Arr1 Arr2 3 O For I 0 To 5 ii DEBUG PRINT CSTR Arr2 I 2 Next End Sub Output oOo o 2 0 0 o COPYEXT Copies elements from one array to another OS Memory CopyExt Source Source Start Destination Destination Start Length Parameter s Source Variable Array to copy from Source Start Index of Source to start copying elements from Destination Variable Array to copy to Destination Start Index of Destination to start copying elements to Length Number of elements to copy over BCORE USER MANUAL REV B JUNE 2010 RELEASE NOUN OS COMMAND REFERENCE Code ales IN cin Arr1 20 as Integer o UZ Dim Arr2 20 as Integer 03 Public Sub Main 04 Dim I as Integer US Initialise the Array with some values 06 For I 0 To 5 OTa Arri I I US Next 09 OS Memory CopyExt Arr1 2
11. language although C NET language support is underway Users should take note that while the syntax accepted is meant to be similar to the NET language the platform is essentially an embedded system and not a full fledged NET platform running on the Windows OS As such the language is streamlined to better suit the embedded platform BCORE OS COMMANDS The BCore OS Commands are native libraries that address the embedded side of the BCore Chip They are separate from the NET Syntax Language and are usually denoted by its syntax colour dark blue as opposed to the NET syntax colour blue The OS Commands are used when dealing with the IO peripherals system components device communication protocols and for performing bit byte and word manipulations When custom control is required and not supported natively by the BCore OS nor amongst the many libraries available for common devices shipped with the IDE you will find that modifying codes from the library similar to your device or software bit banging is easily achieved BCORE USER MANUAL REV B JUNE 2010 RELEASE VB NET LANGUAGE REFERENCE COMMENT REMARK FORMAT An apostrophe is used to denote a comment Code 01 This is a remark ee DS As Oring OS 5 This is noe a remark All characters to the right of the apostrophe are usually ignored by the compiler unless the apostrophe is embedded inside a string literal VARIABLE DECLARATION Dim lt Identifi
12. on or off Methods Description lt High Turn the LED on Low Turn the LED off O LED1 LED2 HIGH Turn the LED on OS LED1 High OS LED2 High LOW Turn the LED off OS LED1 Low OS LED2 Low EXTERNAL MEMORY CARD MMC BCore provides support to accessing files located in the external memory card MMC Bus line of the External Memory Card on the OLED Interfacing Board to the BCore Board would have lined up upon stacking As such no pin definitions are required on the user s part Provides access to methods for handling an external memory card MMC and file operations Members Description Dir Provides methods to access the directories within the external memory card File Provides methods to access files and carry out file stream operations Init Handles the necessary one time initialisation of the memory card before use BCORE USER MANUAL REV B JUNE 2010 RELEASE OS COMMAND REFERENCE DIR Provides methods to access the directories within the external memory card Methods Description Change Change current directory within the external memory card ds Returns first occurrence of a specified string in names of all the files in current directory FindNext Returns next occurrence of a specified string in names of all the files in current directory Get Get path of current directory CHANGE Change current directory to a specified one within the external memory card Nooaid ONN Variable OS Me
13. reading values from the touch screen Provides write abilities to the OLED driver S6E63D6 registers T Please refer to S6E63D6 Driver IC Datasheet for full register listing ACCEL Provides Access to methods for reading values from the onboard accelerometer Description Get X axis reading Get Y axis reading Get Z axis reading Member X Y 7 lt variable gt OLED Accel X Code 02 03 04 05 06 07 08 09 10 ii Public X Y Z as Integer Public Sub Mara Do X OLED Accel X Y OLED Accel Y Z OLED Accel Z DESUSO IT ees EZ Delay 200 Loop Ene gub BCORE USER MANUAL REV B JUNE 2010 RELEASE C310 OLED COMMAND REFERENCE BACKGROUND Ef Set the background colour of the OLED OLED Background COLOUR Code 01 MW cone o UZ Public TEIL OS INIT THE OLED AND SET THE BACKGROUND COLOUR TO BLACK 04 OLED INLE BECK COLOUR BLACK ER CHANGE THE BACKGROUND COLOUR TO FUSCHIA 06 OLED Background Colour BER COLOUR Us chata AK End Sub 3 CLEAR Clears the screen OLED Clear CURSOR Y Get or Set the Cursor Position Member Description X Set X coordinate of cursor xX Set Y coordinate of cursor Home Sets the cursor to 0 0 position To set the cursor position OLED Cursor X value OLED Cursor Y value OLED Cursor Home Value Any literal constant or expression To get the cursor position value OLED Cursor X value
14. the OLED screen to be initialised with Note Colour listing available Please refer to the page on using colour constants OLED Init colour Code 01 CODE1 Oye Publie Sub Main OS INIT THE OLED AND SET THE BACKGROUND COLOUR TO BLACK JA OLED Init BCK COLOUR BLACK Oe End Sub Provides access to reading values from the onboard Light Dependent Resistor LDR LDR OLED LDR Read Code cu Public LDR as Integer 02 Public Sub Main DS Do 04 LDR OLED LDR READ OS Debug Print Cstr LDR OG o Delay 200 Ode Loop US anme Suo BCORE USER MANUAL REV B JUNE 2010 RELEASE OLED COMMAND REFERENCE ORIENTATION Set the orientation of the OLED screen to portrait or landscape OLED Orientation Orientation Parameter s Orientation a 0 Landscape Default a 1 Portrait PRINT 7 Prints text to screen using specified foreground colour Works just like Debug Print Note Default text size is 8x8pixels LR D Ee O angi String Variable String Const Full set of 256 ASCII characters supported READREGISTER 7 Returns the contents of the OLED driver S6E63D6 register at a specified address OLED ReadRegister Address WRITEREGISTER 7 Provides write abilities to the OLED driver S6E63D6 registers T Please refer to S6E63D6 Driver IC Datasheet for full register listing OLED WriteRegister Address Value SETCOLOUR Set foreground and background colours Member _ Descriptio
15. updated to provide accurate and or new information that we feel would help you with developing with our products The latest documentation may be obtained from our website http www aiscube com main downloads html HOW YOU CAN HELP You can help us to improve our documentations by emailing to us or posting a thread in our forum reporting any mistakes typos or errata that you might spot while reading our documentation Email TechSupport aiscube com Forum http forum aiscube com index php DISCLAIMER All information in this documentation is provided as is without any warranty of any kind The products produced by AIS Cube are meant for rapid prototyping and experimental usage they are not intended nor designed for implementation in environments that constitute high risk activities AIS Cube shall assume no responsibility or liability for any indirect specific incidental or consequential damages arising out of the use of this documentation or product COPYRIGHTO 2009 2010 AIS CUBE ALL RIGHTS RESERVED ALL PRODUCT AND CORPORATE NAMES APPEARING IN THIS DOCUMENTATION MAY OR MAY NOT BE REGISTERED TRADEMARKS OR COPYRIGHTS OF THEIR RESPECTIVE COMPANIES AND ARE ONLY USED FOR IDENTIFICATION OR EXPLANATION FOR THE OWNER S BENEFIT WITH NO INTENT TO INFRINGE THE BLAZINGCORE BCORE AND BCORE IDE ARE TRADEMARKS OF AIS CUBE IN SINGAPORE AND OR OTHER COUNTRIES ALL IMAGES DEPICTING THE BLAZINGCORE OR ANY PART OF IT IS COPYRIGHTED
16. 0 select YCrCb COMA 2 Auto white balance 1 Enable AWB 0 Disable AWB COMA 1 Color bar test pattern 1 Enable color bar test pattern COMA 0 Reserved 13 COMB 01 RW Common Control B COMB 7 6 Reserved COMB 5 Select data format 1 select 8 bit format Y CrCb and RGB is multiplexed to 8 bit Y bus UV bus is tri stated O select 16 bit format COMB 4 1 enable digital output in ITU 656 format COMB 3 CHSYNC output 1 horizontal sync 0 composite sync COMB 2 1 Tri state Y and UV busses 0 enable both busses COMB 1 1 Initiate single frame transfer COMB 0 1 Enable auto adjust mode INITIALIZING THE CAMERA MODULE Code ja PUBLIC SUB MAIN 02 Tnit Camera Module US CAM WRITEREG 18 128 Common Control A 0x12 04 DELAY 200 US CAM WRITEREG 18 64 32 16 8 4 06 DELAY 200 OTe CAM WRITEREG 17 6 SPEED DONT CHANGE 0x11 06 CAM WRITEREG 19 32 1 Common Control B 0x13 US IOR END SUB BCORE USER MANUAL REV B JUNE 2010 RELEASE VISION SYSTEM CAMERA COMMANDS GRABFRAME Grabs a single frame from the camera module and writes it directly to the OLED s GRAM for display CAM GRABFRAME DISUWDI Code 01 MM PuBLIC SUB MAIN 02E Init Camera Module se CAM WRITEREG 18 128 Common Control A 0x12 04 DELAY 200 Gor CAM WRITER
17. 1 y1 gt LINES Draws an array of points as a continuous connected line Points 1 lt x1 y1 gt Parameters e Points point array e Zero offset start zero offset start index of point array to start plotting from Points 0 lt x0 yO gt e Number of points number of points to plot Points 2 lt x2 y2 gt Points 3 lt x3 y3 gt OLED Draw Lines points zero offset start number of points Point1 lt x1 y1 gt RECTANGLE 7 Draws a Rectangle using 2 points OLED Draw Rectangle pointil point2 Point2 lt x2 y2 gt FILLRECTANGLE A Point1 lt x1 y1 gt Draws a solid filled rectangle of foreground colour from point to point2 on the OLED Screen OLED Draw FillRectangle pointl point2 Point2 lt x2 y2 gt CIRCLE 7 Draws a circle Parameters accept center point position and radius of circle Center point R OLED Draw Circle center point radius BCORE USER MANUAL REV B JUNE 2010 RELEASE SQADUUJIG OLED COMMAND REFERENCE DRAWING BITMAPS TO SCREEN Storage and Rendering of Bitmap files are supported by the BCore OS However due to the nature of bitmap files they tend to require a large amount of memory As such Bitmaps are only allowed to be stored on External Memory Cards like MMC Cards or the external DataFlash chip Depending on where you store your Bitmap Files a single line command is able to fetch the image file and draw it onto the OLED screen provided it i
18. 2 Dinos cl a C OS Dim I as Integer 04 I OS MEMCARD INIT ae DEBUG PRINT INIT CSTR T 06 SIRLI PO TXIA ore I OS MEMCARD FILE OPEN 1 STR1 0 Use DEBUG PRINT OPEN CSTR I 09 I OS MEMCARD FILE READ 1 STR2 10 10 DEBUGTERINT Serna ks SRNT one LL i End Sub e REWIND Sets cursor position back to the beginning of the file stream Variable OS MemCard File Rewind fileNum Parameter s fileNum File Number in which to set the cursor position back to the beginning of the file stream Returns 0 Read Successful All other numbers Error SEEK Sets cursor position to a specified index within the file stream Variable OS MemCard File Seek FileNum Index Parameter s FileNum Assign an available number to associate the file with Index Position within the file stream to set the cursor Returns Q File successfully opened All other numbers Error Code aa Dim I as Integer a 00 I OS MEMCARD INIT 08 I OS MEMCARD FILE OPEN 1 STR1 0 04 I OS MEMCARD FILE SEEK 1 5 Set Cursor Position to 5 05 DEBUG PRINT SEEK 5 CSTR 1 06 I OS MEMCARD FILE GETPOS 1 pare DEBUG PRINT GETPOS CSTR I I 5 BCORE USER MANUAL REV B JUNE 2010 RELEASE OSIIOHIU SUOIJDI AO LUD IIS SY ONN OS COMMAND REFERENCE WRITE Perform write operations to specified file stream Variable OS MemCard File Write fileNum StrVar BytesToWrite Parameter s fileNu
19. AIS CUBE THE BLAZINGCORE SERES WITH SUPERIOR NUMBER CRUNCHING ABILITIES AND PERIPHERAL HANDLING ON OUR CUSTOM EMBEDDED OS RAPID PROTOTYPING IS NOW EASY AND BLAZING FAST BCORE USER MANUAL REV B JUNE 2010 RELEASE BLAZINGCORE SERIES INTRODUCTION The BlazingCore BC Family Series is a 32 bit hardware and software series comprising of an entire range of boards built around the PIC32MX chip by Microchip all running on the BCore Operating System The BCore IDE provides the programming platform for writing programs in NET syntax language VB Net C NET with built in BCore OS commands to control devices and supports most standard protocols eg UART SPI I2C PWM ADC as well as built in libraries for Servo Motors Graphic LCDs and OLED Displays TECHNICAL OVERVIEW BLAZINGCORe BC Chip PIC32MX695F512L Operating System Operating Voltage I O Sink Source Current Range Pins O Speed 5 Million Lines of Code per second Physical I O Pins User Memory 110K External Memory Data Flash SD Timer s UART 2 PWM Pins R ADC Pins 16 ADC Resolution ME SPI 7 FEATURES Note External Memory Card Support for MMC SD Compatible up to 16Gb on OLED interfacing board High performance 32 bit RISC CPU allows user to add big files e Based on Microchip s PIC32MX Chip e MIPS32 Architecture Peripheral Features e BlazingCore OS Onboard Physical 1 0 Pins e External BCore Memory Support for Data e Hig
20. BUTTON2 ADDRESSABLE PORT REGISTERS The following ports are addressable with pins corresponding to the registers of the PIC32 Chip MSB BCORE USER MANUAL REV B JUNE 2010 RELEASE DEVICE COMMUNICA TION OVERVIEW BCore100 UART 2 SPI 2 DETAILED INFORMATION PIC32MX695F512L ACK RE9 UART1 RX U1RX RF2 TX U1TX RF8 ACK RF13 UART2 RX U2RX SDA2 RF4 TX U2TX SCL2 RF5 SCK SCK1 RF6 SPI1 SDI U1RX SDI1 RF2 SDO U1TX SDO1 RF3 SCK SCK2 RG6 SPI2 SDI SDI2 RG7 SDO SDO2 RG8 Note Items shaded indicates that these pins are reserved for specific hardware purposes 2As indicated above most of the communication pins are shared Users should take note that only one form of communication can be used at any one time BCORE USER MANUAL REV B JUNE 2010 RELEASE BLAZINGCORE IDE BCORE IDE The BCorelDE is a structured programming environment with support for global and local structures subroutines variables and APIs for advance users as well as file streams exposed for users to carry out data manipulation The BCore OS also boasts of built in libraries OS Commands that natively handle control over I O peripherals external displays e g OLED Displays Graphic LCDs communication protocols as well as external memory NET SYNTAX LANGUAGE The BCorelDE provides the programming platform for the BCore Boards using Microsoft s NET Syntax Language At this point of writing it currently supports the VB NET
21. DNEXT Returns next occurrence of a specified string in names of all the files in current directory Continuing from where the previous file was found IMPORTANT Use of os MEMCARD DIR FINDFIRST must precedent this command Variable OS MEMCARD DIR FINDNEXT STR2 Parameter s STR2 String Variable for Command to return File Name in which specified string to search for stated in the use of command OS MEMCARD DIR FINDFIRST was found Returns 0 File Found All other values No matches The code below is an example of how to retrieve the first 2 files with residing within the current directory of the external memory card Code Gal Public Sub Maint 2 a 03 Dim I as Integer 04 STRLI EA AS Hile cana meta Character US I OS MEMCARD DIR FINDFIRST STR1 STR2 06 DEBUG PRINT ERANI RS OES TRI SiR OTa I OS MEMCARD DIR FINDNEXT STR2 08 DEBUG PRIN KIND Na TRS ERA 09 E End Sub GET Get path of current directory Variable OS MemCard DIR CHANGE STRING PATH Parameter s PATH String variable that contains specified path within the external memory card to change directory to Returns 0 File Operation Successful All other values Error Code Public Sub Main E OZ Bay Seg sg 03 Dim I as Integer 04 STRLI Wee ve palo Carey maca Character 057 I OS MEMCARD DIR CHANGE STR1 06 DEBUG PRINT CHANGE DIR CSTR I I Success Error R I OS MEMCARD DIR GE
22. EG 18 64 32 16 8 4 06 DELAY 200 OTa CAM WRITEREG 17 6 SPEED DONT CHANGE 0x11 9 CAM WRITERSG 19 341 Common Control B0x15 09 DO HOR CAM GRABFRAME IE LOOP T2 END SUB POSITION Sets the position to display the frame from the camera module on the OLED CAM POS T T TON x y Parameter s X Integer x coordinate Y Integer y coordinate Code PUBLIC SUB MAIN 02 Init Camera Module ee CAM WRITEREG 18 128 Common Control A 0x12 04 DELAY 200 Us CAM WRITEREG 18 64 32 16 8 4 Die DELAY 200 omk CAM WRITEREG 17 6 SPEED DONT CHANGE 0x11 OS CAM WRITEREG 19 3241 Common Control B 0x13 Q9 CAM POSITION 40 5 Set position to display frame 10 DO JNE CAM GRABFRAME To POOR Tog END SUB READREG Returns contents of OV6630 register at a specified address Variable CAM READREG Register Address WRITEREG Write to Register CAM WRITEREG Register Address Value Code 01 Ml vim as INTEGER ie CAM WRITEREG 17 5 SPEED 03 I CAM READREG 17 04 DEBUG PRINT CSTR I BCORE USER MANUAL REV B JUNE 2010 RELEASE VISION SYSTEM CAMERA COMMANDS FULL LENGTH WORKING EXAMPLE The BlazingCore Vision System is meant to be used together with the OLED display to make use of its high speed GRAM memory thus eliminating the use of another external memory to store the frame 140k Data man
23. ES ABS Y Array Structure Point Points Rectangle Rectangles S ABS SES SBS BCORE USER MANUAL REV B JUNE 2010 RELEASE Salni OPG VB NET LANGUAGE REFERENCE STRUCTURES Public Private Structure Structure Name Public Dim lt variable gt As lt data_type gt End Structure A structure declaration starts with the Structure statement and ends with the End Structure statement The structure statement supplies the name of the structure which is also the identifier of the data type the structure is defining Other parts of the code can use this identifier to declare variables parameters and a function to return values of this structure s data type Structures are declared on its own not contained within any procedures The declarations between the Structure and End Structure statements define the members of the structure B E Code as coDE1 Structures can be declared globally and accessed across different modules The following Me code illustrates this A public structure is declared in Module CODE2 Code 01 MN coozz 7 02 Public Structure EI TT 03 Public Name As String 04 Public Gender As Boolean 0 Male 1 Female 05 Public Age As Integer 06 Bnd Seruceure Or This structure is then declared and accessed through the main program in Module CODE1 Code 01 MW coz DZ Publie USER As CODES alos en DZ 04A Public sub Mas DS USER Name Smith 05 USER G
24. ETIC OPERATORS Arithmetic operators are used to perform mathematical computations They have numerical operands and return numerical results The arithmetic operators are addition subtraction multiplication division integer division modulus Mod negation and exponentiation Order of precedence for arithmetic operators follow the rules of precedence from basic math which is left to right Operator Operation A Exponentiation J Negation E Multiplication and division Integer Division Mod Modulus a Addition and subtraction Table above lists operators and operations from highest precedence to the lowest RELATIONAL OPERATORS Use relational operators to test equality or inequality of expressions All relational operators return TRUE or FALSE Operator Operation equal lt gt not equal gt greater than lt less than gt greater than or equal lt less than or equal All relational operators associate from left to right BITWISE OPERATORS Use the bitwise operators to modify the individual bits of numerical operands Operator Operation ant bitwise AND compares pairs of bits and generates a 1 result if both bits are 1 otherwise it returns O Pa bitwise inclusive OR compares pairs of bits and generates a 1 result if either or both bits are 1 otherwise it returns O G bitwise exclusive OR XOR compares pairs of bits and generates a 1 result if the bits are comp
25. GCORE OLED COMMAND REFERENCE BCORE USER MANUAL REV B JUNE 2010 RELEASE C310 OLED COMMAND REFERENCE The following pages list the members in the library available to interface with the OLED Display Ready methods like printing text to screen drawing primitives or even placing bitmaps to the screen are available for immediate usage Examples of use are also included s OLED Part of the BCorelDE library consists of optimized methods to control the OLED natively to ensure efficiency and speed of data transfer to the OLED Driver Cuas Draw HOME Fore GRAM Init IADE Orie Brim Read Sere T OU O viji elijo YEL w x lio Writ Background Clear OL Type ground ntation E Register olour h eRegister Description Provides Access to reading values from the onboard accelerometer Set Background colour Clears the screen Get or Set the Cursor Position Graphic library for drawing Primitives and Bitmaps to Screen refer to subtopic for details Set the Font Size Set Foreground colour Provides Read Only Access to the Graphics RAM Does the necessary one time initialization of the OLED with a specified colour Provides access to reading values from the onboard Light Dependent Resistor LDR Set the orientation of the screen to portrait or landscape Print text to OLED Provides read abilities to the OLED driver S6E63D6 registers Set foreground and background colours Provides access to
26. T STR2 08 DEBUG PRINT CSMR 1 DIR STR A MA End Sub BCORE USER MANUAL REV B JUNE 2010 RELEASE OS COMMAND REFERENCE suololedo WDSS l4 27114 1 ONN Fl LE The BCore OS uses streams to support reading from and writing to files located in the external memory card MMC Methods Description Close Closes a currently opened file stream GetPos Returns current position of data being read within an open file IsEOf Checks if end of file stream has been reached Open Open a specified file Read Start reading a specified number of bytes of data from the file stream Rewind Sets cursor position back to the beginning of the file stream Seek Sets cursor position to a specified index within the file stream Write Perform write operations to specified file stream FI LE STREAMS When the BCore OS accesses the files located in the external memory card MMC it performs file operations through the use of streams A file stream is essentially a single dimensional set of contiguous data obtained from the file A file stream has a start and an end and a cursor that represents the current position of data being read from the file A visual representation of a file stream can be seen in the image below ae E cala Start of File Stream lt gt E Z7 j End of File Stream A we e CLOSE Closes a currently opened file stream Variable OS MemCard File Close fi leNum Parameter s fileNum File Numb
27. Then statements Elself lt condition gt Then statements Else statements End If or If condition Then statements Select Case Statement Runs one of several groups of statements depending on the value of an expression Select Case lt test expression gt Case lt expression gt statements Case lt expression gt statements Case Else statements End Select BCORE USER MANUAL REV B JUNE 2010 RELEASE VB NET LANGUAGE REFERENCE ITERATION STATEMENTS LOOPS For Statement Repeats a group of statements a specified number of times For counter start To end Step value statements Exit For statements Next Code Dim i As Integer SJUSLUSJOJS UONODIA For i s 0 Ta 3 Deus IR Next 03 04 Output Onley 02 R 04 Do Statement Repeats a block of statements while a Boolean condition is True or until the condition becomes True Do While lt condition gt statements Exit Do statements statements Exit Do 7 statements Loop 1 Until lt condition gt Code Dim i As Integer L 0 03 04 Do 05 Debug Print Cstr i 0G L o L ee Loop Until Output que OQ DS 04 BCORE USER MANUAL REV B JUNE 2010 RELEASE SIOLOJOdO VB NET LANGUAGE REFERENCE OPERATORS Operators describe and perform an operation between two or more values ARITHM
28. ata Receive buffer TX Transmit specified byte data HASDATA Returns state of Data Receive buffer Variable Comml HasData Variable Comm2 HasData Returns Logical True if data is present in the data receive buffer Logical False if the buffer is empty BCORE USER MANUAL REV B JUNE 2010 RELEASE OS COMMAND REFERENCE RX Returns byte data stored in Data Receive buffer Data is retrieved one byte at a time Variable Comml RX Variable Comm2 RX TX Transmit specified byte data Transmission is done one byte at a time Comml TX byte Data Comm2 TX byte Data WORKING EXAMPLE The following code is a working example of the use of the above commands to perform checking receiving and transmission of data between the 2 COMM Ports Data that is received on either port is echoed to the other port Tests may be conducted with the help of a HyperTerminal or equivalent software UOHDIIUNLULIOO OUSs avn Code OL 02 0 04 05 OG OT 08 O02 LO le 123 Ior 14 SA SIMPLE ECHO PROGRAM BETWEEN THE TWO COMM PORTS Publie Sub Main Dim RX as integer Do If OS Comml HasData Then rx OS Comml RX OS Comm2 TX rx BNC LE If OS Comm2 HasData Then rx OS Comm2 RX OS Comm1 TX rx Entel ILE Loop End Sub BCORE USER MANUAL REV B JUNE 2010 RELEASE OS COMMAND REFERENCE LEDI LED2 g Provides methods to toggle the onboard LED
29. contain methods that allow the BCore Operating System to natively handle peripheral memory and communication protocols of components onboard the BCore Microcontroller SOUDWWILUOZ SO Board Members Description Comm1 Handles methods for serial communication on Comm1 Comm2 Handles methods for serial communication on Comm2 LED1 Provides methods to toggle the onboard LED1 on or off LED2 Provides methods to toggle the onboard LED2 on or off MemCard Provides access to methods for handling an external memory card MMC and file operations Memory Provides access to methods for handling data arrays stored in memory PB1 Returns logical state of Push Button 1 onboard the BCore Board PB2 Returns logical state of Push Button 2 onboard the BCore Board Reset Commands the BlazingCore OS to perform a soft reset on itself Run Commands the BlazingCore OS to run Timer Provides access to system timer methods UART Serial communication on the BCore is available through the use of UART The BCore board has 2 UARTs supported by the BCoreOS under the name of Comm1 and Comm2 UART settings on the BCore are Full duplex 8bit transmission No parity One Stop Bit Baud Rate 115200bps Different baud rates will be supported in subsequent firmware upgrades 4 word deep FIFO Data Receive Buffer COMMI COMM2 Handles methods for serial communication on Comm1 Methods Description HasData Returns state of Data Receive buffer RX Returns byte data stored in D
30. e camera module The Camera Module must be initialised before any frame grabbing can be done Using the camera library built onboard the BCore OS users are given access to the OV6630 Chip Registers for settings to be made In the code examples that follow 3 registers are accessed in OV6630 to configure settings for the initialising stage Clock Rate Control Common Control A and Common Control B TABLE DESCRIPTION OF OV6630 I C REGISTER SET _ For more information please refer to OV6630 Datasheet URL Sub Address Default Read HEX Register _ HEX _ Write Description 11 CLKRC 00 RW Clock Rate Control CLKRC 7 6 Sync output polarity selection 00 HSYNC Neg CHSYNC Neg VSYNC Pos 01 HSYNC Neg CHSYNC Neg VSYNC Neg 10 HSYNC Pos CHSYNC Neg VSYNC Pos 11 HSYNC Pos CHSYNC Pos VSYNC Pos CLKRC 5 0 Clock pre scaler CLK MAIN CLOCK CLKRC 5 0 1 x 2 n Where n 1 if register 3E COMO lt 7 gt is set to 1 and n 2 otherwise 12 COMA 24 RW Common Control A COMA 7 SRST 1 initiates soft reset All registers are set to default values and chip is reset to known state and resumes normal operation This bit is automatically cleared after reset COMA 6 MIRR 1 selects mirror image COMA 5 AGCEN 1 enables AGC COMA 4 Digital output format 1 selects 8 bit Y U Y VY Y U Y VY COMA 3 Select video data output 1 select RGB
31. e end of the file stream Logical False if cursor is not at the end of the file stream OPEN Open a specified file located in the external memory card MMC Variable OS MemCard File Open FileNum FileName R W Parameter s FileNum Assign an available number to associate the file with FileName String variable containing name of file to open R W a 0 to open a file for read operations a 1 toopen the file for write operations a 2 to open the file for read and write operations Returns 0 File successfully opened All other numbers Error Code NN Dim Stri Stra as String Za Dim I as Integer 05 I OS MEMCARD INIT 04 DEBUG PRINT INIT CSTR I I Success Error 05 STR FILE_01 TXT OS ASS TOM mumser d Co FILZ 01 Tx and open as read only ore I OS MEMCARD FILE OPEN 1 STR2 0 08 d DEBUG PRINT FILE OPEN STATUS CSTR I I Success Error BCORE USER MANUAL REV B JUNE 2010 RELEASE OS COMMAND REFERENCE READ Start reading a specified number of bytes of data from the file stream Variable OS MemCard File GetPos fileNum StrVar BytesToRead Parameter s fileNum File Number in which to get the cursor position StrVar String variable to read the bytes into BytesToRead Specified number of bytes to read into StrVar Returns 0 Read Successful All other numbers Error SUOHOIOAC WDSS 31141 ONN Code QUE Public Sub Main Q
32. e to 1 Low Set a specified pin s logical state to O Port Address all pins in specified port PortA Address all pins in PortA 5bit PortB Address all pins in PortB 16bit PortD Address all pins in PortD 16bit PortE Address all pins in PortE 8bit Note Using commands Get ADC and Get Pin on its own is also allowed Refer to I O Commands under BCore OS Command Reference GETADC Returns converted digital values of an analog device attached to an ADC pin ADC Pins 17 to 32 Integer variable IO GetADC pin Code Oils Dim I As Integer o UZ 03 Public Sub Main 04 Do 05 I IO GetADC 17 06 Debug Br sie i Gy Delay 200 08 Loop DOS End Sub GETPIN Returns logical state High Low of specified pin Integer variable 10 GetPin pin The following example code polls pin 61 Button1 on the BCore Board at a rate of 5 times a second to detect if the push button has been pressed Code C oi Ml Dim As Integer DZ OS Public Sub Main 04 Do Use I 10 GetPin 61 06 B sia Pr ser T OTa Delay 200 US POOP 092 End Sub BCORE USER MANUAL REV B JUNE 2010 RELEASE SHOd O I I O COMMAND REFERENCE HIGH Set a specified pin s logical state to 1 IO High pin LOW Set a specified pin s logical state to O IO Low pin The following code is an example program that illustrates the use
33. ender O e USER Age 28 08 End Sub 09 Notice that a variable declaration of a structure must be done before a structure can be used In this case the variable USER is declared of data type structure structUser BCORE USER MANUAL REV B JUNE 2010 RELEASE BLAZINGCORE COMMAND SET BCORE USER MANUAL REV B JUNE 2010 RELEASE BLAZINGCORE COMMAND SET DEBUG STATEMENT The Debug statement serves as a debugger on an embedded system Values that are debugged using the debug statement are automatically formatted to ASCII and sent through the download port UART2 Comm1 and displayed in the IDE s Debug Window Debug Frint string String Variable String Const The Debug Statement returns Strings back to the PC Therefore all expressions must be in String or converted to a String CSTR Convert To String before or during the instruction More information on the String data type is available under the String Category Code 01 Ml vim s As String o DZ Dim 1 As Integer 03 04 Public Sub Main 05 S This Is A Test 06 I 5 Od Debug Print Hello World 08 Debug Print 09 Debug Print Cstr I 10 Ena Sub E Output NR DIE ME 04 As illustrated above all Debug Statements automatically end with a carriage return new line ay To display String continuously on the same line we make use of the semicolon
34. er gt As lt Data_Type gt All variables must be declared before they re used Implicit declarations are not allowed For variables declared in module level code Public Private Dim lt variable gt As lt Data_Type gt Public variables are global and visible throughout the entire program Private variables are visible only in the module in which they appear The default is private that is if Dim is used for a module level variable the variable is private For variables declared inside a subprogram Dim lt variable gt As lt Data_Type gt Variables declared inside a subprogram are visible only inside the subprogram Code 01 Public Distance As Integer Module level variable global 04 Private Temperature As Single Module level variable local to module 06E Sub Main pe Dim PinNumber As Byte Variable is local to this subprogram DS End Sub WSs Sub ReadPin Ore Dim PinNumber As Byte Variable is local to this subprogram Ose ao Sulo VARIABLE IDENTIFIERS Identifiers must start with a letter and all other characters must be letters digits or underscores An identifier can be up to 255 characters long and all characters are significant Identifiers are not case sensitive E g Identifiers xyz XYZ and xYz are equivalent Reserved words like keywords are not allowed to be used as an identifier DATA TYPES BCore currently supports these data types Data Type Memory Size Content Boolean 8bits True False
35. er to close Returns 0 File Operation Successful All other values Error The following code is an example of how to initialise the external memory card open a file and assign a number to it and closing the file using the previously assigned number Code QUE Public Sub Main Q2 Dim bo RIS Dim I as Integer 04 I OS MEMCARD INIT ae DEBUG PRINT INIT CSTR 1 06 S Pie TXIA ore I OS MEMCARD FILE OPEN 1 STR2 0 Use DEBUG PRINT OPEN CSTR 1 US I OS MEMCARD FILE CLOSE 1 LOs DEBUG PRINT CLOSE CSTR I VALE VA Ene Sub BCORE USER MANUAL REV B JUNE 2010 RELEASE OS COMMAND REFERENCE GETPOS Returns current position of cursor in a specified file stream Variable OS MemCard File GetPos fileNum Parameter s fileNum File Number in which to get the cursor position Returns Cursor Position suo oJadoO WIDSUS 31141 OWN Code UL l Public Sub Main o UZ DNS SIS SE EE GZ Oise Dim I as Integer 04 I OS MEMCARD INIT US DEBUG PRINT INIT CSTR 1 06 STRZ Vmr OI moc OTa I OS MEMCARD FILE OPEN 1 STR2 0 US DEBUG PRINT OPEN CSTR 1 09 I OS MEMCARD FILE GETPOS 1 O DEBUG PRINT GETPOS CSTR I e EZ End Sub ISEOF Checks if cursor has reached the end of the specified file stream Variable OS MemCard File IsEOf fileNum Parameter s fileNum File Number in which to check the cursor position Returns Logical True if cursor is at th
36. ground Colour BCK COLOUR Fuschia 06 o OLED Prine Hello World OT End Sub BCORE USER MANUAL REV B JUNE 2010 RELEASE OLED COMMAND REFERENCE IOT 0310 SOU AVID GRAM 4 The pixels displayed on the OLED screen correspond to the image data stored in the Graphics RAM GRAM Read access to the OLED GRAM is provided to the user Read the colour data direct from GRAM by providing the position to read Read command returns the colour in 16bit 565 RGB Integer format Member Submember Description Read Point Returns the colour value from a single point in the GRAM Rectangle Returns the colour values from a specified rectangular area in the GRAM into a specified user declared integer array OLED GRAM Read Point point OLED GRAM Read Rectangle memoryArr point1 point2 Parameter s memoryArr o User declared single or 2 dimensional integer array to store the colour values read from the GRAM u Users are expected to ensure that the memory allocation of the Integer Array is sufficient to store the total number of points being read to it a Data from specified area will be stored in a continuous stream inside the integer array Any row alignments applicable only to 2 dimensional arrays will be automatically done pointi o Starting point of Rectangle point2 o Ending point of Rectangle INIT Does the necessary one time initialising required for the OLED to be controlled thereafter Parameter accepts colour for
37. h Current Sink Source 18mA 18maA on all Flash MMC SD Compatible I O pins e 5 Million Lines of Instructions per Second ie UART Modules e 80MHz Clock Speed e Five PWM Outputs e High Speed I O Pins Capable of Toggling at up to 10MHz Microcontroller features BCore100 e 3 3V Low Power Consumption e 110K Onboard SRAM Memory e Upto 16MB External Data Flash Memory e 5V Tolerant Input Pins Digital Only Analog Features e 16 Channel 10 bit Resolution Analog to Digital Convertor o 1Msps conversion rate BCORE USER MANUAL REV B JUNE 2010 RELEASE OO EI o ololo AS EL leie OJ c 0 A D amp oloon cs SE ES B al olo 3 H E we 0000000000000 0 500000000 elo U sE o NO 0000000000000 0 400000000 o Rd T gt O ojo Y la E QO 3 o o o Ora Jo E 3 O oo AA aa S K S C aL K NS 89 esn olo D ala E 00134099 A 5 aa LE OJO O JO a JO OTT CCU CU co ojo Q F lalo O x N OC Y sag e e 9 K O sooe e 666666 1 T Se 00000001000000010000000000 SSU lt S 2 g OOOE elo 000000010000000140000000000 olo S AG O AJO ojolejym El s fe OOO mn SE z SLI olol va a 36 0 AOC oJoJo Tien A a CA 5 S J 5 VO ooo gt oo Ao gala G G SE s Y BLAZINGCORE FAMILY BCORE USER MANUAL REV B JUNE 2010 RELEASE e Lut or O O O N lt am PINOUT JNS AEE 0058 1 VER 49 OS HEN Pa WS Nov
38. have been defined you may call them once or multiple times A procedure is called upon to perform a certain task while a function is called to compute and return a certain value SUB PROCEDURES Private Public Sub procedure_name arguments statements End Sub You may exit a procedure at any point in the routine by using an Exit Sub statement Code QUE Private Sub GetAnswer ByRef b As Boolean DZ Oe If b TRUE Then 04 Exit Suo DS Else 06 do something Oe End If US 09 End Sub FUNCTIONS Private Public Function function_name arguments As lt Data_Type gt statements Return Variable Value End Function The function returns a value This is achieved by using the Return command followed by the value to return within the Function You may also exit a function by using an Exit Function statement Code OKR Public Function F ByVal i As Integer As Integer DES tE i 3 Then 03 Return 92 Oa Exit unieron 057 End If 06 aa eL QT End Function BCORE USER MANUAL REV B JUNE 2010 RELEASE VB NET LANGUAGE REFERENCE PASSING PARAMETERS TO ROUTINES SUBPROGRAMS Parameters can be passed to a subprogram by reference ByRef or by value ByVal Passing by reference if you pass a parameter by reference any changes to the parameter will propagate back to the caller Pass by reference is the default Passing by value if you pass a parameter by value no cha
39. ipulation is done by reading the pixel data of a specific location from the GRAM into a variable stored in program memory Of course the OLED has to be initialised as well DISUWDI A full length code demonstrating frame captures from the camera and displaying them on the OLED is shown below Frame grabbing and displaying to screen is currently done at 10 to 12 frames a second Code ene PUBLIC SUB MAIN 02 Cie OLED ee OLED_INIT que US Init Camera Module 06 CAM WRITEREG 18 128 Common Control A 0x12 07 DELAY 200 08 CAM WRITEREG 18 64 32 16 8 4 09 DELAY 200 Le CAM WRITEREG 17 6 SPEED DONT CHANGE 0x11 e CAM WRITEREG 19 32 1 Common Control B 0x13 i DO os CAM GRABFRAME EE LOOP 15 16 END SUB E 18 19 PUBLIC SUB OLED_INIT 20 OLED INIT 0 Da OLED SETCOLOUR FOREGROUND 31 2 END SUB Dee S For full hardware amp software information please refer to the BlazingCore Vision System documentation BCORE USER MANUAL REV B JUNE 2010 RELEASE APPENDICES BCORE USER MANUAL REV B JUNE 2010 RELEASE say doug OULI JSUDI APPENDIX A TRANSFERRING BITMAP FILES FROM PC TO BCORE Store the Bitmap Files in your BCore Project s Resource Folder and import it using the Resource Page in BCorelDE Files may be imported and downloaded into an external memory chip DataFlash o
40. lementary otherwise it returns O not bitwise complement unary inverts each bit E bitwise shift left moves the bits to the left it discards the far left bit and assigns O to the right most bit bitwise shift right moves the bits to the right discards the far right bit and if unsigned assigns O to the left most bit otherwise sign extends BCORE USER MANUAL REV B JUNE 2010 RELEASE VB NET LANGUAGE REFERENCE O BOOLEAN OPERATORS O D Operator Operation O AND logical AND O OR logical OR CA XOR logical exclusive OR XOR NOT logical negation Boolean operators associate from left to right The negation operator not associates from right to left OVERALL OPERATOR PRECEDENCE Highest 1 Not 2 N Mod And 3 Or Xor amp Lowest 4 gt lt gt es gt BCORE USER MANUAL REV B JUNE 2010 RELEASE VB NET LANGUAGE REFERENCE SOINDSOOl_ UIDIN ANS SUB MAIN All projects must have a procedure Main in the project This is the starting point of the project Note Only ONE Sub Main is allowed in a single project Code Gi Public Sub Main oe 03 Ena Bue PROCEDURES Procedures and functions referred to collectively as routines are self contained statement blocks that can be called from different locations in a program A function is a routine that returns a value when it is executed A procedure is a routine that does not return a value Once these routines
41. m File Number in which to get the cursor position StrVar String variable containing characters to write to the file BytesToWrite Number of bytes from StrVar to write to the file Returns 0 Write Successful All other numbers Error Code il Public Sub Main Q2 DS bio DS Dim I as Integer 04 I OS MEMCARD INIT 050 DEBUG PRINT INIT CSTR 1 MOS ST OTe I OS MEMCARD FILE OPEN 1 STR1 2 Open as read amp write 08 DEBUG PRINT OPEN CSTR I I Success Error US STR2 12345 LO VIS OS ME MGAR ETE MELIA SN O OE JA DEBUG PRINT WRITE CSTR I I Success Error eee End Sub INIT Handles the necessary one time initialisation of the memory card before it can be used Variable OS MemCard Init Returns 0 External Memory Card Successfully Initialised All other numbers Error Code oas Public Sub Main OZ I OS MEMCARD INIT 03 DEBUG PRINT INIT CSTR I I Success Error 04 End Sub 0 BCORE USER MANUAL REV B JUNE 2010 RELEASE OS COMMAND REFERENCE MEMORY Provides access to methods for handling data arrays stored in memory NOUN Methods Description Copy Copies elements from one array to another CopyExe Copies a specified range of elements from one array to another Ga Min Returns index of first occurrence of the smallest number in a specified range of elements Max Returns index of
42. mCard DIR CHANGE STRING PATH Parameter s Path of desired directory in String Returns 0 Operation Successful All other values Error Code one Public Sub Main EE Dim Ser EE EZ 03 Dim I as Integer 04 057 STR SDIR_2 FOLDER WITHIN MMC CALLED SDIR_2 06 I OS MEMCARD DIR CHANGE STR GO INTO FOLDER OT o DEBUG PRINT CHANGE DIRECTORY STATUS CSTR I US 09 End Sub FINDFIRST Returns first occurrence of a specified string in names of all the files in current directory Variable OS MemCard DIR FINDFIRST STR1 STR2 Parameter s STR1 Specified string to search for STR2 String Variable for Command to return File Name in which STR1 was found Returns 0 File Found All other values No matches META CHARACTERS The code below is an example of how to retrieve the first found file with the specified string out of all the files available within the current directory of the external memory card Use of is a meta character representing any single character or group of characters By using the stands in for any file name as well as for any file extension Code Bork Public Sub Main UZ Bali overs SS Sao 03 Dim I as Integer onp STRIL We wW 7 ple ward mete Character US I OS MEMCARD DIR FINDFIRST STR1 STR2 06 DEBUG PRINT ERAND RS Cork T O R eee End Sub BCORE USER MANUAL REV B JUNE 2010 RELEASE OS COMMAND REFERENCE Nooaid ONN FIN
43. n Background Set Background Colour Foreground Set Foreground Colour OLED SetColour Background lt colour gt OLED SetColour Foreground lt colour gt lt Colour gt Refer to BCore Constants BCK for list of preset colours BCORE USER MANUAL REV B JUNE 2010 RELEASE usss yano OLED COMMAND REFERENCE TOUCH 7 Provides access to touch screen methods Member Description X Returns optimized X coordinate of touch ve Returns optimized Y coordinate of touch G X Returns Raw Value of X Y Returns Raw Value of Y X Returns calculated X coordinate of a touch on the touch screen OLED Touen Xx Y A Returns calculated Y coordinate of a touch on the touch screen OLED Tot Yi Code Ol Public X Y as Integer 02 Public Sub Main O35 04 95 Do 06 X OLED TOUGH X To Y OLED Touch Y DS PERU Era sr ia US Delay 200 LO Loop ioe End Sub X RAW Y Returns raw X coordinate of a touch on the touch screen OLED Touch X Raw Y RAW Y Returns raw Y coordinate of a touch on the touch screen OLED Touch Y Raw 100 120 950 120 240 320 100 910 950 910 Optimized Values Raw Values BCORE USER MANUAL REV B JUNE 2010 RELEASE BLAZINGCORE CONSTANTS BCORE USER MANUAL REV B JUNE 2010 RELEASE BLAZINGCORE CONSTANTS BCore constants are constants that hold values meant to be used in conjunction with certain method and property types within the BCore command set Cur
44. nges are allowed to propagate back to the caller With a few exceptions if an argument is passed by value a copy is made of the argument and the called subprogram operates on the copy Changes made to the copy have no effect on the caller One exception is for string parameters passed by value For efficiency reasons a copy of the string is not made Instead the string is write protected in the called subprogram which means you can neither assign to it nor pass it by reference to another subprogram You are allowed to pass it by value to another subprogram however The other exception is for types Unsigned Integer and Unsigned Long which are treated similarly these parameters are write protected in called subprograms Actual vs formal parameters the type and number of the actual parameters must match that of the formal parameters the formal parameters appear in the subprogram declaration If there is a type mismatch the compiler will declare an error It will not do implicit type conversions Restrictions on passing mechanisms e Scalar variables and array elements can be passed by value or by reference e Since arrays are global they cannot be passed into a function or subroutine e Numeric expressions and numeric literals can be passed by value but not by reference The same applies to Boolean expressions and Boolean literals ByRef By Reference ByVal By Value Boolean Byte Integer S gt Long Single String S S
45. nsion is 3 Supports e Global and local declaration e Passing by reference to routines subprograms Code Dim ArrayName array_length As Integer 1 dimension Dim ArrayName array_length_1 array_length_2 As Integer 2 dimensions Dim ArrayName array_length_i array_length_2 array_length_3 As Integer 3 dimensions NOTE While the maximum dimension for declaring an array is 3 please take note that the maximum length allowed for the 2 and 3 dimension e g array length 2 array length 3 is 255 There is no limit for the 1 dimension of the array but onboard SRAM memory pertaining to the respective chip you are using should be taken to mind The array length should not exceed the SRAM Memory available BCORE USER MANUAL REV B JUNE 2010 RELEASE SOULS VB NET LANGUAGE REFERENCE STRINGS A string represents a sequence of characters and is known to be a specialised array of characters Strings are always declared to be 64 characters long which is the maximum number of characters it can hold Public Private Dim lt variable gt As String STRING METHODS The following table lists the methods that are available with the use of a string and its description Method Description Add Add Plus operator enables strings to be concatenated Compare Compares two strings Returns True if strings match False if it does not Cima Converts Cstr Convert non string data type variables to string S Hea
46. of the commands High and Low to toggle pin 60 LED1 onboard the BCore Board resulting in a blinking LED program Please note both codes listed below are equivalent Code Code 01 Public Sub Main 01 Public Sub Main DZ UZ 03 Do 03 Do 04 I0 High 60 04 OS LED1 High UE Delay 100 US Delay 100 US TO low 60 06 OS o LADI lows Ot Delay 100 De Delay 100 DS Loop US Loop US End Sub US End Sub PORT Address all pins in specified port Please refer to the I O Pinout Description table for list of pins and their respective ports IO Port port No Set 10 Port port No value Get value IO Port port No ADDRESSABLE PORT REGISTERS The following ports are addressable with pins corresponding to the respective port registers of the PIC32 Chip Please refer to the I O Pinout Description table for list of pins and their ports with respect to the port registers PORTA TO PortA PORTA 5bit Bcore Pins RA2 RA3 RA4 PORTB 10 POrueb PORTB 16bit AAA RB4 RBS RB6 RB7 RB8 RB9 RB10 RB11 RB12 RB13 RB14 BcorePins 32 30 29 20 18 17 PORTD TO PortD PORTD 16bit IMD ID DA IDE 38 RD4 RDS RD6 RD7 RD8 RDI RD10 RD11 RD12 RD14 RD15 35 34 41 43 PORTE PORTE 8bit PE BcorePins 9 10 11 12 13 14 15 16 TO PortkE BCORE USER MANUAL REV B JUNE 2010 RELEASE BLAZIN
47. ord Returns the High Word Portion of a 32bit Integer Value LoWord Returns the Low Word Portion of a 32bit Integer Value 32bit Integer Bit 31 Bit O 8bit 8bit 8bit 8bit HIWORD LOWORD 16bit 16bit I O COMMANDS lt Command gt pin no Command Description High Set a specified pin s logical state to 1 Low Set a specified pin s logical state to 0 GetPin Returns logical state of specified pin GetADC Returns converted digital values of an analog device attached to an ADC pin SYSTEM DELAY DELAY Equivalent to DelayMs where time is delayed in milliseconds Delay time DELAYUS Time is delayed in microseconds DelayUS time BCORE USER MANUAL REV B JUNE 2010 RELEASE BLAZINGCORE COMMAND SET RANDOM GENERATOR Generate Random Integer Values RNDSEED Initialise the random generator with a seed before using it to generate values OS RndSeed Seed RND Generate random integer values with a specified range OS Rnd Range JO 0 9U95 WOPULY Code 01 MM Public Sub Main DZ Dim 1 As Integer 03 OS RndSeed 10 04 11 S 05 Rna 5 05 Do OG Debug Primm Os ea D Delay 200 US Loop 09 End Sub Output Output values ranging from 0 4 will be randomly generated BCORE USER MANUAL REV B JUNE 2010 RELEASE BLAZINGCORE OS COMMAND SET BCORE USER MANUAL REV B JUNE 2010 RELEASE OS COMMAND REFERENCE OS The following members listed under OS
48. r external memory card MMC Example code to draw bitmap files to the OLED from both external memory methods are available under its respective instruction set External DataFlash 1 To store Bitmap files in the External DataFlash make sure the Bitmap files you want loaded into the DataFlash is stored in Your Project Folder gt Resource gt EEPROM _ Type Bitmap Image o Date modified 8 14 2009 12 08 PM BLUEL6 bmp BlueB32 bmp P TIP Dimensions 42 x6 Size 570 bytes Example view using windows explorer Note You may have to create these folders yourself if they do not exist 2 Next Select the data file DATA1 under the DataFlash Resources of your project and declare an array of type data 0 13 Resources EM DataFlash DATA myData arraySize FromFile FileName Code One DATA OD DATA B_PLAYER 570 FROMFILE P_PLAYER bmp 03 DATA BLUEB16 455 FROMFILE Bluel6 bmp The array size should correspond to the size of your bitmap file in bytes You can find out the size by placing your mouse over the particular bmp Refer to example as shown in figure above 3 Compile and download the data file DATA1 into the External DataFlash 4 BMP files are now programmatically accessible through the use of the variable name in this
49. rently it holds values for use mainly with the OLED library Method Description Colour Contains list of colours that represent valid 16bit 5 6 5 RGB values Font Contains values to set font sizing COLOUR COLOR Contains list of colours that represent valid 16bit 5 6 5 RGB values Member Aqua Black Blue Fuschia Grey Green Lime Maroon Navy Olive Purple Red Silver Teal White Yellow BCK Colour lt colour gt BCK Color lt color gt Note Where BCK represents BlazingCore Constants Each member of Colour contains a constant value representing a 16bit 565 mode RGB colour Naming conventions Colour and Color Grey and Gray are both supported FONT Contains values to set font sizing Available font sizes are 8x8 10x12 16x16 pixels na Size Description Small 8x8 Medium Osc Large 16x16 BCK Font lt size gt BCORE USER MANUAL REV B JUNE 2010 RELEASE BLAZINGCORE VISION SYSTEM CAMERA COMMANDS BCORE USER MANUAL REV B JUNE 2010 RELEASE VISION SYSTEM CAMERA COMMANDS CAM Provides access to the CMOS c3038 camera module DISUWDI Member Description GrabFrame Captures a single digital frame from the camera module and stores it into the GRAM of the OLED Position Position to display the captured frame on the OLED ReadReg Provides read access to the registers of the camera module WriteReg Provides write access to the registers of th
50. rescaler Set Set Timer Value Start Start the Timer Stop Stop the Timer INIT Initialise OS Timer with a specified prescale value index OS TIMER INIT prescale index Prescale Factor 1 default Prescale Index Ln BP UU N e gt READ Returns time elapsed in terms of clock cycles dependent on prescaler Variable OS TIMER Read SET Set Timer Value to start from OS TIMER Set value START Start the Timer OS TIMER Start STOP Stop the Timer OS TIMER Stop BCORE USER MANUAL REV B JUNE 2010 RELEASE 0S COMMAND REFERENCE TIMER WORKING EXAMPLE 3 The following is an example code on using the system timer with a prescaler set to a factor of 2 D Code UL Dim TIME as Long Oe Public Sub Main 03 OS TIMER INIT 2 04 OS TIMER Set 0 05 OS TIMER Start 06 TIME OS TIMER Read 07 OS TIMER Stop DS 09 Debug Print CYCLES ELAPSED Cstr TIME 10 il End Sub T BCORE USER MANUAL REV B JUNE 2010 RELEASE BLAZINGCORE I O COMMAND SET BCORE USER MANUAL REV B JUNE 2010 RELEASE SOUDWWIWWOD O I O COMMAND REFERENCE 1 0 The following table lists the commands available for addressing I O ports as well as methods for getting information from a particular I O pin Operator Description GetADC Returns converted digital values of an analog device attached to an ADC pin Gere Returns logical state of specified pin High Set a specified pin s logical stat
51. s given the correct information Please note The commands to draw bitmaps to screen returns a value and must be assigned to a variable This value will indicate if there has been any error during file fetching and or drawing to the screen Value 0 Successful Value 1 Error Note Bitmaps must be in Windows Bitmap bmp format Bitmaps of bit depth 16bit 565 Mode 24bpp 32bpp are supported 3For applications that require the OLED to update images really quickly we recommend that the bitmaps are first converted to the 16bit 565 RGB Format before importing it into the storage media for the BCore to access since 24bpp and 32bpp files are converted by the chip to the 16bit 565 format before sending to the OLED Display thereby imposing a limitation to the update rate from the BCore to the OLED Display BITMAPFROMDFLASH Draws a bitmap on the OLED screen from a bmp file stored in the external DataFlash chip Code Onl Dim Pl As Point OZ Public Sub Main Ose Dim 11 As Integer oag DEBUG PRINT OLED BITMAP 057 DELAY 200 06 OLED INTE G Ori OLED SETCOLOUR FOREGROUND 31 08 AAA SSOP DATA BATA VER 09 P1 X 50 ROS Pale X 20 MAS OLED DRAW BitmapFromDFlash P1 I1 D End Sub Note Please refer to APPENDIX A for more details on transferring Bitmap Files from the PC to the BCore s External DataFlash BITMAPFROMMEMCARD 7 Draws a bitmap on the OLED screen from a bmp file stored in the External Memory Card
52. string Cstr variable Code Op Dim K As Long UZ ran SE K IO Portb 04 Debug Print CstrHex K 05 End Sub LEN Returns the number of characters within a specified string sni String Code Public Sub Main Dim Sint AS Ser ing Str 0123456789 Dim length As Integer Length String Len str Debug Print Length or Str estr length End Sub BCORE USER MANUAL REV B JUNE 2010 RELEASE VB NET LANGUAGE REFERENCE C3 MID z Returns a string containing a specified range of characters from a string O Note Unspecified length will return characters from Index to end of string WN MID String Start Index Length Code 01 MM public sub Main O22 Dim MIDtest As String OSs Dim a As String 04 Dim b As String 05 Dim c As String 06 OTa MIDtest First Middle Last 08 a Mrd Mibtesce dy S 09 b Mid MIDtest 7 6 LO MLC MIDESSE V Heal 12 Debug Prine tara 13 Debug Print b b IP Debug Print o pe Sz LS Ened sub Output Gels OZ 06E BCORE USER MANUAL REV B JUNE 2010 RELEASE VB NET LANGUAGE REFERENCE STATEMENTS Operators describe and perform an operation between two or more values Statement format A statement begins at the beginning of a line of text and terminates at the end of a line of text IF Statement Conditionally executes a group of statements depending on the value of an expression SJU UU IOIS If lt eondition gt
53. tart Index of Data Array to start searching from Length Number of elements to search Returns Index of element at which the condition was satisfied uoung USNq JOLU NI Code 01 Dim Arr1 20 as Integer 02 Dim Arr2 20 as Integer 03 Public Sub Main 04 Dim I as Integer 05 Initialise the Array with some values 06 Por 1 10 To 5 One Arrl I I US Next US I OS MEMORY FINDFIRST Max ARR1 0 10 IOR debug print pos cstr I lo 12 Ena Sub PB1 PB2 Returns logical state of onboard push buttons lt E TEST pp 0 _ LN Variable OS PB1 Variable OS PB2 Returns 0 Button is not pressed 1 Button is pressed The following program polls both the onboard buttons for its logical state 5 times a second to detect if any of the buttons are pressed Code Dim BUTTON1 BUTTON2 as Integer OZ Do 03 o BUTTON1 OS PB1 04 BUTTON2 OS PB2 US Debug Print Cstr BUTTON1 Cstr BUITONZ Delay 200 BCORE USER MANUAL REV B JUNE 2010 RELEASE JOUUIL UNY Josey OS COMMAND REFERENCE RESET Commands the BlazingCore OS to perform a soft reset on itself OS Reset RUN Commands the BlazingCore OS to run Variable OS Run TIMER Provides access to control the chip s system timer Member Description Thit Initialise OS Timer with a specified prescale value index Read Returns time elapsed in terms of clock cycles dependent on p
54. ts external User Code 64K memory BCore Programs are stored here OS Data DataFlash Memory size supported are 64K 1 2 4 8 16MB User Data BCore allocates fixed regions within the DataFlash 128K as illustrated on the left e 64K each for User Code and OS Data e 128K for User Data e And the remaining memory DataFlash Size 256K for User Files bmp wav txt Files User Files Note By default BCore100 Boards ship with 1MB of external dataflash chip DataFlash Size 256K BCORE USER MANUAL REV B JUNE 2010 RELEASE I O PINOUT DESCRIPTION Pins PIC32MX695F512L BCore100 REV B 1 RA14 GIO JST1 PORTA 2 RA15 GIO 3 RFO GIO JST2 4 RF1 GIO PORTO 5 GIO JST3 6 GIO 7 RC3 GIO IST4 8 RCA GIO 9 REO GIO 10 RE1 GIO 11 RE2 GIO 12 RE3 GIO PORT1 PORTE 13 RE4 GIO 14 RES GIO 15 REG GIO 16 RE7 GIO PORT2 PORTB PORT3 33 RD7 GIO 34 RD6 GIO 35 RD5 GIO 36 RD4 GIO PORTA 37 RD3 GIO 38 RD2 GIO 39 RD1 GIO 40 RDO GIO SPI1 SDO1 PORTD 41 RD8 GIO 42 RD9 GIO SPI1 SS1 43 RD10 GIO SPI1 SCK1 44 RD11 GIO PORT5 45 RD12 GIO 46 RD13 GIO 47 RD14 GIO SPIx SS1A 48 RD15 GIO SPIx SCK1A BCORE USER MANUAL REV B JUNE 2010 RELEASE I O PINOUT DESCRIPTION 49 RAO GIO 50 RA1 GIO 51 RA2 GIO PORT6 52 RA3 GIO PORTA 53 RA4 GIO 54 RA7 GIO 55 RA9 GIO 56 RA10 GIO PORT7 57 GIO 58 GIO 59 GIO 60 RF12 LED1 61 BUTTON1 62 RA5 GIO PORTA 63 RA6 GIO 64 RC13 GIO 65 RC14 GIO 66 RC2 LED2 67 RES

Download Pdf Manuals

image

Related Search

Related Contents

Panasonic Phones KX  MP 2001_Eco Dec  Samsung DV42H5400EF/A3 Specification Sheet  Catálogo Fire-Tex-ES  commande groupee d`arbres et d`arbustes fruitiers  FACULTE DE MEDECINE DE TOURS - Université François Rabelais  Samsung HT-DS610 คู่มือการใช้งาน  AgfaPhoto Microflex 102 Manuel d`utilisateur  Fusion User Manual - Emerson Climate Technologies  

Copyright © All rights reserved.
Failed to retrieve file