EasyManua.ls Logo

Cutler-Hammer D50 - Page 183

Cutler-Hammer D50
228 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
170 D50 PLC User's Manual
/* JobID=7 : Change to receiving-Mode for Serial port */
/* JobID=8 : Address Polling of RES from CPU */
/* JobID=9 : Receive RES from CPU */
/* JobID=10 : Success communication Processing */
switch(JobID)
{
case 0: case 5:if (port_number != 5)
{
if (port_number == 4) outportb(0x301,0xFF);
else outportb(PORTADD+0x0C,(inportb(PORTADD+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(PORTADD+0x0C,(inportb(PORTADD+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]);
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
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

Table of Contents