216
D320 PLC User's Manual
void Kword_writing(void)
{
/* Example of Write-Register */
int i;
receiving_frame[2]=4; /* EXAMPLE write WORD(K000-K063) */
receiving_frame[3]=130; /* Number Of Byte For Information */
receiving_frame[4]=0x40; /* BASE(K000=$0140) LOW */
receiving_frame[5]=1; /* BASE HIGH */
for(i=0;i<=63;i++)
{
receiving_frame[i*2 +6]= lower_byte(K[i]);
receiving_frame[i*2 +7]= upper_byte(K[i]);
}
if(communication() == 0) printf("WRITE K0000-K0063 OK\n");
else printf("communication error\n");
receiving_frame[2]=4; /* EXAMPLE write WORD(K064-K0127) */
receiving_frame[3]=130; /* Number Of Byte For Information */
receiving_frame[4]=0x80; /* BASE(K000=$0180) LOW */
receiving_frame[5]=1; /* BASE HIGH */
for(i=0;i<=63;i++)
{
receiving_frame[i*2 +6]= lower_byte(K[i+64]);
receiving_frame[i*2 +7]= upper_byte(K[i+64]);
}
if(communication() == 0) printf("WRITE K0064-K0127 OK\n");
else printf("communication error\n");
}
Sends a function code requesting to
read the M area, and stores the
received data in the buffer.
Writing Function of the K Register.
Uses the communication function
code 4 (writing N consecutive words)
to store the specified value in the
K000 to K063 word.
Note:
Abs. address of K0 = 0x0140
Writing Function of the K Register.
Uses the communication function
code 4 (writing N consecutive words)
to store the specified value in the
K064 to K127 word.
Note:
Abs. address of K64 = 0x0180
Summary of Contents for D320 PLC
Page 1: ...D320 PLC User s Manual...
Page 18: ...6 D320 PLC User s Manual...
Page 28: ...16 D320 PLC User s Manual...
Page 34: ...22 D320 PLC User s Manual...
Page 78: ...66 D320 PLC User s Manual...
Page 176: ...164 D320 PLC User s Manual...
Page 210: ...198 D320 PLC User s Manual...
Page 258: ...246 D320 PLC User s Manual...