214
D320 PLC User's Manual
/* JobID=10 : Success communication Processing */
switch(JobID)
{
case 0: case 5:if (port_number != 5)
{
if (port_number == 4) outportb(0x301,0xFF);
else outportb(0x0C,(inportb(0x0C) | 0x02));
delay(sending_delay);
}
if (JobID == 5) RR_occurring();
watchdog=0; index=0; sending_Index_max=5; Crc=0xFFFF; JobID++;
break;
case 1: case 6:if (receiving_occurring()) data=Recport();
if (sending_occurring())
{
if (index<sending_Index_max-1)
{
Trsport(receiving_frame[index]);
Crc16(receiving_frame[index]);
if (index==3)
{
if (receiving_frame[3]==0) sending_Index_max=256+5;
else sending_Index_max=receiving_frame[3]+5;
}
}
else if (index==sending_Index_max-1)
{
receiving_frame[index]=lower_byte(Crc);
Trsport(receiving_frame[index]);
}
else if (index==sending_Index_max)
{
receiving_frame[index]=upper_byte(Crc);
Trsport(receiving_frame[index]); watchdog=0; JobID++;
}; index++;
}
break;
case 2: case 7:if (port_number != 5)
{
delay(receiving_delay);
if (port_number ==4) outportb(0x301,0x00);
else outportb(0x0C,(inportb(0x0C) & 0xFD));
}
JobID++;
break;
case 3:
case 8:if (receiving_occurring())
{
data=Recport();
if(data==PC_ID)
{
Crc=0xFFFF; index=1; receiving_Index_max=5;
receiving_frame[0]=data; Crc16(data); JobID++;
}
}
break;
case 4:
case 9:if(receiving_occurring())
{
if(index<receiving_Index_max-1)
{
receiving_frame[index]=Recport();
Crc16(receiving_frame[index]);
if(index==3)
{
if(receiving_frame[3]==0) receiving_Index_max=256+5;
JobID 0,5:
A frame sends the data from the
peripheral device to the PLC. It resets
the watchdog and the CRC.
Use a delay after the send to avoid
errors due to communications delays.
JobID 1,6:
Sends the Q and RR data.
When there are no errors, it resets the
watchdog and proceeds on to the next
sequence.
JobID=2,7:
A sequence that senses the sending of
the QA and R data to the peripheral
device after the completion of the
functions that are received by the
PLC from the previous frame.
JobID=3,8:
Handles the received data, and
calculates the CRC of the received
data.
JobID=4,9:
Stores the received data in the
internal receivable buffer and
compares the CRC value sent by the
PLC to the calculated CRC value. It
notifies the system that a successful
communication is made when the two
values match, and proceeds on to the
next sequence.
Содержание 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...