mpereira
Jul 19 2009, 01:01 PM
Help please,
Using a Versamax Micro(23 I/O). Have HSC configured for 1 Type A/1 Type B counters, using counter B. Need to load new value into counter's accumulator. Programmed one-shot logic to load constants using two BLKMOV_INT instructions and a COM_REQ instruction. The following data is loaded;
1st BLKMOV_INT : IN 1=0004, IN 2=0000, IN 3=0000, IN 4=0000, IN 5=0000, IN 6=0000, IN 7=0000, Q=%R02001 2nd BLKMOV_INT : IN 1=0000, IN 2=0008, IN 3=2010, IN 4=0101, IN 5=1000, IN 6=0000, IN 7=0000, Q=%R02008
COM_REQ : IN=%R02001, SYSID=4, TASK=000
When the COM_REQ is called, the value of the accumulator does not change. The counter is otherwise working properly. Using Proficy Machine Edition, V5.50.
The only reason I used BLKMOV_INT instructions instead of BLKMOV_WORD is that I could not figure out a way to enter hexadecimal data, without generating errors.
Any help would be appreciated.
Manuel
Steve Bailey
Jul 19 2009, 03:43 PM
There is a problem with IN4 of the second BLK_MOV. The command in the manual is in hex. Since you've selected BLK_MOV_INT you have to convert hex 0101 to decimal 257. Also, your decimal 1000 for the value will be interpreted as hex, so with the value given, you're setting the accumulator to 4096. If that exceeeds whatever maximum value you've already estabished, the COMREQ will fail.
The enter hex numbers, prefix them with "16#". So, if you use BLK_MOV_WORD, to use the hex value 0101, you would enter 16#0101.
mpereira
Jul 19 2009, 04:20 PM
QUOTE (Steve Bailey @ Jul 19 2009, 04:43 PM)

There is a problem with IN4 of the second BLK_MOV. The command in the manual is in hex. Since you've selected BLK_MOV_INT you have to convert hex 0101 to decimal 257. Also, your decimal 1000 for the value will be interpreted as hex, so with the value given, you're setting the accumulator to 4096. If that exceeeds whatever maximum value you've already estabished, the COMREQ will fail.
The enter hex numbers, prefix them with "16#". So, if you use BLK_MOV_WORD, to use the hex value 0101, you would enter 16#0101.
Thank you Steve. While looking at the data tables, with the format set to hex, I did notice the number prefixed by 16# but a light didn't go off. Thank you again, my problem should be resolved.