Author
|
Matrix Ltd
|
Version
|
2.1
|
Category
|
Wireless
|
Bluetooth (HC05 / HC06) component
Low level routines for controlling or interacting with a HC05 or HC06 Bluetooth module. Contains functions to allow the baud rate, bluetooth name and bluetooth key to be defined.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_BTHC05.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_BTHC05.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Example Program that configures a HC05 / HC06 Bluetooth module and then allows a data connection to be established and utilised.
Incoming data will be displayed on an LCD.
Outgoing data is assigned and sent using a keypad component.
HC05 Example
Macro reference
Initialise
|
Initialise
|
Sets up the RS232 peripheral, must be called at the start of your program or at least before you start calling any other RS232 macros.
|
- VOID
|
Return
|
ReceiveChar
|
ReceiveChar
|
Attempts to receive a single packet from the UART interface.
|
- INT
|
Timeout
|
Time to wait for valid data before returning, 0=Dont wait, 255=Wait forever.
|
- INT
|
Return
|
ReceiveString
|
ReceiveString
|
Attempts to receive a string of bytes from the UART interface.
|
- BYTE
|
Timeout
|
|
- BYTE
|
NumBytes
|
|
- STRING
|
Return
|
SendChar
|
SendChar
|
Sends out a single packet from the UART interface.
|
- INT
|
Char
|
|
- VOID
|
Return
|
SendCommand
|
SendCommand
|
Sends a command string to the HC05/HC06 module.
|
- STRING
|
Command
|
|
- VOID
|
Return
|
SendNumber
|
SendNumber
|
Sends out a number as an ASCII String from the UART interface.
|
[[File:]] -
|
Number
|
|
- VOID
|
Return
|
SendString
|
SendString
|
Sends out a string of bytes from the UART interface.
|
- STRING
|
Data
|
|
- VOID
|
Return
|
SetBaud
|
SetBaud
|
Sets the Bluetooth baud rate stored in the Bluetooth module's ROM. Commands must be sent before Bluetooth communications are estabished e.g. right after power on and initialisation.
|
- BYTE
|
Baud
|
1=1200, 2=2400, 3=4800, 4=9600, 5=19200, 6=NA, 7=38400, 8=57600, 9=115200
|
- VOID
|
Return
|
SetName
|
SetName
|
Sets the Bluetooth Friendly name stored in the Bluetooth module's ROM. Commands must be sent before Bluetooth communications are estabished e.g. right after power on and initialisation.
|
- STRING
|
Name
|
Name you wish to provide to the module
|
- VOID
|
Return
|
SetPairKey
|
SetPairKey
|
Sets the Bluetooth pair key stored in the Bluetooth module's ROM. Commands must be sent before Bluetooth communications are estabished e.g. right after power on and initialisation.
|
- STRING
|
Key
|
Four digit pair key e.g. "0000" or "1234"
|
- VOID
|
Return
|
Property reference
|
Properties
|
|
Comms Settings
|
|
Data Bits
|
Number of data bits
|
|
Return
|
Return data width from Receive macro. 8-bit data mode always returns a byte ranging from 0-255, 255 could mean a timeout or could be a valid data. 16-bit data mode rereturns 0-255 for valid data, 256 for a timeout, return data must be stored into an INT or UINT variable.
|
|
Echo
|
Echo selection
|
|
Baud Options
|
Baud rate option selector
|
|
Baud Rate
|
|
|
Connections
|
|
Channel
|
UART Channel selector Software channels are bit banged using generic I/O pins but are not as reliable as hardware channels. Hardware channels use the selected peripheral on-board the target microcontroller.
|
|
Use TX
|
Selects if the Transmit pin is used by the component. Yes: The TX pin is active and used to transmit data for the UART. No: The TX pin is disabled and free to be used as general I/O.
|
|
TX
|
Pin to be used for Transmit data
|
|
Use RX
|
Selects if the Receive pin is used by the component. Yes: The RX pin is active and used to receive data for the UART. No: The RX pin is disabled and free to be used as general I/O.
|
|
RX
|
Pin to be used for Receive data
|
|
Use Flow Control
|
Flow Control (Handshake) enable or disable. On: Two I/O pins are used to control the flow of data in and out of the device. Off: Flow control is disabled.
|
|
Simulation
|
|
Label
|
Textual label shown on the component I/O flasher
|
|
Scope Traces
|
Selects if the scope traces are automatically added to the data recorder window or not. Simulation - draws an approximation of the UART data onto the scope trace. ICT - sets up the scope trace for incoming data and adds UART packet decoding at the correct BAUD.
|
|
Console Data
|
Selects if the console data is automatically generated or not
|
|
Console Columns
|
Number of characters that can be displayed on a single line of the console.
|
|
Data Source
|
Simulation data source used to allow the component to connect to various remote devices Nothing - Simulation data is ignored COM port - Routes the communication data to and from a physical or virtual COM port API - Routes the communication data via a data injector component on the Panel.
|