1746-BAS got some of it to work

The
INPS #$(91),9
worked
The last thing is to change the value of the M0 from the bas if say a string is equal to what the port just received. That will get me going. And then I will post my program with all the comments for others that need help with this module.

Thanks SO much Jean-Luc,
Matt
 
This should be so simple.
Publication 1746-R
M001A-US-P
Math and Backplane Conversion Functions
9-3
Syntax
PUSH [value to be converted]
PUSH [word number of module output buffer]
CALL 24
Example
>1 REM EXAMPLE PROGRAM
>10W=17
>40 PUSH W : REM THE VALUE TO BE CONVERTED
>50 PUSH 0 : REM 1ST WORD OF BASIC OUTPUT BUFFER ?? what is this referring to M0 O1:X the module buffer ??
And 1st word is that M0:0 or m):100???

>60 CALL 24 : REM DO THE F.P. TO 16-BIT SIGNED CONVERSION
 
Just coming back at work:

m0:0 => word 100 of input buffer
word 100 of output buffer => M1:0


6160 PUSH 1 : CALL 36 : POP NBR_LCB : to know rthe number of character in the buffer
6170 REM PRINT "Numero Car.Recibios =",NBR_LCB,LCB_AUT,
6180 IF NBR_LCB=0 THEN GOTO 7000
6190 IF NBR_LCB<>9 THEN GOTO 6900 : REM in this case, the string must be 9 characters long
6200 REM *** gestion trama recibia LCB
6210 INPS #$(91),9
6220 REM PRINT "Trama recibia =",$(91)

6240 LCB_PJI1=ASC($(91),1) <converting string to an array of integer>
6250 LCB_PJI2=ASC($(91),2)
6260 LCB_PJI3=ASC($(91),3)
6270 LCB_PJI4=ASC($(91),4)
6280 LCB_PJI5=ASC($(91),5)
6290 LCB_PJI6=ASC($(91),6)
6300 LCB_PJI7=ASC($(91),7)
6310 LCB_PJI8=ASC($(91),8)
6320 LCB_PJI9=ASC($(91),9)
6330 $(91)=""

<To send the array of integer (ascii values) to M1:10>
10610 PUSH LCB_PJI1 : PUSH 110 : CALL 24 : REM PJI palabra 1 LCB
10611 PUSH LCB_PJI2 : PUSH 111 : CALL 24 : REM PJI palabra 2 LCB
10612 PUSH LCB_PJI3 : PUSH 112 : CALL 24 : REM PJI palabra 3 LCB
10613 PUSH LCB_PJI4 : PUSH 113 : CALL 24 : REM PJI palabra 4 LCB
10614 PUSH LCB_PJI5 : PUSH 114 : CALL 24 : REM PJI palabra 5 LCB
10615 PUSH LCB_PJI6 : PUSH 115 : CALL 24 : REM PJI palabra 6 LCB
10616 PUSH LCB_PJI7 : PUSH 116 : CALL 24 : REM PJI palabra 7 LCB
10617 PUSH LCB_PJI8 : PUSH 117 : CALL 24 : REM PJI palabra 8 LCB
10618 PUSH LCB_PJI9 : PUSH 118 : CALL 24 : REM PJI palabra 9 LCB
 
Glad your back Jean, Thanks for all the help first off!!!

This is a simple test program I tryied
2 T=(1+T)
3 IF T>401T=1
10 PUSH T : PUSH 110 : CALL 24
20 GOTO 2

T is just a counter to show number is changing
I tested this and would expect M1:10 to have a value adding up.
All I got was a 0.
 
is there any logic in the processor that needs to be written other than the M to N COP
i got to be missing something so simple.
 
Are you sure you can write the line 3 like that? I would use the THEN statement to be sure.

I think your counter is very fast. may be you should put a timer in the basic program. If the counter is running like that, the value will change sometimes during one PLC's scan.
 
Last edited:
Yes I did not know how to make a timer/counter so just used that. If I print T I get 1,2,3,4,5.ect. I tried samples for CALL 24 and 25.
>1 REM EXAMPLE PROGRAM
>10 W=17
>40 PUSH W : REM THE VALUE TO BE CONVERTED
>50 PUSH 0 : REM 1ST WORD OF BASIC OUTPUT BUFFER
>60 CALL 24 : REM DO THE F.P. TO 16-BIT SIGNED CONVERSION

No matter what I do I cant get a value to the PLC other than CALL 22 to get what the port has for data to the M0 file. Then I would have to write all the ASCII conversion code in the PLC. Witch would be a lot of code which can be easily done in the BAS module.

All I need to know is how to send A value from the BAS to the PLC, other than what the port has.
Thanks,
Matt
 
Would this work.
20 STRING 200,10
30 $(1)="123456"
165 PUSH 0 : REM PRT2 IS THE SOURCE
170 PUSH 200 : REM RECEIVING 200 BYTES
175 PUSH 13 : REM <CR> IS THE TERMINATION CHARACTER
180 PUSH 3 : REM CPU M1 file and internal string
185 PUSH 0 : REM offset
190 PUSH 1 : REM STRING NUMBER
195 PUSH 1 : REM BYTE SWAP ENABLED
200 CALL 22 : REM SEND DATA TRANSFER PARAMETERS
210 POP S : REM STATUS OF CALL SETUP
220 IF (S<>0) PRINT "ERROR IN CALL 22 SETUP"
230 GOTO 20

I get an error :ERROR IN CALL 22 SETUP:
but if I can get the right setup this may work.
there is no part of the manual that talks about using an internial string like in
line 190
 
Finnallllly got it but just one question. It wowks with the SLC input table how can I get it to work with the M1 file.
found it here http://www.plctalk.net/qanda/showthread.php?t=6979
>1 REM EXAMPLE PROGRAM
>10 REM ENABLE EXPANDED ONERR FUNCTION
>20 ONERR 160
>30 PUSH 1
>40 CALL 38
>50 CALL 53: REM GET DATA FROM OUTPUT IMAGE
>60 PUSH 201: REM ADDRESS OF SECOND WORD IN BUFFER Used 100 for M1 won't work
>70 CALL 14: REM GET DATA FROM INPUT BUFFER
>80 POP X: REM VALUE FROM INPUT BUFFER
>90 A=(X*2.499733)-8191.625
>100 PUSH A: REM RESULT OF ABOVE CALCULATION
>110 PUSH 201: REM WORD NUMBER OF BASIC OUTPUT BUFFER
>120 CALL 24: REM BASIC FLOATING POINT TO 16-BIT SIGNED
INTEGER
>130 CALL 54: REM OUTPUT BUFFER TO SLC INPUT FILE
>140 POP Y: REM SLC PROCESSOR STATUS
>150 IF (Y<>0) THEN PRINT “PROCESSOR NOT IN RUN MODE”
>160 GOTO 50
>170 PRINT “ERROR CODE WAS”,XBY(257) : REM BEGINNING OF ONERR
ROUTINE
>175 PRINT “AT LINE “, (256*XBY (69FDH) + XBY(69FEH))
>180 GOTO 50
>190 END
 
Last edited:
100 PUSH N : PUSH 110 : CALL 24 : REM send the value of N in the word 110 of the output buffer as 16 bits signed integer
110 PUSH 20 : CALL 57 : POP X : REM transfer words 100 to 119 of the output buffer to M1 file words 0 to 19.


here, call 24 is just used to put the value at the address 110
 

Similar Topics

Hello, We have an older SLC500 controlled system that is using a BASIC module to communicate to a third party device. Looking into converting the...
Replies
4
Views
1,280
I am trying to program a 1747-M2 EEPROM in a 1746-BAS module. I can download the program and I enter "PROG" and it says successful. I can use the...
Replies
5
Views
2,004
Hi, I am upgrading a AB PLc to Siemens PLC logic and everything is ready for siemens but the problem is the existing PLC is communicating to DCS...
Replies
7
Views
4,768
I'll admit that in all these years I have only encountered M0/M1 files one other time, and it was used to communicate with Eurodrives. In a SLC...
Replies
6
Views
1,728
We are using Sick CLX series bar code reader with AB 1746-BAS module in a outdated system . The processor is SLC 5/04.We want to revamp the system...
Replies
1
Views
1,472
Back
Top Bottom