| Author | Matrix Ltd. | 
| Version | 1.3 | 
| Category | E-blocks 2 | 
Bluetooth component
Low level routines for controlling a Microchip RN4677 Bluetooth Module. Also available in the form of the BL0170 Bluetooth E-block. Uses an interrupt to receive characters from the UART and improve reliability, Must be used with a hardware UART channel.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_EBlocks2_Bluetooth_RN4677_BL0170.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_EBlocks2_Bluetooth_RN4677_BL0170.fcfx
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
|   | ReceiveByte | 
| Receives a single data byte from the Bluetooth module. 0-255 signifies valid data / 256 signifies no data available. | 
|  - UINT | Timeout | 
| Amount of time to wait in milliseconds 0=Wait forever | 
|  - UINT | Return | 
|   | SendString | 
| Sends a string to the Bluetooth module. | 
|  - STRING | Command | 
|  | 
|  - BYTE | SendCR | 
|  | 
|  - VOID | Return | 
|   | LeaveCommandMode | 
| Leaves command mode allowing data to be passed back and forth, | 
|  - VOID | Return | 
|   | ConnectToMAC | 
| Connects to a specific Bluetooth MAC address. Waits up to 5 seconds for connection to be established. Returns 1 if connection was successful. | 
|  - STRING | MACAddress | 
|  | 
|  - BOOL | Return | 
|   | SendCommand | 
| Sends a command string to the Bluetooth module. Returns: 0 = No Reply / 1 = Command sent ok | 
|  - STRING | Command | 
|  | 
|  - BYTE | SendCR | 
|  | 
|  - BYTE | DiscardReply | 
| 0=Do not touch the reply, 1=Wait for reply and remove from buffer | 
|  - BYTE | Return | 
|   | ReceiveCount | 
| Returns the number of bytes currently sat waiting in the receive buffer. | 
|  - UINT | Return | 
|   | ReadString | 
| Copies the incoming data from the data string array to a local string variable. | 
|  - BYTE | NumBytes | 
| Maximum number of bytes to try and read | 
|  - STRING | Return | 
|   | SendByte | 
| Sends a single data byte out to the Bluetooth module. | 
|  - BYTE | Data | 
|  | 
|  - VOID | Return | 
|   | EnterCommandMode | 
| Enters command mode allowing commands to be sent using the SendCommand macro. Returns: 0 = No Reply / 1 = Command Mode OK | 
|  - BOOL | Return | 
|   | WaitForStringValue | 
| Allows us to wait and check for an incoming value. Returns 1 if the string value is found otherwise returns 0. | 
|  - STRING | Value | 
| String value to look for | 
|  - UINT | Timeout | 
| Length of time to wait in milliseconds | 
|  - BOOL | Return | 
|   | GetMACAddress | 
| Gets the local Bluetooth device MAC address. | 
|  - STRING | Return | 
|   | Initialise | 
| Sets up the Bluetooth module including:   - Enabling the UART  - Configuring the module (Name / Key / etc) Returns 1 for OK and 0 for no reply. | 
|  - BYTE | Return | 
Property reference
|   | Properties | 
|   | Bluetooth Settings | 
|   | Device Name | 
| Sets the friendly name of the Bluetooth device. | 
|   | Pair Key | 
|  | 
|   | Discoverable | 
| Is the Bluetooth module discoverable by default? | 
|   | Reply Timeout | 
| Specifies the amount of time to wait for incoming data before timing out in milliseconds. Default 2000 = 2 seconds. | 
|   | RX Buffer Size | 
| Amount of RAM memory to dedicate to receiving responses and incoming data from the BT module. Default 40 | 
|   | 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. | 
|   | Baud Options | 
| Baud rate option selector | 
|   | Baud Rate | 
|  | 
|   | TX | 
| Pin to be used for Transmit data | 
|   | TX Remap Pin | 
| Allows the hardware transmit pin to be configured from a list of available pins based on your target device, | 
|   | RX | 
| Pin to be used for Receive data | 
|   | RX Remap Pin | 
| Allows the hardware receive pin to be configured from a list of available pins based on your target device, | 
|   | Simulation | 
|   | Simulate Comms | 
|  | 
|   | Simulation | 
|   | 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      Injector - Routes the communication data via a data injector component on the Panel. | 
==Macro reference==
|   | ReceiveByte | 
| Receives a single data byte from the Bluetooth module. 0-255 signifies valid data / 256 signifies no data available. | 
|  - UINT | Timeout | 
| Amount of time to wait in milliseconds 0=Wait forever | 
|  - UINT | Return | 
|   | SendString | 
| Sends a string to the Bluetooth module. | 
|  - STRING | Command | 
|  | 
|  - BYTE | SendCR | 
|  | 
|  - VOID | Return | 
|   | LeaveCommandMode | 
| Leaves command mode allowing data to be passed back and forth, | 
|  - VOID | Return | 
|   | ConnectToMAC | 
| Connects to a specific Bluetooth MAC address. Waits up to 5 seconds for connection to be established. Returns 1 if connection was successful. | 
|  - STRING | MACAddress | 
|  | 
|  - BOOL | Return | 
|   | SendCommand | 
| Sends a command string to the Bluetooth module. Returns: 0 = No Reply / 1 = Command sent ok | 
|  - STRING | Command | 
|  | 
|  - BYTE | SendCR | 
|  | 
|  - BYTE | DiscardReply | 
| 0=Do not touch the reply, 1=Wait for reply and remove from buffer | 
|  - BYTE | Return | 
|   | ReceiveCount | 
| Returns the number of bytes currently sat waiting in the receive buffer. | 
|  - UINT | Return | 
|   | ReadString | 
| Copies the incoming data from the data string array to a local string variable. | 
|  - BYTE | NumBytes | 
| Maximum number of bytes to try and read | 
|  - STRING | Return | 
|   | SendByte | 
| Sends a single data byte out to the Bluetooth module. | 
|  - BYTE | Data | 
|  | 
|  - VOID | Return | 
|   | EnterCommandMode | 
| Enters command mode allowing commands to be sent using the SendCommand macro. Returns: 0 = No Reply / 1 = Command Mode OK | 
|  - BOOL | Return | 
|   | WaitForStringValue | 
| Allows us to wait and check for an incoming value. Returns 1 if the string value is found otherwise returns 0. | 
|  - STRING | Value | 
| String value to look for | 
|  - UINT | Timeout | 
| Length of time to wait in milliseconds | 
|  - BOOL | Return | 
|   | GetMACAddress | 
| Gets the local Bluetooth device MAC address. | 
|  - STRING | Return | 
|   | Initialise | 
| Sets up the Bluetooth module including:   - Enabling the UART  - Configuring the module (Name / Key / etc) Returns 1 for OK and 0 for no reply. | 
|  - BYTE | Return | 
Property reference
|   | Properties | 
|   | Bluetooth Settings | 
|   | Device Name | 
| Sets the friendly name of the Bluetooth device. | 
|   | Pair Key | 
|  | 
|   | Discoverable | 
| Is the Bluetooth module discoverable by default? | 
|   | Reply Timeout | 
| Specifies the amount of time to wait for incoming data before timing out in milliseconds. Default 2000 = 2 seconds. | 
|   | RX Buffer Size | 
| Amount of RAM memory to dedicate to receiving responses and incoming data from the BT module. Default 40 | 
|   | 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. | 
|   | Baud Options | 
| Baud rate option selector | 
|   | Baud Rate | 
|  | 
|   | TX | 
| Pin to be used for Transmit data | 
|   | TX Remap Pin | 
| Allows the hardware transmit pin to be configured from a list of available pins based on your target device, | 
|   | RX | 
| Pin to be used for Receive data | 
|   | RX Remap Pin | 
| Allows the hardware receive pin to be configured from a list of available pins based on your target device, | 
|   | Simulation | 
|   | Simulate Comms | 
|  | 
|   | Simulation | 
|   | 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      Injector - Routes the communication data via a data injector component on the Panel. | 
==Macro reference==
|   | ReceiveByte | 
| Receives a single data byte from the Bluetooth module. 0-255 signifies valid data / 256 signifies no data available. | 
|  - UINT | Timeout | 
| Amount of time to wait in milliseconds 0=Wait forever | 
|  - UINT | Return | 
|   | SendString | 
| Sends a string to the Bluetooth module. | 
|  - STRING | Command | 
|  | 
|  - BYTE | SendCR | 
|  | 
|  - VOID | Return | 
|   | LeaveCommandMode | 
| Leaves command mode allowing data to be passed back and forth, | 
|  - VOID | Return | 
|   | ConnectToMAC | 
| Connects to a specific Bluetooth MAC address. Waits up to 5 seconds for connection to be established. Returns 1 if connection was successful. | 
|  - STRING | MACAddress | 
|  | 
|  - BOOL | Return | 
|   | SendCommand | 
| Sends a command string to the Bluetooth module. Returns: 0 = No Reply / 1 = Command sent ok | 
|  - STRING | Command | 
|  | 
|  - BYTE | SendCR | 
|  | 
|  - BYTE | DiscardReply | 
| 0=Do not touch the reply, 1=Wait for reply and remove from buffer | 
|  - BYTE | Return | 
|   | ReceiveCount | 
| Returns the number of bytes currently sat waiting in the receive buffer. | 
|  - UINT | Return | 
|   | ReadString | 
| Copies the incoming data from the data string array to a local string variable. | 
|  - BYTE | NumBytes | 
| Maximum number of bytes to try and read | 
|  - STRING | Return | 
|   | SendByte | 
| Sends a single data byte out to the Bluetooth module. | 
|  - BYTE | Data | 
|  | 
|  - VOID | Return | 
|   | EnterCommandMode | 
| Enters command mode allowing commands to be sent using the SendCommand macro. Returns: 0 = No Reply / 1 = Command Mode OK | 
|  - BOOL | Return | 
|   | WaitForStringValue | 
| Allows us to wait and check for an incoming value. Returns 1 if the string value is found otherwise returns 0. | 
|  - STRING | Value | 
| String value to look for | 
|  - UINT | Timeout | 
| Length of time to wait in milliseconds | 
|  - BOOL | Return | 
|   | GetMACAddress | 
| Gets the local Bluetooth device MAC address. | 
|  - STRING | Return | 
|   | Initialise | 
| Sets up the Bluetooth module including:   - Enabling the UART  - Configuring the module (Name / Key / etc) Returns 1 for OK and 0 for no reply. | 
|  - BYTE | Return | 
Property reference
|   | Properties | 
|   | Bluetooth Settings | 
|   | Device Name | 
| Sets the friendly name of the Bluetooth device. | 
|   | Pair Key | 
|  | 
|   | Discoverable | 
| Is the Bluetooth module discoverable by default? | 
|   | Reply Timeout | 
| Specifies the amount of time to wait for incoming data before timing out in milliseconds. Default 2000 = 2 seconds. | 
|   | RX Buffer Size | 
| Amount of RAM memory to dedicate to receiving responses and incoming data from the BT module. Default 40 | 
|   | 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. | 
|   | Baud Options | 
| Baud rate option selector | 
|   | Baud Rate | 
|  | 
|   | TX | 
| Pin to be used for Transmit data | 
|   | TX Remap Pin | 
| Allows the hardware transmit pin to be configured from a list of available pins based on your target device, | 
|   | RX | 
| Pin to be used for Receive data | 
|   | RX Remap Pin | 
| Allows the hardware receive pin to be configured from a list of available pins based on your target device, | 
|   | Simulation | 
|   | Simulate Comms | 
|  | 
|   | Simulation | 
|   | 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      Injector - Routes the communication data via a data injector component on the Panel. |