
adccommunitymod (AutomationDirect) asked a question.
Created Date: December 13,2006
Created By: bgscott_479
**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****
I have written a program that uses a HS counting card in an 06 to count encoder pulses. I really need to be able to kill the power to this program for short times without losing the count on my encoder. I found an example on AutoDirects web site that works through retentive memory to do this, but I have already used a ton of the V memory addresses that they use for an EZtext panel. the name of the example is 250_CTRIO_both_channels_retentive. Can anyone look at this and tell me how to make it work if my first input address needs to be V2050 instead of V2000? I don't understand the addressing well enough to figure it out. attached is the program:PLC 06 // Rung 1 // Address 0 #BEGIN COMMENT "THIS INFORMATION PROVIDED BY AUTOMATIONDIRECT.COM TECHNICAL " "SUPPORT IS PROVIDED " "AS IS " " WITHOUT A GUARANTEE OF ANY KIND. " "These documents are provided by our technical support department to assist others. We " "do not guarantee that the data is suitable for your particular application, nor do we " "assume any responsibility for them in your application. " " " " " "This program is setup to make both quadrature channels of the CTRIO be retentive on " "power cycle. Mapping for the CTRIO needs to start at V2000 for the inputs and V2030 " "for the outputs. CTRIOs can only be made retentive if they are located in the local base " "with the PLC. " " " "This code will also work in a 260 PLC. " " " "This first rung writes a hex 2 to the command word, this is the command for 'write all ' " " " #END STR SP0 LD K2 OUT V2100 // Rung 2 // Address 3 #BEGIN COMMENT "This rung writes values for; the CTRIO slot # (slot 6 in this case), the number of bytes (22), " "and the beginning offset (always k80) to shared RAM locations for the CTRIO. " #END STR SP0 LD K1 LD K22 LD K80 WT V2100 // Rung 3 // Address 9 #BEGIN COMMENT "This timer is here to allow enough time for the CTRIO to come up in RUN mode. " #END STR SP1 TMRF T320 K5 // Rung 4 // Address 13 STRPD T320 OUT B2060.7 // Rung 5 // Address 16 STRN B2024.6 AND B2024.7 RST B2060.7 // Rung 6 // Address 22 STR TA320 K18 LDD V2002 OUTD V2101 LDD V2012 OUTD V2105 // Rung 7 // Address 28 #BEGIN COMMENT "These rungs aren't necessary unless you just load the example code. All they are here for " "is to allow you to reset the counts for the CTRIO using C0 and C1 in dataview. " #END STR C0 OUT B2054.1 // Rung 8 // Address 31 STR C1 OUT B2055.1 // Rung 9 // Address 34 END // Rung 10 // Address 35 NOP #BEGIN ELEMENT_DOC "V2002 ", " ", " ", "channel 1 count " "V2012 ", " ", " ", "channel 2 count " "B2024.6 ", " ", " ", "System Command Error " "B2024.7 ", " ", " ", "System Command Complete " "B2060.7 ", " ", " ", "Process Command " #END Any help would be greatly appreciated
Created Date: December 13,2006
Created by: KPrice
bgscott_479,
I used your starting addresses and the CTRIO worked OK. I used V2050 for input starting address, V2100 for output, and V2150 for register. I'm only using 1-channel. V2050-2051=current count. I could not get your example code to work, see your example rung #6. Hope this helps.
I used the following:
STR SP0
LD K4
OUT V2150
LD K0
OUT V2101
// Rung 2
STR SP0
LD K1
LD K8
LD K80
WT V2150
// Rung 3
STR SP1
TMRF T0 K5
// Rung 4
STRPD T0
OUT B2130.7
// Rung 5
STRN B2074.6
AND B2074.7
RST B2130.7
// Rung 6
STR TA0 K10
LDD V2050
OUTD V2152
Created Date: December 14,2006
Created by: KPrice
bgscott_479,
My CTRIO manual also has a mistake on the Rung #6 of the Retentive Counter example.
Created Date: December 14,2006
Created by: bgscott_479
That works great!! thanks for the help.
Created Date: December 13,2006
Created by: bgscott_479
I have written a program that uses a HS counting card in an 06 to count encoder pulses. I really need to be able to kill the power to this program for short times without losing the count on my encoder. I found an example on AutoDirects web site that works through retentive memory to do this, but I have already used a ton of the V memory addresses that they use for an EZtext panel. the name of the example is 250_CTRIO_both_channels_retentive. Can anyone look at this and tell me how to make it work if my first input address needs to be V2050 instead of V2000? I don't understand the addressing well enough to figure it out. attached is the program:PLC 06
// Rung 1
// Address 0
#BEGIN COMMENT
"THIS INFORMATION PROVIDED BY AUTOMATIONDIRECT.COM TECHNICAL "
"SUPPORT IS PROVIDED " "AS IS " " WITHOUT A GUARANTEE OF ANY KIND. "
"These documents are provided by our technical support department to assist others. We "
"do not guarantee that the data is suitable for your particular application, nor do we "
"assume any responsibility for them in your application. "
" "
" "
"This program is setup to make both quadrature channels of the CTRIO be retentive on "
"power cycle. Mapping for the CTRIO needs to start at V2000 for the inputs and V2030 "
"for the outputs. CTRIOs can only be made retentive if they are located in the local base "
"with the PLC. "
" "
"This code will also work in a 260 PLC. "
" "
"This first rung writes a hex 2 to the command word, this is the command for 'write all ' "
" "
#END
STR SP0
LD K2
OUT V2100
// Rung 2
// Address 3
#BEGIN COMMENT
"This rung writes values for; the CTRIO slot # (slot 6 in this case), the number of bytes (22), "
"and the beginning offset (always k80) to shared RAM locations for the CTRIO. "
#END
STR SP0
LD K1
LD K22
LD K80
WT V2100
// Rung 3
// Address 9
#BEGIN COMMENT
"This timer is here to allow enough time for the CTRIO to come up in RUN mode. "
#END
STR SP1
TMRF T320 K5
// Rung 4
// Address 13
STRPD T320
OUT B2060.7
// Rung 5
// Address 16
STRN B2024.6
AND B2024.7
RST B2060.7
// Rung 6
// Address 22
STR TA320 K18
LDD V2002
OUTD V2101
LDD V2012
OUTD V2105
// Rung 7
// Address 28
#BEGIN COMMENT
"These rungs aren't necessary unless you just load the example code. All they are here for "
"is to allow you to reset the counts for the CTRIO using C0 and C1 in dataview. "
#END
STR C0
OUT B2054.1
// Rung 8
// Address 31
STR C1
OUT B2055.1
// Rung 9
// Address 34
END
// Rung 10
// Address 35
NOP
#BEGIN ELEMENT_DOC
"V2002 ", " ", " ", "channel 1 count "
"V2012 ", " ", " ", "channel 2 count "
"B2024.6 ", " ", " ", "System Command Error "
"B2024.7 ", " ", " ", "System Command Complete "
"B2060.7 ", " ", " ", "Process Command "
#END
Any help would be greatly appreciated