AIS Cube
BCore
[THE
BLAZINGCORE SERIES]
With superior number crunching abilities and peripheral handling on our custom embedded OS, Rapid prototyping is now easy... and blazing fast.
REV.E | MARCH 2012 RELEASE
BCORE command Reference BCore Commands
BCore The following members listed under BCore contain methods that are specific for peripheral handling based on the BlazingCore Microcontroller Board’s Hardware Configuration.
Members
Description
Comm2 Comm3 Comm4 SPI I2C PWM
Handles methods for serial communication on Comm2 Handles methods for serial communication on Comm3 Handles methods for serial communication on Comm4 Provides methods for communication over the SPI Busline Provides methods for communication over the I2C Busline Provides access to methods for pulse-width-modulation commands
UART Serial communication on the BCore is available through the use of UART. The BCore board has 4 UARTs supported by the BCoreOS under the name of Comm1/2/3/4. Comm2/3/4 supports advance UART options Full duplex, 8 or 9bit transmission Addressing Mode No parity One Stop Bit Baud Rate: Varying Standard Baud Rates 4 word deep FIFO Data Receive Buffer
Comm2 Located at JST5. *Note: COMM2 pins are shared with SPI pins. Please note that only COMM2 or SPI may be used at any one time.
Comm3 Pin Location: TX: JP1 ; RX: JST5. *Note: COMM3 Pins are shared with SPI and LED1. Only COMM3 or SPI pins may be used at any one time.
Comm4 Located at PORT5, pins 47 & 48. *Note: COMM4 Pins are shared with the OLED Data Bus Line.
COMM2/ Comm3/ Comm4 Handles advance options and methods for serial communication
Methods
Description
Init Open Close Clear HasData Tx Rx Address Tx9bit Rx9bit
Initialise the UART COMM port with specified baud rate and mode Open Comm Port Close Comm Port Clear Buffer Returns if data is present in the buffer Transmit 8 bit data through the Comm Port Receive 8 bit data through the Comm Port Set up the 9bit address and the 9bit address watch mode Transmit 9 bit data through the Comm Port Receive 9 bit data through the Comm Port
REV.E | MARCH 2012 RELEASE |P a g e | 1
BCORE command Reference ‘
UART / Serial Communication
.Init Initialise the UART COMM port with specified baud rate and mode BCore.COMMx.Init(ByVal BaudRate As Integer, ByVal Mode As Integer) Where COMMx is COMM2/3/4 Parameter/s; Baud Rate: Desired Baud Rate in bps; eg. 115200 Mode: o ‘0’: Normal Operation - 8 bit Data, 1 stop bit, No Parity o ‘1’: 9bit Operation, 1 stop bit, No Parity
.Open Open Comm Port BCore.COMMx.Open()
.Close Close Comm Port BCore.COMMx.Close()
.CLEAR Clear Buffer of Comm Port BCore.COMMx.Clear()
.hasdata Returns state of Data Receive buffer Variable = BCore.COMMx.HasData()As Integer Returns; Logical True if data is present in the data receive buffer, Logical False if the buffer is empty.
.TX Transmit 8 bit data through specified Port *Transmission is done one byte at a time. BCore.COMMx.TX(ByVal Data As Integer)
.RX Returns byte data stored in Data Receive buffer *Data is retrieved one byte at a time. Variable = BCore.COMMx.RX()As Integer
REV.E | MARCH 2012 RELEASE |P a g e | 2
BCORE command Reference UART / Serial Communication
.ADDRESS Set up the 9bit address and the 9bit address watch mode BCore.COMMx.Init(ByVal Address As Integer, ByVal Mode As Integer) Where COMMx is COMM2/3/4
Parameter/s; Address: Set Address Info Mode: o ‘0’: Enable Address Watch Mode o ‘1’: Disable Address Watch Mode Important: Comm MUST first be initialised for 9bit Operation.
.TX9bit Transmit 9 bit data through specified Port BCore.COMMx.Tx9bit(ByVal Data As Integer)
.RX9bit Returns 9bit data stored in Data Receive buffer Variable = BCore.COMMx.Rx9bit() As Integer
REV.E | MARCH 2012 RELEASE |P a g e | 3
BCore command Reference SPI
SPI Provides methods for communication over the SPI Bus Line (JST5).
Members
Description
Init Tx8 Tx16 TxRx8 TxRx16 Rx8 Rx16
Initialise the SPI Bus line for use Transmit 8bit Data Transmit 16bit Data Transmit and Receive 8bit Data simultaneously Transmit and Receive 16bit Data simultaneously Receive 8bit Data Receive 16bit Data
.Init Initialise the SPI Bus line with the specified speed and mode BCore.SPI.Init(ByVal Speed As Integer, ByVal Mode As Integer) Parameter/s; Speed: Desired Speed Mode: SPI Mode (Currently not supported); Insert Dummy Value
.TX8 Transmit 8bit Data BCore.SPI.Tx8(ByVal Data As Integer)
.TX16 Transmit 16bit Data BCore.SPI.Tx16(ByVal Data As Integer)
.TXRx8 Transmit and Receive 8bit Data simultaneously Variable = BCore.SPI.TxRx8(ByVal Data As Integer) As Integer
.TXRx16 Transmit and Receive 16bit Data simultaneously, with ACK Variable = BCore.SPI.TxRx16(ByVal Data As Integer) As Integer
.Rx8 Receive 8bit Data Variable = BCore.SPI.Rx8() As Integer
.Rx16 Receive 16bit Data Variable = BCore.SPI.Rx16() As Integer
REV.E | MARCH 2012 RELEASE |P a g e | 4
BCore command Reference I2C
I2C Provides methods for communication over the I2C Bus line . (Located at JST2; Pins 3 & 4.)
Members
Description
Init Start Restart Stop Tx8 Rx8 Rx8Nack
Initialise the I2C Bus line for use Start I2C Communication Restart I2C Communication Stop I2C Communication Transmit 8bit Data Receive 8bit Data with ACK Receive 8bit Data with NACK
.Init Initialise the I2C Bus line with the specified speed and mode BCore.I2C.Init(ByVal Speed As Integer, ByVal Mode As Integer) Parameter/s; Speed: Desired Speed Mode: I2C Mode (Currently not supported); Insert Dummy Value
.START Start I2C Communication BCore.I2C.Start()
.RESTART Restart I2C Communication BCore.I2C.Restart()
.STOP Stop I2C Communication BCore.I2C.Stop()
.TX8 Transmit 8bit Data BCore.I2C.Tx8(ByVal Data As Integer)
.Rx8 Receive 8bit Data with ACK Variable = BCore.I2C.Rx8() As Integer
.Rx8Nack Receive 8bit Data with NACK Variable = BCore.I2C.Rx8Nack() As Integer
REV.E | MARCH 2012 RELEASE |P a g e | 5
BCore command Reference PWM
PWM BCore supports the use of PWM (Pulse-Width-Modulation) on Channels 1 to 5, located on Pins 36 to 40.
Members
Description
Init Start Stop Pin
Initialise PWM Channel Start Pulse-Width-Modulation Stop Pulse-Width-Modulation Open/Close Specified PWM Pin Channel
.Init Initialise the PWM Channel with the specified period, mode and prescale value BCore.PWM.Init(ByVal Period As Integer, ByVal Mode As Integer, ByVal Prescalar As Integer) Parameter/s; Period: Period N, specified in table below. Mode: (Currently not in use); Insert Dummy Value
Prescalar: (Currently not in use); Insert Dummy Value
Calculating frequency (f) f = 1 \ (P * 0.0000000125) Period in sec = 1 \ f Eg N 20000 16000 10000 5000 2000 1000 100
f 4000 5000 8000 16000 40000 80000 800000
Period (msec) 0.25 0.2 0.125 0.0625 0.025 0.0125 0.00125
.START Start the PWM Peripheral BCore.PWM.Start()
.STOP Stop the PWM Peripheral BCore.PWM.Stop()
REV.E | MARCH 2012 RELEASE |P a g e | 6
BCore command Reference PWM
Pin Provides access to specific PWM Channel Pin Commands
Members
Description
Open Close
Open a PWM Channel with the specified PWM Channel Close a PWM Channel
Pin
PWM Channel
36
5
37
4
38
3
39
2
40
1
.OPEN Open a PWM Channel with the specified PWM Channel BCore.PWM.Pin.Open(ByVal Channel As Integer, ByVal Duty_Cycle As Integer) Parameter/s; Channel: PWM Channel to Open. Duty Cycle: Duty Cycle Value to initialise the PWM channel with
.CLOSE Close a PWM Channel BCore.PWM.Close(ByVal Channel As Integer) Parameter/s; Channel: PWM Channel to Close
REV.E | MARCH 2012 RELEASE |P a g e | 7
Notes Latest documentation All of our documentations are constantly 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.
Copyright 2012 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. Sonata ide and BlazingCore(BCore) are trademarks of AIS Cube in Singapore and/or other countries. All images depicting the Blazingcore any RELEASE part of it|P is copyrighted. REV.E | MARCHor 2012 age |8 All other trademarks or registered trademarks are the property of their respective owners.