Siemens CP340 with CPU317

njvr

Member
Join Date
Jan 2007
Location
vancouver
Posts
13
I am using CPU317 and CP340 RS422 mode. I am trying with the sample prog given below. I checked the output in Hperterminal it is nothing. But Tx LED in CP340 is blinking every second. No errors.


AN #breq
NOT
NOT
= #breq //To change the breq

CALL "P_SEND" , "DB_P_SEND"
REQ :=#breq
R :=#bAbReq
LADDR :=256
DB_NO :=10
DBB_NO:=0
LEN :=40
DONE :=#BDone
ERROR :=#bError
STATUS:=#wStatus

njv
 
I don't see what you are trying to do with the two NOT statements. And, what are the #breq variables? Temps? InOut parameters? What are you getting for #wStatus?

Let's simplify this and eliminate your trigger logic. Here is some code that will set a one shot every two seconds (substitute your own addresses if these are already taken):

AN M100.0
L S5T#2S
SD T100
A T100
= M100.0

CALL "P_SEND" , "DB_P_SEND"
REQ :=M100.0
R :=
LADDR :=256
DB_NO :=10
DBB_NO:=0
LEN :=40
DONE :=#BDone
ERROR :=#bError
STATUS:=#wStatus

Try that. Also, like I said in the other thread, if you have created a string in DB10, the first two bytes will not contain your characters. The rest of the message should still print, but it won't look right. And, have you actually checked DB10 to see if the string contains data?

Which protocol is the card set up for? ASCII?
 
Thanks for your reply,
Here I am using DWORD in DB10. Thats why I used DBB_NO:=0. I am using 3964R protocol.
I am having only CPU317-2PNDP with CP340 RS422 modules. I dont have any other hardware to connect. The temp variables are declared like breq etc.
Currently I am trying to send some string through CP340 module and a RS422-RS232 convertor is used at PC end to check the string in Hyperterminal.

njvr
 
If you use AN #breq without first initializing it, you will get wrong results. Let's use an absolute valiable as I described above as a test, and if it prints, we'll go from there. You could also try the ASCII protocol and see if that prints, but that shouldn't matter.
 
The problem is in RS422-232 convertor. After replacing this converter the program started working correctly.
Thanks for your replies.
njv
 

Similar Topics

Hi, been looking everywhere for this info but cant find it. Does anyone know if the CP340 RS232 card supplies 5v to Pin 9. Thanks
Replies
2
Views
1,413
Hello, We have a Sartorius CP scale connected via RS232 to the PLC. All was working well but when the scale was replaced with a newer version...
Replies
8
Views
2,545
I am trying to only receive data from a device via serial communication. I can read the data through my com port on my computer so I know that it...
Replies
4
Views
1,692
All, one of our industrial printers we do represent is communicating with a Siemens CP340 RS232c PLC through a comms cable which is only using...
Replies
0
Views
1,337
Hi folks, I could really use some help - I am trying to connect CP340 with my PC by RS232 protocol. I need to send some characters to PC from...
Replies
0
Views
1,895
Back
Top Bottom