º¸³»ÁֽŠÇÁ¸® ÇÁ·ÎÅäÄÝ ¿¹Á¦ ÇÐÀÎÇß½À´Ï´Ù.
ÀÌÁöºä ÇÁ¸®ÇÁ·ÎÅäÄÝ <->Serial µ¥ÀÌÅ͸¦ ¹Þ¾Æ¼ Åë½ÅÇϴµ¥ ÆÐŶ¿¡ ¹®Á¦°¡ ÀÖ´Â°Í °°½À´Ï´Ù.
Á¦°¡ »ý°¢Çϱâ·Î´Â µ¥ÀÌÅÍ°¡ 02 30 31 52 58 48 50 30 03 22 ÆÐŶÀÌ Àü¼ÛµÇ¾ßÇϴµ¥ 00 À̵û¶ó ºÙ¾î¼ Àü¼ÛµÇ°í ÀÖ½À´Ï´Ù.
command[10]¿¡ÀÖ´Â ¹è¿¸¸ Àü¼ÛÇÒ ¼ö ÀÖ´Â ¹æ¹ýÀÌ ¾ø³ª¿ä?
*ÇØ´ç ¸ÅÅ©·Î ¼Ò½º Àü´Þ* (÷ºÎÆÄÀϵµ È®ÀÎ ºÎŹµå¸³´Ï´Ù.)
macro_command main()
short return_value=0
char command[10]={0}, response[20]={0}
FILL(command[0], 0, 10)
FILL(response[0], 0, 20)
command[0] = 0x02 // start code(STX)
command[1] = 0x30 // station no
command[2] = 0x31 // station no
command[3] = 0x52 // RX(Àб⠿䱸)
command[4] = 0x58 // RX(Àб⠿䱸)
command[5] = 0x48 // HPO(½Àµµ ÃøÁ¤)
command[6] = 0x50 // HPO(½Àµµ ÃøÁ¤)
command[7] = 0x30 // HPO(½Àµµ ÃøÁ¤)
command[8] = 0x03 // END code
command[9] = 0x22 // BCC
//XORSUM(command[0], command[9], 9)
SetData(command[0], "Local HMI", LW, 100, 10)
OUTPORT(command[0], "Conotec", 10) // send command
DELAY(1000)
INPORT(response[0], "Conotec", 20, return_value) // read response
SetData(return_value, "Local HMI", LW, 0, 1)
SetData(response[0], "Local HMI", LW, 10, 20)// send response to LW
end macro_command