Need a conditional modebus register entry to modebus enable set command
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2022-01-09 10:28 PM
Hi there,
I have 2 modebus register 0x0010, 0x0011. These are enable encryption
key value. There square vaule should be less then 255 for some reason. This modebus register can be allowed for certain command functions as follows.
void ModebusSetCMD_ENE(void)
{
ModebusSetCMD_Rectifier();
// ENE encryption
{
if(g_ModebusRegister[ENE_RANDUM_NUMBER] && (g_ModebusRegister[ENE_ENCRYPTION_KEY] & 0xFF))
{
g_ModebusRegister[ENE_ENCRYPTION_RESULT] = (g_ModebusRegister[ENE_RANDUM_NUMBER] + (g_ModebusRegister[ENE_ENCRYPTION_KEY] >> 8)) / (g_ModebusRegister[ENE_ENCRYPTION_KEY] & 0xFF);
}
else
{
g_ModebusRegister[ENE_ENCRYPTION_RESULT] = 0xFFFF;
}
}
}
What should I do in the logic to make them less then 225?
Labels:
- Labels:
-
STM32F1 Series
This discussion is locked. Please start a new topic to ask your question.
0 REPLIES 0
