03-07-2007 05:55 AM
Hi again Paul..
Just wanted to give you an report and to thank you.. You were right, the com port was blocked.. I searched in the task manager and find some applications.. and removed them, cause only Lookout had access to this port.. Guess what happen? I was not able to start up my system again.. so my solution was to delete the com port, cause I know that winxp will build it up again.. After that I had access again, and was also able to write from my modbus tester direct to my registers..
I tried this morning to write 01101001000102FFBFB600 and yes.. it happens what I expected.. ok
I wrote the value FFBF cause I didn’t want to activate an alarm in bit 10.. So it works..
No I need to find out how to read from the registers with VISA.. the problem here is the CRC check. I have tried to searched on internet and read, but so far I don’t understand how to calculate it..
I use only two registers in my MODBUS generator.. and that is FC03 and FC16 the other one is not of interest for me.. These registers starts at 100H and 1000H
I will try to solve this cause it’s the only way to learn and to know what is going on, but if you have any idea how to calculate CRC, I will be happy..
One more questions… what is the point with the DSC module?? Init of com port is ok, and the register addresses are ok.. but does it calculate CRC? Any idea??
I have tried for hours, but no luck.. and it seems like I’m communicating, cause all of them has a green indicator… tips?
Thanks again..
Very best regards..
Benjii..
03-07-2007 07:16 AM
As for the DSC module I have not used it (I am taking a seminar on it in a few weeks) but I have codod mosbus drivers with labview and visa from scratch. Attached is a MODBUS CRC calculator, input your string excluding the CRC code and the output is the CRC and also the string with a CRC concatinated. For rhe read remove the CRC you recieve, pass the rest into the CRC-16 vi and validate that the CRC is the same. so a dricer is prety simple with visa. Open visa, fro commands with no reply, build the command string (function, address, data ...) add the CRC-16 code and send a visa write (If you plan to send multiple commands you need 1.5 Bits of wait between commands). For queries send the command and then call a visa read with the expected number of bytes of the response, parse the string, get the data and verify the CRC code (This should not fail very often from my experience). One other side note, if you use the newer DAQ/Visa drivers (DAQ8.0 +) there is a very nice feature, when you put a visa resource list control down, not only does it autopopulate this list but there is a little icon next to the resource name that indicates if the resource is currently in use. Hope this helps.
Paul
03-07-2007 07:56 AM
Thanks Paul....
I'll try my best.. Benjii
03-07-2007 10:15 AM
03-07-2007 10:17 AM
03-07-2007 02:37 PM
Again.. thanks and thanks again..
I write to my Modbus register earlier.. so I will figure out how to do things.. Yes, Paul... the CRC calculation VI is in the NIModbus, but they didn't calculate the right values according to the one my MODBUS tester did.. But I find another one on internet, that calculate exactly the right values, and when I use that one, I wrote easily to my MODBUS Generator..
When it comes to the DSC module, I will try to study it more, and to see how it works..
Thanks... very best regards.. Benjii..
03-12-2007 08:17 AM
Glad things worked out. There is probably different modbus CRC algorithms (the one I posted is CRC16) The DSC module is worth learning if you are doing alot of MODBUS and industrial communications. I usually am talking to one modbus per project and only a few modbus calls so I dont mind writing the drivers.
Paul
03-12-2007 08:36 AM
Thanks Paul..
Your CRC VI worked perfectly, just that I forgot to specify Hex in one place.. That's all..
I both read and writes to my device now, so I have progress. I have a small system that I'm controlling.. or maybe not.. I don't know. I collect temperatures from 30 rooms in a high school, lightning, controlling 4 air condition systems and a burglar alarm system..
That means that I write and read status from my holding register which incude 6 16 bit's registers.. starting from 1000H. I read my PIR detectors in 2 registers which start at adress 100H and 30 registers that all include temperature values.. So I need to prepare a reasonable way to collect the values from my device, calculate and then write out to my device again. I have to study and find a good way to set up the whole system... but I think I will manage it..
Very best regards Benjii..
05-11-2007 06:54 AM
05-14-2007 04:40 AM