|
FreeHIL
|
File Map:
FH_Setup, Section FH_RFCommunication
The micro-controller on which FH source code is ported, could be simply utilized in a RS485 network
In other word, multiple devices or multiple cards could be simply utilized where every device or every card has its own address
Address of the device (or card) for every device (or card) is set by FH user in FH_DeviceAddress.h
An interested UART (called Communication Dedicated UART) by the FH user for the communication between RobotFramework and the micro-controller on which FH source code is ported, shall be dedicated
Different configuration on the communication between RobotFramework and the micro-controller are defined here
More...
Go to the source code of this file.
Macros | |
| #define | FH_RFCommunication_MinCommandSize 5 |
| #define | FH_RFCommunication_ReceiveBufLength 255 + FH_RFCommunication_MinCommandSize |
| #define | FH_RFCommunication_ReceiveBufMaxTimeout 100 |
| #define | FH_RFCommunication_SendBufLength 255 + FH_RFCommunication_MinCommandSize |
File Map:
FH_Setup, Section FH_RFCommunication
The micro-controller on which FH source code is ported, could be simply utilized in a RS485 network
In other word, multiple devices or multiple cards could be simply utilized where every device or every card has its own address
Address of the device (or card) for every device (or card) is set by FH user in FH_DeviceAddress.h
An interested UART (called Communication Dedicated UART) by the FH user for the communication between RobotFramework and the micro-controller on which FH source code is ported, shall be dedicated
Different configuration on the communication between RobotFramework and the micro-controller are defined here
SPDX-License-Identifier: Apache-2.0
Copyright 2026 Vahid Hasirchi
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
For more information refer to FreeHIL.com
Definition in file FH_RFCommunication_Configs.h.
| #define FH_RFCommunication_MinCommandSize 5 |
FH_RFCommunication_MinCommandSize is the minimum size of the message frame (FH_RFCommunication_Message) from RobotFramework (When DataLength is zero and there is no Data)
The minimum size includes the following items: 1 - DeviceAddress (1 byte) 2 - Function (1 byte) 3 - Command (1 byte) 4 - DataLength (1 byte) which is 0 for minimum size message 5 - Data (0 byte) which is not available for minimum size message 6 - Checksum (1 byte) => Total 5 bytes of data
Definition at line 55 of file FH_RFCommunication_Configs.h.
Referenced by FH_RFCommunication_Receive().
| #define FH_RFCommunication_ReceiveBufLength 255 + FH_RFCommunication_MinCommandSize |
FH_RFCommunication_ReceiveBufLength is the receive buffer length of the buffer which is filled in the ISR (Interrupt Service Routine) Communication Dedicated UART
255 is added to FH_RFCommunication_MinCommandSize to guarantee the maximum possible Data Length of 255 bytes in the Data part of the message
Definition at line 61 of file FH_RFCommunication_Configs.h.
| #define FH_RFCommunication_ReceiveBufMaxTimeout 100 |
If at least one byte of data is received through the ISR (Interrupt Service Routine) of the Communication Dedicated UART by the FH user, a complete message shall be received in a maximum defined timeout
The received data in the ISR (Interrupt Service Routine) will be ignored if the complete message will not be received within the defined timeout\nFor this to happen, FH_GlobalTimeCounter is utilized to calculate the maximum timeout
FH_RFCommunication_ReceiveBufMaxTimeout is the defined maximum timeout for every byte
In the ISR (Interrupt Service Routine) of the Communication Dedicated UART by the FH user, FH_GlobalTimeCounter shall be reset after receiving every byte of data
For example, 100 is set to have 100ms timeout (When the heart beat of the system is 1 mili-second) to receive a complete message when there is no longer any data being received
Definition at line 70 of file FH_RFCommunication_Configs.h.
Referenced by FH_RFCommunication_Receive().
| #define FH_RFCommunication_SendBufLength 255 + FH_RFCommunication_MinCommandSize |
Definition at line 72 of file FH_RFCommunication_Configs.h.
Referenced by FH_CAN_RFCommunication(), and FH_UART_RFCommunication().
FH_RFCommunication_Commandelements includes the position of different parts of the message in the message frame (FH_RFCommunication_Message) Since the Data part may have different sizes, the checksum position may be different
| Enumerator | |
|---|---|
| RFCommunication_DeviceAddress | The 1st data in the message frame is the DeviceAddress |
| RFCommunication_Function | The 2nd data in the message frame is the Function |
| RFCommunication_Command | The 3rd data in the message frame is the Command |
| RFCommunication_DataLength | The 4th data in the message frame is the DataLength |
| RFCommunication_Data | The Data could be from 0 byte to up to (FH_RFCommunication_ReceiveBufLength - FH_RFCommunication_MinCommandSize) bytes |
Definition at line 78 of file FH_RFCommunication_Configs.h.
FH_RFCommunication_Function includes different possible functions of the message in the message frame (FH_RFCommunication_Message)
Definition at line 117 of file FH_RFCommunication_Configs.h.
FH_RFCommunication_Message is the structure for receiving the message frame from RobotFramework
FH_RFCommunication_State is the enumeration utilized as state machine to collect the different blocks of the message frame from RobotFramework
It is initialized with RFCommunication_STATE_IDLE to be ready to collect a new message from RobotFramework
Definition at line 158 of file FH_RFCommunication_Configs.h.