The file attached is the sample program to demonstrate working of CP340.
This is 98% same as the program in Sample project.

Hardware used CPU315-2 PN/DP, CP 340, and cable which is COM to USB converter ( my laptop
does not have com port only usb).This cable is used to connect Cp340 port to USB port of laptop.

Software used:Step 7, v5.3.  and hyperterminal(which comes with all the Windows version, and can be found at Accessories-->Communications-->Hyperterminal)
 
Configuration used 9600 8-E-1. That is 9600 Baud rate , data bits 8, parity :even, stop bits:1, and flow control:none.
This configuration should be same in Hyperterminal Settings and in hardwre configuration of the CP340.The program attached has already configured for this setting.

First step--> Install the  software in CD which comes with CP340 card.

Note:Following settings has already been done so you can skip it.

Second Step-->If you goto Hardware configuration and double click on CP340 module at slot 4,the properties window of the Cp340 will pop up.If you press the button "parameter" on this window another window will pop up through which you can configure the CP340.Select ASCII as your Protocol.
Double clicking the "envelop" looking symbol on this window will open the another window.
Under "ASCII" tab of this window select 9600 8-E-1 configuration.
Under "Transfer" tab of this window select "None" for Data Flow Control.
Save and download Hardware congiguration in PLC



Third Step-->Load the program in your PLC, but if you are going to integrate this into your program then do the following:
a)Copy Fb2,FB3,FC11,FC12,DB2,DB3,DB10,Db11,DB20,SFB52,SFB53,SFC24,and TRX_RCV variable table in your project.
b) If FC's or DBs is already existing then you need to change these name and then copy it your existing program.
c)Also you need to make sure that bits used in this program is not being used in your program.
d)you have to call FC11, and FC12 from OB1.
e)you need to Load the address of Cp340(after checking it in hardware configuration) inside OB100.See how,in the program attached.

Fourth Step-->Right click at "Blocks" of your program and select "Check Block Consistency"
There should not be any errors or warnings when you compile.



Sixth Step--> to SEND the data in your laptop to PLC (DB20) usiing Hyperterminal do following:
a)In FC11 enable bit M3.1 and then enable the bitM0.7
b)Open up notepad and write "Siemens" and save at desktop,
c)From hyperterminal select "Transfer" and then "Select Text File..",
d)from this window open your notepad file.
 Moment you do this Green light at RXD of your CP340 will blink.
 The data send can be seen at Variable Table "TRX_RCV.

Fifth Step-->To SEND the data(stored in DB10) from your PLC to hyperterminal,a) enable the bit M3.0, b)Enable M0.6. Moment you enable M0.6 the green light in your Cp340 will blink.
And you can see the data send in your Hyperterminal.To send the data again you need to disable and then enable M0.6 again.
To change the data being send you can refer to ASCII table. From ASCII table you can note the decimal value of the  corresponding Character (Example character "M" has value 77,carriage return has 13, and line feed has 10)and feed it in column "Modify Value"  of the variable table TRX_RCV.

  

 
 
