Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 05-31-2005, 09:58 PM   #1
Member (8 bit)
 
amigo's Avatar
 
Join Date: Jan 2003
Location: The Philippines
Posts: 187
Question Program help

Hi All,

We have this machine acquired from Korea. We could not access the device function because it would ask for a password. The problem here is we could not contact Korea for the password. The only option is to disable it but I have no idea how . Attached below is the program. I have no programming background so please bear with me.
Any help would be greatly appreciated.




#include "plcc.h"

int DEVICE_CHANGE, TOP_BOT = 0;
int Stop_on = 0;
void Read_device( void )
{
int i, j, chk_read;
char top_bot[3], key[5];
FILE *fp;
fp = fopen("DEVICE.DAT", "r");
if ( fp != NULL)
{
fscanf( fp, "%d %ld %ld %ld %ld %ld ", &R[1201], &L[160], &L[161], &L[162], &L[163], &L[164] );
//DEVICE, RUN, TROUBLE, STOP, TOTAL PROD CNT
old_device = R[1201];
}
else
strcpy(S[120], "DEVICE Not Found");
fclose(fp);
}

void Save_device( void )
{
FILE *fp;
char device_data[40];
fp = fopen ( "DEVICE.DAT", "w");
if ( fp != NULL)
{
L[163] = L[101]; L[164] = L[102];
sprintf( device_data, "%d %ld %ld %ld %ld %ld ", R[1201], L[160], L[161], L[162], L[163], L[164] );
fputs( device_data, fp);
}
fclose(fp);
}

void Save_data( void )
{
int write_check = 0;
Handle = OpenDbase("DATA.DBF", MODE_RDWR);
sprintf( S[97], "%04d/%02d/%02d", R[4], R[5], R[6] ); // date
R[2554] = ( int ) L[101];
R[2556] = R[2601]; R[2558] = R[2602]; //running time
R[2560] = R[2604]; R[2562] = R[2605]; //trouble time
R[2564] = R[2607]; R[2566] = R[2608]; //trouble time
write_check = WriteRecordByIndex(Handle, 1, S[97], FDBM_FIND);
if( write_check < 0) WriteRecordByIndex(Handle, 1, S[97], FDBM_ADD);
Sound(1000,100);
CloseDbase(Handle);
}

void Read_data( void )
{
int read_check = 0;
Handle = OpenDbase("DATA.DBF", MODE_RDWR);
sprintf( S[97], "%04d/%02d/%02d", R[4], R[5], R[6] ); //from date
read_check = ReadRecordByIndex( Handle, 1, FDBM_FIND, S[97] );

if( read_check >= 0)
{
L[101] = R[2553];
L[160] = ( R[2555] * 3600) + ( R[2557] * 60); //running time
L[161] = ( R[2559] * 3600) + ( R[2561] * 60); //trouble time
L[162] = ( R[2563] * 3600) + ( R[2565] * 60); //stop time
}
CloseDbase(Handle);
}

void get_change_device(void)
{
int i, j, chk_read;
char top_bot[3], key[5];
FILE *fp;
fp = fopen("FRAME.DAT", "r");
if ( fp != NULL)
{
fscanf( fp, "%2d", &R[1201] ); //CURRENT JOB DEVICE
old_device = R[1201];
TOP_BOT = R[1201] - 10;
if ( TOP_BOT < 0 )
{
R[261] = 1; //TOP
R[95] = R[94] = R[1201];
}
else
{
R[261] = 2; //BOT
R[95] = R[94] = R[1201] - 10;
}
}
else
strcpy(S[120], "FRAME Not Found");
fclose(fp);
Read_device();

if ( R[2] != 5 && R[2] != 12 && R[2] != 10)
Handle2 = OpenDbase("DEVICE.DBF", MODE_RDWR);
if ( Handle2 < 0)
CopyDbaseStructure("DEVICE_S.DBF", "DEVICE.DBF");
sprintf( key, "%d", R[95] );
chk_read = ReadRecordByIndex(Handle2, 1, FDBM_FIND, key);
if ( chk_read > 0 )
{
strcpy( S[120], S[200] ); //DEVICE TYPE( KEY )
for ( i = 0, j = 0; i < 33; i ++, j+=2 )
A[101+i] = A[151+j]; //ACCEL, VELOCITY, DISTANCE
}
else
{
chk_read = ReadRecordByIndex(Handle2, 1, FDBM_FIRST, NULL);
if ( chk_read > 0 )
{
strcpy( S[120], S[200] ); //DEVICE TYPE( KEY )
for ( i = 0, j = 0; i < 33; i ++, j+=2 )
A[101+i] = A[151+j]; //ACCEL, VELOCITY, DISTANCE
}
}
if ( R[2] != 5 && R[2] != 12 && R[2] != 10) //DEVICE, DEVICE1, CNCEDIT SCREEN
CloseDbase( Handle2 );
trans_frame();
}

void Initialize( void )
{
int i, j, chk_read;
char top_bot[3], key[5];
FILE *fp;
old_year = R[2621] = sys_year;
old_month = R[2622] = sys_month;
old_day = R[2623] = sys_day;
old_hour = sys_hour;
old_min = sys_min;
old_sec = sys_sec;
get_change_device();
if ( R[62] == 1 ) // Vision Mark ON
R[70] = 1;
else
R[70] = 2;
if ( R[64] == 1 ) // Vision I.D ON
R[71] = 1;
else
R[71] = 2;

first = 0;
}

char rcv_buffer[256];
int trans_char(char *message)
{

int n, i;
int pgm_len = 1372;

RcvMessage(MOTOR, rcv_buffer, 255); // buffer flush
n = strlen(message);

for ( i = 0; i < n; i++)
{
XmitMessage(MOTOR, &message[i], 1);
//printf("%c", message[i]);
Sound(0,10);
RcvMessage(MOTOR, rcv_buffer, 255);
A[200]++;
if (R[265] == 1)
SolidBox(15,174, 15 + (int)(( A[200] / pgm_len) * 295.0), 185, BLUE);
else if (R[265] == 2)
SolidBox(88,193, 88 + (int)(( A[200] / pgm_len) * 295.0), 208, BLUE);
if ( rcv_buffer[0] != message[i] )
{
Sound(500, 200);
return -1;
}
}
return 0;
}

int motor_down_load( void )
{
int i = 0, chk_load = 0;

for ( i = 0; i < 8; i ++ ) //DEVICE FRAME
{
if ( trans_char( S[221+i] ) == -1 )
{
chk_load = 1;
goto EXIT;
}
}
if ( R[261] == 1 ) //DETECT TOP FRAME
{
for ( i = 0; i < 8; i ++ )
{
if ( trans_char( S[229+i] ) == -1 )
{
chk_load = 1;
goto EXIT;
}
}
}
else
{ //DETECT BOT FRAME
for ( i = 0; i < 8; i ++ )
{
if ( trans_char( S[237+i] ) == -1 )
{
chk_load = 1;
goto EXIT;
}
}
}

for ( i = 0; i < 16; i ++ ) //MARK, VISION, ON&OFF LOAD MGZ FRAME
{
if ( trans_char( S[245+i] ) == -1 )
{
chk_load = 1;
goto EXIT;
}
}
EXIT:
A[200] = 0;
if (R[265] == 1)
SolidBox(15,174, 380, 185, LIGHTGRAY);
else if (R[265] == 2)
SolidBox(88,193, 263, 208, LIGHTGRAY);
if ( chk_load == 0 )
{
strcpy( S[35], " aža b ža –s“”a." ); //Down Load Success
return 1;
}
else
{
strcpy( S[35], " aža b ́ –s“”a." ); //Down Load Fail
return 0;
}
}

void Cnc_edit_screen( void )
{
char fname[15];
FILE *fp;
int i;
push_button( 225, 48, 49 ); //START
push_button( 226, 50, 51 ); //STOP
push_button( 227, 52, 53 ); //REESET
if ( R[265] == 1 ) //down load button
{
strcpy( S[30], "PLEASE WAIT MOTOR DOWN LOADING.." );
motor_down_load();
R[265] = 0;
}

if ( cnc_reflash)
{
cnc_reflash = 0;
SetBrowse("CNCEDIT", BRWS_OPEN, 0, 0L);
SetBrowse("CNCEDIT", BRWS_ACTIVATE, 0, 0L);
SetBrowse("CNCEDIT", BRWS_REFLASH, 0, 0L);
SetBrowse("CNCEDIT", BRWS_INACTIVATE, 0, 0L);
SetBrowse("CNCEDIT", BRWS_CLOSE, 0, 0L);
}

if ( R[162] == 1 && active == 0) //Edit Button On
{
active = 1;
SetBrowse("CNCEDIT", BRWS_OPEN, 0, 0L);
SetBrowse("CNCEDIT", BRWS_ACTIVATE, 0, 0L);
}

if ( R[162] != 1 && active == 1) //Edit Button Off
{
active = 0;
SetBrowse("CNCEDIT", BRWS_INACTIVATE, 0, 0L);
SetBrowse("CNCEDIT", BRWS_CLOSE, 0, 0L);
}
if ( R[1032] == 1 ) //Device Change End ( M920 )
strcpy( S[50], "DEVICE CHANGE SUCCESS" );
}

int JAM_NO = 0;
long err_blink[15];
void Get_error( void )
{
int i, read_check = 0;
char nalja[9];
char temp_key[15];

if ( R[1200] > 0 && error_one == 0 ) //D0000 ERROR EVENT
{
JAM_NO = R[1200];
Stop_on = 1;
Handle = OpenDbase("ERROR.DBF", MODE_RDWR);
if ( Handle >= 0)
{
sprintf(S[85], "%4d", R[1200]);
read_check = ReadRecordByIndex( Handle, 1, FDBM_FIND, S[85] );
if ( read_check >= 0 )
{
sprintf( S[215], "E-%03d", R[1200] );
strcpy( S[211], S[86] ); //error message
strcpy( S[212], S[88] );
strcpy( S[213], S[90] );
strcpy( S[214], S[92] );
}
CloseDbase(Handle);
Hdb = OpenDbase("JAM.DBF", MODE_RDWR);
if ( Hdb >= 0)
{
sprintf( S[97], "%4d", R[1200]); //error-no
sprintf( nalja, "%04d/%02d/%02d", R[4], R[5], R[6]);
strcpy( S[95], nalja ); //error-date
sprintf( temp_key, "%s%s", nalja, S[97]); //date
read_check = ReadRecordByIndex( Hdb, 0, FDBM_FIND, temp_key );
if ( read_check >= 0 )
R[2002] = R[2001] + 1; //count add
else
R[2002] = 1;
WriteRecordByIndex(Hdb, 0, temp_key, FDBM_ADD);

Sound(1000,100);
CloseDbase(Hdb);
old_screen1 = R[2];

R[100] = 9; //error display screen
}
}
error_one = 1;
}
if ( R[1200] == 0 )
{
strcpy( S[215], NULL );
strcpy( S[211], NULL );
strcpy( S[212], NULL );
strcpy( S[213], NULL );
strcpy( S[214], NULL );
error_one = 0;
}
}

void sec_change( void )
{
if ( R[1081] == 1 ) L[160]++;
if ( R[1082] == 1 ) L[161]++;
if ( R[1083] == 1 ) L[162]++;

R[2603] = (int) ( L[160] % 60); //running time second
R[2602] = (int) ( (L[160] / 60) % 60); // minute
R[2601] = (int) ( L[160] / 3600 ); // hour

R[2606] = (int) ( L[161] % 60); //trouble time
R[2605] = (int) ( (L[161] / 60) % 60);
R[2604] = (int) ( L[161] / 3600);

R[2609] = (int) ( L[162] % 60); //stop time
R[2608] = (int) ( (L[162] / 60) % 60);
R[2607] = (int) ( L[162] / 3600);
}

void A1_to_B16(int a_m, int b_m)
{
int i;
for(i = 0; i < 16; i++)
R[b_m + i] = ( (R[a_m] >> i) & 0x0001);
}

void Logo_screen(void)
{
;
}


int SND[10] = {0,0};
void button_process(int snd, int btn, int rtn, int com1, int com2, int screen)
{
if(R[btn] == 1) {
R[btn] = 999;
if(!SND[snd])
{
SendIO(PLC, com1);
ReadComm(PLC, // Port
0,0,0,0, // Stn No. 1-4
1, // BIT
"M", // Rem. ID
2096, // Rem. Index
16, // NoOfData
'R', // LocalID
1400, // LocalIndex
0); // Notify Memory
}
}

if(!SND[snd] && R[rtn] == 1){
SendIO(PLC, com2);
SendIO(PLC, com2);
SND[snd] = 1;
}

if(SND[snd] && R[rtn] == 0){
SND[snd] = 0;
// R[100] = screen;
R[btn] = 0;
}
}

void Main_menu_screen(void)
{
// push_pull( int btn, int r_m, int value, int comm)
push_pull( 101, 301, 1, 1 ); //Power On
push_pull( 102, 301, 0, 1 ); //Power Off
}
int Start_on, vision_on, vision_off, vision_id_on, vision_id_off = 0;
void Auto_mode_screen(void)
{
push_button( 240, 54, 55 ); //AIR
// push_button( 225, 48, 49 ); //START
// button_process(int snd, int btn, int rtn, int com1, int com2, int screen)
button_process( 0, 225, 1406, 48, 49, 3 );
if ( R[70] == 1 && vision_on == 0 )
{
R[70] = 0;
SendIO(PLC, 44 ); //VISION MARK ON M82C
vision_on = 1;
vision_off = 0;
}
if ( R[70] == 2 && vision_off == 0 )
{
R[70] = 0;
SendIO(PLC, 45 ); //VISION MARK OFF
vision_on = 0;
vision_off = 1;
}

if ( R[71] == 1 && vision_id_on == 0 )
{
R[71] = 0;
SendIO(PLC, 65 ); //VISION I.D ON M82E
vision_id_on = 1;
vision_id_off = 0;
}
if ( R[71] == 2 && vision_id_off == 0 )
{
R[71] = 0;
SendIO(PLC, 66 ); //VISION I.D OFF
vision_id_on = 0;
vision_id_off = 1;
}

//push_button( 226, 50, 51 ); //STOP
if ( R[226] == 1 )
{
R[226] = 999;
SendIO( PLC, 50 ); //STOP ON ( M837 )
}
if ( R[226] == 2 )
{
R[226] = 0;
SendIO( PLC, 51 ); //STOP OFF ( M837 )
SendIO( PLC, 51 );
ReadComm(PLC, // Port
0,0,0,0, // Stn No. 1-4
1, // BIT
"M", // Rem. ID
2096, // Rem. Index
16, // NoOfData
'R', // LocalID
1400, // LocalIndex
0); // Notify Memory
}

push_button( 227, 52, 53 ); //REESET
if ( R[251] == 1 ) // Product AREA BUTTON
{
strcpy( S[210], "PRODUCT DATAŸi bAaae YESŸi ’Ÿa" );
if ( R[253] == 1 )
{
R[253] = 999;
SendIO( PLC, 58 ); //M811 ON
L[164] = 0;
}
if ( R[253] == 2 )
{
R[253] = 0;
SendIO( PLC, 59 ); //M811 OFF
R[251] = 0;
}
}
else
S[210][0] = '\0';
if ( R[252] == 1 ) // Total AREA BUTTON
{
strcpy( S[210], "TOTAL DATAŸi bAaae YESŸi ’Ÿa" );
if ( R[254] == 1 )
{
R[254] = 999;
SendIO( PLC, 60 ); //M812 ON
L[163] = 0;
}
if ( R[254] == 2 )
{
R[254] = 0;
SendIO( PLC, 61 ); //M812 OFF
R[252] = 0;
}
}
if ( R[255] == 1 )
{
if ( R[256] == 1 ) //RUNNING TIME CLEAR YES
{
R[255] = R[256] = 0;
L[160] = 0;
}
if ( R[256] == 2 )
R[255] = R[256] = 0; //NO
}
if ( R[255] == 2 )
{
if ( R[256] == 3 ) //TROUBLE TIME CLEAR YES
{
R[255] = R[256] = 0;
L[161] = 0;
}
if ( R[256] == 4 )
R[255] = R[256] = 0; //NO
}
if ( R[255] == 3 )
{
if ( R[256] == 5 ) //STOP TIME CLEAR YES
{
R[256] = 0;
R[255] = 0;
L[162] = 0;
}
if ( R[256] == 6 )
R[255] = R[256] = 0; //NO
}

if ( R[1406] == 0 && R[1079] == 1 ) //M94F ON && M836 OFF(start signal)
{
Start_on = 0;
R[100] = 3; //GOTO Auto Run Screen
}
if( R[1064] == 1 )
strcpy ( S[210], "AIR SWITCHŸi ’Ÿa" );
else if( R[1065] == 1 )
strcpy ( S[210], "LASER STANDBY wȁˆa a““”a." );
else if( R[1066] == 1 )
strcpy ( S[210], "VISION STANDBY wȁˆa a““”a." );
else if( R[1067] == 1 )
strcpy ( S[210], "SAFETY DOORˆa ia s“”a." );
else if( R[1094] == 1 )
strcpy ( S[210], "VISION I.D w‰—wi ˆa." );
else if( R[1095] == 1 )
strcpy ( S[210], "VISION MARK w‰—wi ˆa" );
else if( R[1068] == 1 )
strcpy ( S[210], "RESET SWITCHŸi ’Ÿa" );
else if( R[1069] == 1 )
strcpy ( S[210], "START SWITCHŸi ’Ÿa");
else if( R[1070] == 1 )
strcpy ( S[210], "b ža–As“”a.");
else
S[210][0] = '\0';
}

void Auto_run_screen(void)
{
// push_button( 226, 50, 51 ); //STOP

button_process( 1, 226, 1407, 50, 51, 2 ); //STOP
push_button( 227, 52, 53 ); //REESET
push_button( 211, 24, 25 ); //EJECT STOPPER R[211]

if ( R[1023] == 1 || ( R[1079] == 0 && R[1407] == 0) ) //M917( Job End ) OR M94F OFF
{
Save_device();
R[100] = 2; //GOTO Auto Mode Screen
}
}
void Manual_mode_screen( void )
{
// push_button(int btn, int com1, int com2)
push_button( 200, 2, 3 ); //OFF LOAD M.G.Z R[200]
push_button( 201, 4, 5 ); //OFF LOAD PICK UP CYCLE R[201]
push_button( 202, 6, 7 ); //OFF LOAD PICK UP 1 STEP R[202]
push_button( 203, 8, 9 ); //OFF LOAD FINGER R[203]
push_button( 204, 10, 11 ); //OFF LOAD ELEVATOR UP R[204]
push_button( 205, 12, 13 ); //OF LOAD ELEVATOR DOWN R[205]
push_button( 206, 14, 15 ); //CONVEYOR R[206]
push_button( 207, 16, 17 ); //DETECTOR R[207]
push_button( 208, 18, 19 ); //PRE STOPPER R[208]
push_button( 209, 20, 21 ); //M/K STOPPER R[209]
push_button( 210, 22, 23 ); //VISION STOPPER R[210]
push_button( 211, 24, 25 ); //EJECT STOPPER R[211]
push_button( 212, 26, 27 ); //M/K CLAMP R[212]
push_button( 213, 28, 29 ); //LOAD M.G.Z R[213]
push_button( 214, 30, 31 ); //LOAD PICK UP CYCLE R[214]
push_button( 215, 32, 33 ); //LOAD PICK UP 1 STEP R[215]
push_button( 216, 34, 35 ); //LOAD FINGER R[216]
push_button( 217, 36, 37 ); //LOAD ELEVATOR UP R[217]
push_button( 218, 38, 39 ); //LOAD ELEVATOR DOWN R[218]
push_button( 219, 40, 41 ); //MANUAL 1CYCLE R[219]
push_button( 220, 42, 43 ); //MARK R[220]
push_button( 221, 44, 45 ); //LASER R[221]
push_button( 222, 46, 47 ); //AIR R[222]
push_button( 225, 48, 49 ); //START
push_button( 226, 50, 51 ); //STOP
push_button( 227, 52, 53 ); //REESET
push_button( 230, 63, 64 ); //INITIALIZE
}

void Device_mode_screen( void )
{
int i, j, chk_read, load_success = 0;
char key[5];
// push_button( 225, 48, 49 ); //START
if( R[225] == 1)
{
S[35] = '\0';
R[225] = 999;
SendIO(PLC, 48); //ON
SendIO(PLC, 48); //ON
}
if( R[225] == 2)
{
R[225] = 0;
SendIO(PLC, 49); //OFF
SendIO(PLC, 49); //OFF
}
push_button( 226, 50, 51 ); //STOP
push_button( 227, 52, 53 ); //REESET

if ( R[224] == 1 ) //save button
{
chk_read = ReadRecordByIndex(Handle2, 2, FDBM_FIND, S[120]); //name key
if ( chk_read > 0 )
{
R[95] = R[94];
}
else
{
chk_read = ReadRecordByIndex(Handle2, 1, FDBM_LAST, NULL);//no key
if ( chk_read > 0 )
R[94]++;
else
R[94] = 1;
R[95] = R[94]; //NO ( KEY )
}
sprintf( key, "%d", R[95] );
R[224] = 0;
strcpy( S[201], S[120] ); //DEVICE TYPE( KEY )
for ( i = 0, j = 0; i < 33; i ++, j+=2 )
A[152+j] = A[101+i]; //ACCEL, VELOCITY, DISTANCE
WriteRecordByIndex(Handle2, 1, key, FDBM_ADD);
trans_frame();
frame_dat_save(); //Current selected frame
Sound(800, 200 );
}
if ( R[260] == 1) //Frame Type Button
{
if ( R[263] == 1 ) //Up Button
{
R[263] = 0;
device_up();
}
if ( R[264] == 1 ) //Down Button
{
R[264] = 0;
device_down();
}
}
else
R[263] = R[264] = 0;

if ( R[1032] == 1 ) //Device Change End ( M920 )
{
strcpy( S[35], "—aa ŠaA ža –s“”a." );
R[88] = R[94];
SendIO( PLC, 62 ); //DEVICE TYPE
R[1032] = 0;
}
if ( R[265] == 1 ) //down load button
{
#if TEMP1
if ( R[94] > 4 )
#endif

motor_down_load();
R[265] = 0;
}

// if ( R[1024] == 1 ) //M918 INTERNAL DEVICE CHANGE( MANUAL )
if ( R[1025] == 1 ) //M919 EXTERNAL DEVICE CHANGE( AUTO )
{
if ( CHANGE_OK == 1 )
{
load_success = motor_down_load();
if ( load_success == 1 && R[1200] == 0 ) //No Error
{
SendIO( PLC, 48 );
SendIO( PLC, 48 ); //ON
SendIO( PLC, 49 ); //OFF
SendIO( PLC, 49 );
}
load_success = 0;
CHANGE_OK = 0;
}
}
}

void Device1_mode_screen( void )
{
int i, j, chk_read = 0;
char key[5];
push_button( 225, 48, 49 ); //START
push_button( 226, 50, 51 ); //STOP
push_button( 227, 52, 53 ); //REESET

if ( R[224] == 1 ) //save button
{
chk_read = ReadRecordByIndex(Handle2, 2, FDBM_FIND, S[120]); //name key
if ( chk_read > 0 )
{
R[95] = R[94];
}
else
{
chk_read = ReadRecordByIndex(Handle2, 1, FDBM_LAST, NULL);//no key
if ( chk_read > 0 )
R[94]++;
else
R[94] = 1;
R[95] = R[94]; //NO ( KEY )
}
sprintf( key, "%d", R[95] );
R[224] = 0;
strcpy( S[201], S[120] ); //DEVICE TYPE( KEY )
for ( i = 0, j = 0; i < 33; i ++, j+=2 )
A[152+j] = A[101+i]; //ACCEL, VELOCITY, DISTANCE
WriteRecordByIndex(Handle2, 1, key, FDBM_ADD);
trans_frame();
frame_dat_save(); //Current selected frame
Sound(800, 200 );
}
if ( R[260] == 1) //Frame Type Button
{
if ( R[263] == 1 ) //Up Button
{
R[263] = 0;
device_up();
}
if ( R[264] == 1 ) //Down Button
{
R[264] = 0;
device_down();
}
}
else
R[263] = R[264] = 0;

if ( R[1032] == 1 ) //Device Change End ( M920 )
strcpy( S[50], "—aa ŠaA ža –s“”a." );

if ( R[265] == 2 ) //down load button
{
motor_down_load();
R[265] = 0;
}


}

int JAM_FLAG=0;
void Error_blink( int num, int blink )
{
if ( err_blink[num] < L[1] && !JAM_FLAG)
{
err_blink[num] = L[1]+9;
R[blink] = 2;
JAM_FLAG = 1;
}
if ( err_blink[num] < L[1] && JAM_FLAG)
{
err_blink[num] = L[1]+9;
R[blink] = 1;
JAM_FLAG = 0;
}
}
int Reset_on = 0;
char *On_Reset= " F 5E Z ";
char *Off_Reset= " F 6E Z ";
void Error_display_screen( void )
{
// push_button( 227, 52, 53 ); //RESET //M838
if ( R[227] == 1 )
{
if ( R[1200] == 2 )
trans_char( On_Reset );
if ( R[1200] == 33 )
trans_char( Off_Reset );
R[227] = 999;
SendIO( PLC, 52 ); //RESET ON //M838
}
if ( R[227] == 2 )
{
R[227] = 0;
SendIO( PLC, 53 ); //RESET OFF //M838
SendIO( PLC, 53 ); //RESET OFF //M838
Reset_on = 1;
}
if ( R[1408] == 0 && R[1200] == 0 && Reset_on == 1 ) //Not error && M838 OFF
{
Reset_on = 0;
S[215][0] = '\0';
S[211][0] = '\0'; S[212][0] = '\0'; S[213][0] = '\0';
if ( old_screen1 == 3 ) //auto run screen
R[100] = 2;
else if ( R[1] == 5 ) R[100] = 4;
else R[100] = old_screen1;
}

switch ( JAM_NO ) {
case 4: Error_blink( 13, 2714 ); break;
case 1: case 2: case 3: case 5: case 6: case 7: case 8: case 9: Error_blink( 0, 2701 ); break;
case 10: case 11: case 12:case 13: case 14: Error_blink( 1, 2702 ); break;
case 15: Error_blink( 2, 2703 ); break;
case 16: Error_blink( 3, 2704 ); break;
case 17: Error_blink( 4, 2705 ); break;
case 18: Error_blink( 5, 2706 ); break;
case 19: Error_blink( 6, 2707 ); break;
case 20: Error_blink( 7, 2708 ); break;
case 21: Error_blink( 8, 2709 ); break;
case 22: Error_blink( 9, 2710 ); break;
case 24: case 25: case 26: case 27: case 28: Error_blink( 10, 2711 ); break;
case 29: Error_blink( 11, 2712 ); break;
case 30: case 31: case 32:case 33: case 34: Error_blink( 12, 2713 ); break;
default: break;
}
}

void Emergency_screen(void)
{
if ( R[1080] == 0 )
{
if ( R[1] == 0 )
R[0] = 0;
else
{
Stop_on = 1;
R[100] = R[1]; //GOTO PREVIOUS SCREEN
}
}
}

void Membrane_SW_Action(void)
{
FRONT_SWITCH = inportb( MEMBRANE_SWITCH );
switch ( FRONT_SWITCH )
{
case 254 : Sound( 300, 100 ); R[100] = 2; break; //AUTO
case 253 : Sound( 400, 100 ); R[100] = 4; break; //MANUAL
case 251 : Sound( 500, 100 ); R[100] = 5; break; //DEVICE
case 247 : Sound( 600, 100 ); R[100] = 10; break; //CNCEDIT
case 239 : Sound( 700, 100 ); break;
case 223 : Sound( 800, 100 ); break;
case 191 : Sound( 900, 100 ); break;
case 127 : Sound( 1000, 100 ); break;
default: break;
}
}

void Pass_screen(void)
{
long Pass_No = 199602;

if ( R[1500] == 1 ) // Keybord
{
R[1508] = 0;
R[1500] = 0;
if ( R[1505] < 6 )
{
R[1505] ++;
R[1510 + R[1505]] = 1;
}
}

if ( R[1504] == 1 ) // Backspace Key
{
R[1504] = 0;
if ( R[1505] > 0 )
{
R[1510 + R[1505]] = 0;
R[1505] --;
}
}

if ( R[1501] == 1 ) // ea Š
{
L[160] = 0;
R[1501] = 0;
R[1505] = R[1506] = R[1507] = R[1508] = 0;
R[1510] = 0;
R[1511] = R[1512] = R[1513] = R[1514] = R[1515] = R[1516] = 0;
S[110][0] = '\0';
R[0] = FPrevScreen;
}

if ( R[1502] == 1 ) // Password b Button
{
strcpy( S[110], "PASSWORDŸi baҁ ·i ’Ÿa.." );
L[160] = 0;
R[1502] = R[1505] = 0;
R[1506] = R[1507] = 0;
R[1510] = 1;
R[1511] = R[1512] = R[1513] = R[1514] = R[1515] = R[1516] = 0;
}

if( R[1503] == 1 ) // Password Ša
{
R[1503] = 0;
R[1510] = 0;

if ( Pass_No == L[160] )
{
strcpy( S[110], "DEVICE BUTTONi ’Ÿae DEVICE ea •..");
R[1506] = 1;
Pass_OK = 1;
}
else if ( Pass_No != L[160] )
{
strcpy( S[110], "PASSWORD BUTTONi ’Ÿa ҁ b aa.." );
R[1507] = 1;
Pass_OK = 0;
}
}

if ( R[1509] == 1 ) // Device Screen
{
R[1509] = 0;
if ( Pass_OK == 1 )
{
R[1505] = 0;
R[1511] = R[1512] = R[1513] = R[1514] = R[1515] = R[1516] = 0;
R[1506] = R[1507] = 0;
L[160] = 0;
S[110][0] = '\0';
R[100] = 5;
} else if ( Pass_OK == 0 )
{
strcpy( S[110], "ѡˆa *xga ea • ‰ˆa..");
}
Pass_OK = 0;
}
}

void UserMain(void)
{
if ( first == 1 ) Initialize();
// gotoxy( 10, 20);
// printf ("R1410 = %d || R[1000]->%d", R[1410], R[1000] );
push_change_screen( 100 ); //R[100] = Change Screen Number
Dbf_file_open_close(); //Auto DBF File Open Close

if ( R[1508] == 1 ) // Password Screen
{
L[160] = 0;
strcpy( S[110], "PASSWORD BUTTONi ’Ÿa ҁ ba..");
R[0] = 13;
}

if ( R[1080] == 1 ) //M950 ON
R[100] = 11; //GOTO EMERGENCY SCREEN

L[100] = L[164] + ( R[1204] * 10000 ) + R[1203]; //Product count
L[101] = L[163] + ( R[1206] * 10000 ) + R[1205]; //Total count
Membrane_SW_Action();

if ( R[1025] == 1 ) //M919 EXTERNAL DEVICE CHANGE( AUTO )
{
if ( R[1201] != old_device && R[1410] == 1 && R[1000] == 1 ) //D2 POWER ON & AIR ON
{
TOP_BOT = R[1201] - 10;
if ( TOP_BOT < 0 )
{
R[261] = 1; //TOP
R[94] = R[1201];
}
else
{
R[261] = 2; //BOT
R[94] = R[1201] - 10;
}
old_device = R[1201];
frame_dat_save();
Save_device();
get_change_device();
CHANGE_OK = 1;
if ( R[2] != 5 )
R[100] = 5;
}
}

Get_error();

if ( old_sec != R[9])
{
old_sec = R[9];
sec_change();
}

switch ( R[2] )
{
case 0 : Logo_screen();
break;
case 1 : Main_menu_screen();
break;
case 2 : Auto_mode_screen();
break;
case 3 : Auto_run_screen();
break;
case 4 : Manual_mode_screen();
break;
case 5 : Device_mode_screen();
break;
case 6 : Error_menu_screen();
break;
case 7 : Jam_list_screen();
break;
case 8 : Error_input_screen();
break;
case 9 : Error_display_screen();
break;
case 10 : Cnc_edit_screen();
break;
case 11 : Emergency_screen();
break;
case 12 : Device1_mode_screen();
break;
case 13 : Pass_screen();
break;
default : break;
}
}
amigo is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:24 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2