You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
Thread Tools Display Modes
Unread January 26th, 2009, 09:58 AM   #1
johnfarrugi
Member
Canada

johnfarrugi is offline
 
Join Date: Mar 2008
Location: London
Posts: 99
Troubleshooting basic code

I am trying to trouble shoot some basic code. Every time I trigger the basic code to execute in the 1746-BAS, the ACT led on the front of the module goes from solid to blinking. I'm pretty sure solid is run mode and blinking is either fault or program. How can I determine which line in the code is cause the error? I am using both ports on the BAS card. There are two different printers connected to the card. When I trigger one printer to print, all works fine. Anytime I try and trigger the second printer to print, the BAS faults. The only way to reset it is to power down the PLC or use hyperterminal to connect and type RUN.

Any trouble shooting suggestion?
  Reply With Quote
Unread January 27th, 2009, 12:02 AM   #2
chavak
Member
Malaysia

chavak is offline
 
chavak's Avatar
 
Join Date: Jul 2002
Posts: 633
Hi,

I have never worked with basic modules, so the suggestions are general

Check the Controller property -> where does the program error occur, which display which ladder/rung cause the error.

Comment out the effected lines/lines there after and switch in one by one to troubleshoot the errors.

Best Regards
____________
  Reply With Quote
Unread January 27th, 2009, 07:16 AM   #3
johnfarrugi
Member
Canada

johnfarrugi is offline
 
Join Date: Mar 2008
Location: London
Posts: 99
The error occurs within the basic code and not in the PLC processor. As to which line in the code is causing the error, I'm not sure. Thats what I am trying to figure out. Any suggestions?
  Reply With Quote
Unread January 27th, 2009, 07:34 AM   #4
Christoff84
Lifetime Supporting Member + Moderator
Canada

Christoff84 is online now
 
Christoff84's Avatar
 
Join Date: Jun 2006
Location: Cambridge, ON
Posts: 394
I've never worked with a BAS card, although we have one here. I would assume the card can read/write to the PLC registers. One thing I generally do when writing code is put in an error handler, something like this.

Sub Fake()
OnError goto ErrHandler
...
<code>
...
Exit Sub
ErrHandler:
<however you write to registers> = Err.Line (Int)
<If you want to write a string register> = Err.desciption (String)
<if you want the numeric error code> = Err.code (Float)
End Sub

Using that you should be able to track down whats going on. Just from memory though, I thought 1 port on the BAS was a programming port and the other was a printing port...could it just be you're not allowed to use the programming port to print?
  Reply With Quote
Unread January 27th, 2009, 07:40 AM   #5
johnfarrugi
Member
Canada

johnfarrugi is offline
 
Join Date: Mar 2008
Location: London
Posts: 99
There are 2 rs232 ports and one DH485 port. The two rs232 ports are being used to connect to external printers. I have never been able to figure out what the DH485 port is for. Maybe that is the programming port and might give me a line error if I can figure out how to connect.
  Reply With Quote
Unread January 27th, 2009, 08:54 AM   #6
Christoff84
Lifetime Supporting Member + Moderator
Canada

Christoff84 is online now
 
Christoff84's Avatar
 
Join Date: Jun 2006
Location: Cambridge, ON
Posts: 394
I took a look at the manual for the BAS module and it looks like a blinking LED means it's in command mode, not run mode, which is what you are seeing. This could be an unhandled error in the program (divide by 0 or something similar). Without seeing the actual code it would be harder to find.

You might get away with connecting hyperterminal to the PLC and typing RUN, if you leave it connected you might see the STOP point and which line it was on.
  Reply With Quote
Unread January 27th, 2009, 09:04 AM   #7
johnfarrugi
Member
Canada

johnfarrugi is offline
 
Join Date: Mar 2008
Location: London
Posts: 99
Here is the code in my basic card. I tried to figure out a few of the Calls but even with the manual by my side these calls don't make much sense. The issues is only in the shipping label and not in the part label. Shipping label prints when SLC1=2 and part label prints when SLC1=1

Please explain Call62
Example:
620 PUSH JUL
630 PUSH 25
640 CALL 62


10 MODE (PRT1,9600,N,8,1,N,)
20 MODE (PRT2,9600,N,8,1,N,)
30 STRING 4000,100
40 TIME=0
50 CLOCK 1
60 ONTIME 30,1840
70 IDLE
80 PUSH 13
90 CALL 56
100 POP S
110 PUSH 100
120 CALL 14
130 POP SLC0
140 PUSH 101
150 CALL 14
160 POP SLC1
170 PUSH 102
180 CALL 14
190 POP SLC2
200 PUSH 103
210 CALL 14
220 POP SLC3
230 PUSH 104
240 CALL 14
250 POP SLC4
260 PUSH 105
270 CALL 14
280 POP SLC5
290 PUSH 106
300 CALL 14
310 POP SLC6
320 PUSH 107
330 CALL 14
340 POP SLC7
350 PUSH 108
360 CALL 14
370 POP SLC8
380 PUSH 109
390 CALL 14
400 POP SLC9
410 PUSH 110
420 CALL 14
430 POP SLC10
440 PUSH 111
450 CALL 14
460 POP SLC11
470 PUSH 112
480 CALL 14
490 POP SLC12
500 PUSH SLC6
510 PUSH 3
520 CALL 62
530 $(4)="20"
540 PUSH 3
550 PUSH 4
560 CALL 67
570 IF SLC1=0 THEN SCLPRT=0
580 IF SLC1=1.AND.SCLPRT=0 THEN GOTO 610
590 IF SLC1=2.AND.SCLPRT=0 THEN GOTO 610
600 GOTO 80
610 IF SLC1=1 GOSUB 1530
620 PUSH JUL
630 PUSH 25
640 CALL 62
650 IF SLC2=1 THEN $(12)="068T-W0113"
660 IF SLC2=1 THEN $(21)="FORD 7L24-2450-AB"
670 IF SLC2=1 THEN $(22)="XX"
680 IF SLC2=1 THEN $(23)="XXX"
690 IF SLC2=1 THEN $(1)="XXXX" : GOTO 1010
700 IF SLC2=2 THEN $(12)="WRONG"
710 IF SLC2=2 THEN $(21)="FORD 8L24-2450-BB"
720 IF SLC2=2 THEN $(22)="XX"
730 IF SLC2=2 THEN $(23)="XXX"
740 IF SLC2=2 THEN $(1)="XXXX" : GOTO 1010
750 IF SLC2=3 THEN $(12)="WRONG"
760 IF SLC2=3 THEN $(21)="X"
770 IF SLC2=3 THEN $(22)="XX"
780 IF SLC2=3 THEN $(23)="XXX"
790 IF SLC2=3 THEN $(1)="XXXX" : GOTO 1010
800 IF SLC2=4 THEN $(12)="WRONG"
810 IF SLC2=4 THEN $(21)="X"
820 IF SLC2=4 THEN $(22)="XX"
830 IF SLC2=4 THEN $(23)="XXX"
840 IF SLC2=4 THEN $(1)="XXXX" : GOTO 1010
850 IF SLC2=5 THEN $(12)="WRONG"
860 IF SLC2=5 THEN $(21)="X"
870 IF SLC2=5 THEN $(22)="XX"
880 IF SLC2=5 THEN $(23)="XXX"
890 IF SLC2=5 THEN $(1)="XXXX" : GOTO 1010
900 IF SLC2=6 THEN $(12)="WRONG"
910 IF SLC2=6 THEN $(21)="X"
920 IF SLC2=6 THEN $(22)="XX"
930 IF SLC2=6 THEN $(23)="XXX"
940 IF SLC2=6 THEN $(1)="XXXX" : GOTO 1010
950 IF SLC2=7 THEN $(12)="WRONG"
960 IF SLC2=7 THEN $(21)="X"
970 IF SLC2=7 THEN $(22)="XX"
980 IF SLC2=7 THEN $(23)="XXX"
990 IF SLC2=7 THEN $(1)="XXXX" : GOTO 1010 ELSE GOTO 1000
1000 $(21)="UNKNOWN" : $(12)="UNKNOWN" : $(22)="UNKNOWN"
1010 IF SLC1=2 THEN GOTO 1860
1020 REM ******************************PART LABEL****************
1030 PUSH JUL
1040 PUSH 13
1050 CALL 62
1060 $(15)="0"
1070 $(20)="00"
1080 PUSH 13
1090 CALL 68
1100 POP SL
1110 IF SL>2 THEN GOTO 1230
1120 IF SL>1 THEN GOTO 1180
1130 PUSH 13
1140 PUSH 20
1150 CALL 61
1160 $(14)=$(20)
1170 GOTO 1240
1180 PUSH 13
1190 PUSH 15
1200 CALL 61
1210 $(14)=$(15)
1220 GOTO 1240
1230 $(14)=$(13)
1240 PUSH 3
1250 PUSH 14
1260 CALL 61
1270 PRINT #"^XA"
1280 PRINT #"^MCY"
1290 PRINT #"^XZ"
1300 PRINT #"^XA"
1310 PRINT #"^FWN^CFD,24^PW324^LH0,0"
1320 PRINT #"^CI0^PR2^MNY^MTT^MMP^MD0^PON^PMN^LRN"
1330 PRINT #"^XZ"
1340 PRINT #"^XA"
1350 PRINT #"^MCY"
1360 PRINT #"^XZ"
1370 PRINT #"^XA"
1380 PRINT #"^DFR:TEMP_FMT.ZPL"
1390 PRINT #"^LRN"
1400 PRINT #"^A0N,23,24^FO32,41^FD",$(21),"^FS"
1410 PRINT #"^BY2^FO27,99^BCN,104,Y,Y,N^FD>:",$(14),CHR(B),$( 5),"^FS"
1420 PRINT #"^XZ"
1430 PRINT #"^XA"
1440 PRINT #"^XFR:TEMP_FMT.ZPL"
1450 PRINT #"^PQ1,0,1,Y"
1460 PRINT #"^XZ"
1470 PRINT #"^XA"
1480 PRINT #"^IDR:TEMP_FMT.ZPL"
1490 PRINT #"^XZ"
1500 SCLPRT=1
1510 GOTO 80
1520 END
1530 A=SLC0
1540 AA=A+100
1550 PUSH AA
1560 PUSH 5
1570 CALL 62
1580 $(6)="1"
1590 PUSH 5
1600 PUSH 6
1610 CALL 67
1620 B=SLC3
1630 IF SLC6/4-(INT(SLC6/4))<>0 THEN GOTO 1660
1640 LEAPYEAR=1
1650 GOTO 1670
1660 LEAPYEAR=0
1670 IF SLC5=1 THEN MM=0
1680 IF SLC5=2 THEN MM=31
1690 IF SLC5=3 THEN MM=59
1700 IF SLC5=4 THEN MM=90
1710 IF SLC5=5 THEN MM=120
1720 IF SLC5=6 THEN MM=151
1730 IF SLC5=7 THEN MM=181
1740 IF SLC5=8 THEN MM=212
1750 IF SLC5=9 THEN MM=243
1760 IF SLC5=10 THEN MM=273
1770 IF SLC5=11 THEN MM=304
1780 IF SLC5=12 THEN MM=334
1790 JUL=MM+SLC4
1800 IF LEAPYEAR=0.OR.JUL<61 THEN RETURN
1810 JUL=JUL+1
1820 RETURN
1830 END
1840 RETI
1850 END
1860 REM *************SHIPPING LABEL****************
1870 PUSH SLC4
1880 PUSH 16
1890 CALL 62
1900 PUSH SLC5
1910 PUSH 17
1920 CALL 62
1930 PUSH SLC7
1940 PUSH 18
1950 CALL 62
1960 $(19)=" "
1970 PUSH 16
1980 PUSH 19
1990 CALL 67
2000 PUSH 17
2010 PUSH 19
2020 CALL 67
2030 PUSH 18
2040 PUSH 19
2050 CALL 67
2060 PRINT @"^XA"
2070 PRINT @"^MCY"
2080 PRINT @"^XZ"
2090 PRINT @"^XA"
2100 PRINT @"^FWN^CFD,24^PW831^LH0,0"
2110 PRINT @"^CI0^PR2^MNY^MTT^MMT^MD0^PON^PMN^LRN"
2120 PRINT @"^XZ"
2130 PRINT @"^XA"
2140 PRINT @"^MCY"
2150 PRINT @"^XZ"
2160 PRINT @"^XA"
2170 PRINT @"^DFR:TEMP_FMT.ZPL"
2180 PRINT @"^LRN"
2190 PRINT @"^BY3,3.0^FO163,367^B3B,N,80,N,N^FD",$(12),"^F S"
2200 PRINT @"^BY3,3.0^FO333,574^B3B,N,80,N,N^FD",$(18),"^F S"
2210 PRINT @"^BY3,3.0^FO520,524^B3B,N,80,N,N^FD",$(17),"-",$(16),"-",$(3),"^
2220 PRINT @"^BY3,3.0^FO698,561^B3B,N,80,N,N^FDFG^FS"
2230 PRINT @"^A0B,79,118^FO81,291^FDPART: ",$(12),"^FS"
2240 PRINT @"^A0B,31,32^FO25,706^FDTELEFLEX KENDALLVILLE INTERNAL LABEL^FS"
2250 PRINT @"^A0B,79,118^FO622,602^FDLOCATION: FG^FS"
2260 PRINT @"^A0B,79,118^FO442,477^FDLOT:",$(17),"-",$(16),"-",$(3),"^FS"
2270 PRINT @"^A0B,79,118^FO265,610^FDQUANTITY:",$(18),"^FS "
2280 PRINT @"^FO262,74^GB511,352,1,B,0^FS"
2290 PRINT @"^A0B,73,74^FO323,91^FDMATERIAL^FS"
2300 PRINT @"^A0B,73,74^FO498,105^FDDELIVERY^FS"
2310 PRINT @"^A0B,73,74^FO674,148^FD TICKET^FS"
2320 PRINT @"^XZ"
2330 PRINT @"^XA"
2340 PRINT @"^XFR:TEMP_FMT.ZPL"
2350 PRINT @"^PQ1,0,1,Y"
2360 PRINT @"^XZ"
2370 PRINT @"^XA"
2380 PRINT @"^IDR:TEMP_FMT.ZPL"
2390 PRINT @"^XZ"
2400 SCLPRT=1
2410 GOTO 80
2420 END

Last edited by johnfarrugi; January 27th, 2009 at 09:08 AM.
  Reply With Quote
Unread January 27th, 2009, 09:56 AM   #8
Christoff84
Lifetime Supporting Member + Moderator
Canada

Christoff84 is online now
 
Christoff84's Avatar
 
Join Date: Jun 2006
Location: Cambridge, ON
Posts: 394
Quote:
Purpose
Use CALL 62 to convert a number or numeric variable into a string. You must
allocate a minimum of 14 characters for the string. If the exponent of the value to
be converted is anticipated to be 100 or greater, you must allocate 15 characters.
Error checking traps string allocation of less than 14 characters only. There are no
output arguments.
Syntax
PUSH [number to convert to string]
PUSH [string number to receive the value]
Quote:
CALL 62
Just off hand based on looking at it, this line stand out as missing a closing "

2210 PRINT @"^BY3,3.0^FO520,524^B3B,N,80,N,N^FD",$(17),"-",$(16),"-",$(3),"^


  Reply With Quote
Unread January 27th, 2009, 11:59 AM   #9
johnfarrugi
Member
Canada

johnfarrugi is offline
 
Join Date: Mar 2008
Location: London
Posts: 99
Then how does this Call 62 work?

620 PUSH JUL
630 PUSH 25
640 CALL 62
  Reply With Quote
Unread January 27th, 2009, 02:34 PM   #10
Christoff84
Lifetime Supporting Member + Moderator
Canada

Christoff84 is online now
 
Christoff84's Avatar
 
Join Date: Jun 2006
Location: Cambridge, ON
Posts: 394
Quote:
Originally Posted by johnfarrugi View Post
Then how does this Call 62 work?

620 PUSH JUL
630 PUSH 25
640 CALL 62
It works by taking the data in the variable "JUL" and converting it to a string, and placing the string into the variable "25"

Its probably to do with how the program handles numbers vs strings.
  Reply With Quote
Unread January 27th, 2009, 07:41 PM   #11
OZEE
Member
United States

OZEE is offline
 
Join Date: Mar 2006
Location: Kansas
Posts: 1,695
The function CALL 62 is used to convert a number to a string.

From the 1771-DB module, the proper syntax is:

Quote:
PUSH value to be converted
PUSH number of string to receive the value
CALL 62
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
On-Line, Real-Time, Programming... Terry Woods LIVE PLC Questions And Answers 95 September 7th, 2007 09:33 PM
TI 505 Basic Module Comm Errors Rayramsey2000 LIVE PLC Questions And Answers 0 October 25th, 2006 10:36 PM
Converting C to basic a.llex LIVE PLC Questions And Answers 0 October 18th, 2004 03:30 PM
Automatin Direct Changes Download ArikBY LIVE PLC Questions And Answers 53 May 12th, 2004 01:05 AM
How to simulate a FOR..NEXT loop? New2PLCs LIVE PLC Questions And Answers 26 May 9th, 2002 01:36 PM


All times are GMT -5. The time now is 12:53 PM.


.