Sign in to follow this  
Followers 0
Davids

Analog IN & OUT for Q series

6 posts in this topic

Hi, i had facing problem on writing analog input and output for Q00J PLC. i'm using Q64AD and Q62DA. i'm try to write the analog input & output program but i not yet test due to no hardware to let me testing. Hereby i attach the program and would someone can point me out where is the error? so i can learn and improve my skill in analog. or anyone would like to share their source code for analog input and output? very thank alot. Analog.zip

Share this post


Link to post
Share on other sites
Check download section for some examples posted by Wayne. Here are my comments: - setup PLC parameters (I/O map with some comments, programs scannned etc.) - use some comments, they never hurt - use conversion complete flags for reading analog inputs - use TO and FROM sparingly, use one instruction to transfer more registers where possible.

Share this post


Link to post
Share on other sites
i got one question to ask here. for the switch setting for I/O. for example if i set the switch 1 to 4000 then what needed to set in switch 2 and so on? and 4000 mean X400 at PLC? sorry for me noob question. by the way, Mr panic can please explain for me the instruction for [FROM h3 k10 k4x400 k5]? k10 mean the buffer memory? how if i have 4 channel, how do i allocate the buffer memory for each channel? i had check with Mr wayne sample code just now. i saw a enable step at line 0. [TO H0 K0 H0FF K1] = H0 is at slot 0, but the K0 and H0FF i dont know how to allocate it. may give some guide? very thank you. Edited by Davids

Share this post


Link to post
Share on other sites
The switch settings are for module configuration. They must be set according to the settings in the manual for your card. FROM H3 K10 K4X400 K5 will bring 5 words (the K5) of data from module head address 3 (the H3) buffer memory 10 (the K10 thru 14 due to the K5) into bits X400 through X44F. There are good examples of the TO and FROM instructions in the Q Common Instructions manual, with example code. The manuals for the analog cards also have complete sample code in them to operate the module.

Share this post


Link to post
Share on other sites
just a note: you don't allocate buffer registers. they are already created and part of the special cards such as analog input, analog output, etc. buffer is just part of the cards memory that plc processor can access. all buffers are easily accessible (just linear list, there are no pages or banks). when you want to access something from such card, you just need to read the manual and find out which buffer has it. in this case values for 4 channels ware in buffers 11, 12, 13 and 14. buffer 10 had some status bits such as conversion complete. you should find out what buffer has error codes so when alarm bit comes on, program can read the error code from correct buffer and explain what was it. accessing buffers comes at a price (speed) and it is much better to read or write block of buffers instead of accessing them one by one. once the content of the buffers is in plc memory, you can manipulate it any way you like. this also affects scan time but it has far less impact. instructions only use start addresses of the block to be transfered. so [FROM h3 k10 k4x400 k5] works faster but does the same as following 5 instructions: [FROM h3 k10 k4x400 k1] ; read conversion status [FROM h3 k11 k4x410 k1] ; read ch1 [FROM h3 k12 k4x420 k1] ; read ch2 [FROM h3 k13 k4x430 k1] ; read ch3 [FROM h3 k14 k4x440 k1] ; read ch4 or following two instructions [FROM h3 k10 k4x400 k1] ; read conversion status [FROM h3 k11 k4x410 k4] ; read channels 1-4 etc. there is no particular reason to use X or M or D or any other device (memory type) you could as well use [FROM h3 k10 D10 k5] and transfer status to D10 and channels to D11-D14. i tried using bit device as temporary storage simply to be able to show comments for individual status bits. there are some articles and posts in the forum that explain a bit more. you can't go wrong by reading it all but you might want to start with something like http://forums.mrplc.com/index.php?showtopic=1104 (posts) http://www.mrplc.com/kb/index.php?page=index_v1&c=23 (Tutorials) This site also has search engine, did you try it?

Share this post


Link to post
Share on other sites
thank for the support here. now i have more clearer picture on analog. i have try to do search function at this site but the thread can't help me a solution that why i'm try to open a new thread. very thank first. later i would try to figure out in pratical to test connectivity and so on. thank..

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0