Appendix A: D320 PLC Communication Protocol
213
{
Mword_reading();
Kword_writing();
}
else
exit(0);
}
}
void RR_occurring(void)
{
receiving_frame[2]=0;
receiving_frame[3]=1;
receiving_frame[4]=0;
}
void Trsport(unsigned int data)
{
if (port_number == 5) outportb(PORTADD,data);
else outportb(0x08,data);
}
unsigned int Recport(void)
{
unsigned int dt;
if (port_number == 5) dt=inportb(PORTADD);
else dt=inportb(0x08);
return(dt);
}
BOOL sending_occurring(void)
{
BOOL tf;
if (port_number == 5) tf=((inportb(0x02) & 0x80)==0x80);
else tf=((inportb(0x0D) & 0x20)==0x20);
return(tf);
}
BOOL receiving_occurring(void)
{
BOOL rf;
if (port_number == 5) rf=((inportb(0x02) & 0x20)==0x20);
else rf=((inportb(0x0D) & 0x01)==0x01);
return(rf);
}
void Crc16(unsigned int data)
{
unsigned int i;
Crc=Crc^(data & 0x00FF);
for(i=0;i<=7;i++)
{
if((Crc & 0x0001) == 0x0001) Crc=(Crc>>1)^0xA001; /* 0x0001 : mult-nominal
expression */
else Crc=Crc>>1;
}
}
void Job(void)
{
/* JobID=0 : Change to sending-Mode for Serial port */
/* JobID=1 : Transmit sending-Frame */
/* JobID=2 : Change to receiving-Mode for Serial port */
/* JobID=3 : Address Polling of ACK from CPU */
/* JobID=4 : Receive ACK from CPU */
/* JobID=5 : Change to sending-Mode for Serial port */
/* JobID=6 : Transmit RR-Frame */
/* JobID=7 : Change to receiving-Mode for Serial port */
/* JobID=8 : Address Polling of RES from CPU */
/* JobID=9 : Receive RES from CPU */
Read the register value for the M area
(M0 to M127)
Store the value for the M area in the
K area (K0 to K127)
RR (Request Response) request
function.
Sends data to the communication
port.
Reads the received data from the
communication port.
Outputs the data when a send event
occurs.
Inputs the data when a Receive event
occurs.
CRC Calculation
:
Encodes the communication data in
the byte stream. When one
communication function is complete,
it is attached to the most recent frame,
or is compared with the attached CRC
to check for data errors.
Communication sequence
functions
:
Job ID=0~4 Q,QA Frame handling
Job ID=5~9 RA,R Frame handling
Содержание D320 PLC
Страница 1: ...D320 PLC User s Manual...
Страница 18: ...6 D320 PLC User s Manual...
Страница 28: ...16 D320 PLC User s Manual...
Страница 34: ...22 D320 PLC User s Manual...
Страница 78: ...66 D320 PLC User s Manual...
Страница 176: ...164 D320 PLC User s Manual...
Страница 210: ...198 D320 PLC User s Manual...
Страница 258: ...246 D320 PLC User s Manual...