so you did not even read the specs when you posted here that this is HMI you wanted to use? then you found entire two topics that mention serial communication? sounds like you are really putting a lot of effort into this...
forum is a great place to get ideas, but it is not the place to get someone to get your work done. i recommend getting information straight from the SOURCE. that means reading datasheets and applying what you read there. in other words check out pinned topic READ FIRST, read CWRITE manual for your KSS version, read documentation for HMI that you want to use, do the math (sanity check) etc. and if it all works out, then commit to project, otherwise look for a different solution.
for example, your first few checks should be something like this:
for HMI to communicate with KRC, data exchange need to take place independent of what robot program is running. So where would you place the code? in the program called by SPS.
exchanging data with that HMI supports serial comms and I/O. which one do you choose (if any)? how about I/O? yes it is possible, you can even bitbang data transfer through I/O but it would be slow. how slow? limiting factor is interpolation time of 12ms so even if you come up with some really novel way to exchange data efficiently, it will still be too slow - on the order of 40bits per second or so. you may use multiple IO to transfer more than one bit a time but i doubt that would get near something usable.
so how about serial? well you can get much faster rates, even 2400bps beats measly 40bps. did you check how fast is HMI port? did you check how fast you can make KRC serial port?
did you check what it takes to interface those two serial ports electrically? is the HMI port real RS232 or TTL level serial port? inverted or not? DTE or DCE?
next do you need one or two way communication? you can have KRC stream values continuously but how do you change what variables to update and in which order? that means creating some protocol.
see where this is going? how many of those points did you think of already? if not most, you may want to consider different strategy or getting someone full time to develop this. yes the HMI is low cost but that does not include development time. if you are learning and don't put price on your time, that is great but be prepared for sink in a lot of time.