Skip to content

Commit

Permalink
Fixed issue with input register
Browse files Browse the repository at this point in the history
  • Loading branch information
paulorb committed Jan 10, 2024
1 parent 79eaef8 commit be366a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/main/kotlin/PlcMemory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ class PlcMemory(configurationParser: ConfigurationParser) : IModbusServerEventL
inputStatus[address] = value
}

//3x
fun setInputRegister(address: Int, value: Short){
inputRegister[address] = value
}

// 4x
override fun presetMultipleRegisters(addressValueList: MutableList<Pair<Int, Short>>) {
println("(4x) presetMultipleRegisters")
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/PlcSimulation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ class PlcSimulation(
element.value.toBooleanFromBinary()
)
}
AddressType.INPUT_REGISTER -> TODO()
AddressType.INPUT_REGISTER -> {
memory.setInputRegister(variable.address.toInt(), element.value.toShort())
}
}
}
}
Expand Down

0 comments on commit be366a3

Please sign in to comment.