Cog Counter Freezing
oliver_man_77
Posts: 7
I am working on a project where I need to monitor encoder position in reference to a product detection eye "Sync". Based on the encoder position I need to sequence some outputs. The following code is sequencing outputs as desired only it runs for 16 minutes the stahls. I need this to run 24/7.· The program is only in the begining stages of a very complex proscess. Once this code is running 100% it will be layered much more but so far this is my problem. So any ideas why it stops running?
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 'Set clock to 80 MHz High = 1 Low = 0 Out = %1 Sync = 18 'Set pin # for Product Detect encoder = 16 'Set pin # for Encoder Input white = 21 'Set pin # for White Start cyan = 22 'Set pin # for Cyan Start magenta = 23 'Set pin # for Magenta Start yellow = 24 'Set pin # for Yellow Start black = 25 'Set pin # for Black Start ' VAR long posn ' PUB Start_cycle ' Start_White dira[noparse][[/noparse]yellow] := 0 'Clear Yellow Start signal Start_Cyan dira[noparse][[/noparse]black] := 0 'Clear Black Start signal Start_Magenta dira[noparse][[/noparse]white] := 0 'Clear White Start signal Start_Yellow dira[noparse][[/noparse]cyan] := 0 'Clear Cyan Start signal Start_Black dira[noparse][[/noparse]magenta] := 0 'Clear Magenta Start signal return Start_cycle ' Pri Start_White 'Configure counter module ctra[noparse][[/noparse]30..23] := %01010111 'Set ctra module to POSEDGE detector ctra[noparse][[/noparse]8..0] := encoder 'APIN to encoder frqa := 1 phsa := -2000 'Encoder counts to delay White signal repeat while phsa [noparse][[/noparse]31] dira[noparse][[/noparse]white]~~ 'Set White Start signal ' Pri Start_Cyan 'Configure counter module ctra[noparse][[/noparse]30..23] := %01010111 'Set ctra module to POSEDGE detector ctra[noparse][[/noparse]8..0] := encoder 'APIN to encoder frqa := 1 phsa := -2000 'Encoder counts to delay Cyan signal repeat while phsa [noparse][[/noparse]31] dira[noparse][[/noparse]cyan]~~ 'Set Cyan Start signal ' Pri Start_Magenta 'Configure counter module ctra[noparse][[/noparse]30..23] := %01010111 'Set ctra module to POSEDGE detector ctra[noparse][[/noparse]8..0] := encoder 'APIN to encoder frqa := 1 phsa := -2000 'Encoder counts to delay Magenta signal repeat while phsa [noparse][[/noparse]31] dira[noparse][[/noparse]magenta]~~ 'Set Magenta Start signal ' Pri Start_Yellow 'Configure counter module ctra[noparse][[/noparse]30..23] := %01010111 'Set ctra module to POSEDGE detector ctra[noparse][[/noparse]8..0] := encoder 'APIN to encoder frqa := 1 phsa := -2000 'Encoder counts to delay Yellow signal repeat while phsa [noparse][[/noparse]31] dira[noparse][[/noparse]yellow]~~ 'Set Yellow Start signal ' Pri Start_Black 'Configure counter module ctra[noparse][[/noparse]30..23] := %01010111 'Set ctra module to POSEDGE detector ctra[noparse][[/noparse]8..0] := encoder 'APIN to encoder frqa := 1 phsa := -2000 'Encoder counts to delay Black signal repeat while phsa [noparse][[/noparse]31] dira[noparse][[/noparse]black]~~ 'Set Black Start signal '
Comments
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Still some PropSTICK Kit bare PCBs left!