Really appreciate your quick response.
I must apologize to you, it's my fault, after checking my rusty mcu device. I found some glitch in my firmware.
After re-write and upload to the chip, it works in both reading and writing with your header. Except that on the PC end the port_write_bytes still returns a huge number.
Thank you for your great contribution and your continuous attention on this thread, I think I own you a beer.
Wish you a best day.