Author Topic: TIMER not start  (Read 434 times)

0 Members and 1 Guest are viewing this topic.

Offline MUNIACO

  • Jr. Member
  • **
  • Thank You
  • -Given: 31
  • -Receive: 0
  • Posts: 93
TIMER not start
« on: June 14, 2018, 07:20:33 PM »
Hi guys,

I have a Little problem.

A timer inside a program stop, reset but not start.

Dome idea?

Offline scotty

  • Sr. Member
  • ****
  • Thank You
  • -Given: 15
  • -Receive: 35
  • Posts: 317
  • NewbieRobot XD
Re: TIMER not start
« Reply #1 on: June 14, 2018, 08:24:26 PM »
Are you sure that your command TIMER_START executed after TIMER_STOP?

Offline MUNIACO

  • Jr. Member
  • **
  • Thank You
  • -Given: 31
  • -Receive: 0
  • Posts: 93
Re: TIMER not start
« Reply #2 on: June 14, 2018, 09:48:53 PM »
Yes.

Stop
Reset
Start.

Offline MUNIACO

  • Jr. Member
  • **
  • Thank You
  • -Given: 31
  • -Receive: 0
  • Posts: 93
Re: TIMER not start
« Reply #3 on: June 15, 2018, 11:08:46 AM »
No One.?

Offline scotty

  • Sr. Member
  • ****
  • Thank You
  • -Given: 15
  • -Receive: 35
  • Posts: 317
  • NewbieRobot XD
Re: TIMER not start
« Reply #4 on: June 15, 2018, 01:27:49 PM »
Share part of code. It's difficult to say. Most likely something wrong with code.

Did you try to make dummy program and start/stop/reset timer?

Offline MUNIACO

  • Jr. Member
  • **
  • Thank You
  • -Given: 31
  • -Receive: 0
  • Posts: 93
Re: TIMER not start
« Reply #5 on: June 15, 2018, 06:50:25 PM »
TIMER[3]=STOP ;
TIMER[3]=RESET ;
TIMER[3]=START ;
 R[2]=TIMER[3]    ;
if TIMER[3]>10, jmp lbl[100];

Offline scotty

  • Sr. Member
  • ****
  • Thank You
  • -Given: 15
  • -Receive: 35
  • Posts: 317
  • NewbieRobot XD
Re: TIMER not start
« Reply #6 on: June 15, 2018, 08:39:02 PM »
TIMER[3]=STOP ; <- N time
TIMER[3]=RESET ; <- 0 time
TIMER[3]=START ; <- 0 time
 R[2]=TIMER[3]    ; <- take 0 time and copy to R[2]
if TIMER[3]>10, jmp lbl[100]; <- never happen

Cool. Look explanation of your time value above. Timer start, as I see you are expecting to get data into R[2]. But as you can see you are doing next:
start timer#3
immediately receive time count into R[2]
and expect to jump by link. What you have in your R[2]? Most likely value between 0 and 8. Based on processor load.
FIY: you are not linking your timer count into register, you just taking current count and copy to register. if you are getting 0 in R[2] all the time, then try to add WAIT 1 sec before R[2] = TIMER[3]. Then you will see result and feel how timer works.

Offline MUNIACO

  • Jr. Member
  • **
  • Thank You
  • -Given: 31
  • -Receive: 0
  • Posts: 93
Re: TIMER not start
« Reply #7 on: June 15, 2018, 09:09:38 PM »
TIMER[3]=STOP ; <- N time
TIMER[3]=RESET ; <- 0 time
TIMER[3]=START ; <- 0 time
 R[2]=TIMER[3]    ; <- take 0 time and copy to R[2]
if TIMER[3]>10, jmp lbl[100]; <- never happen

Cool. Look explanation of your time value above. Timer start, as I see you are expecting to get data into R[2]. But as you can see you are doing next:
start timer#3
immediately receive time count into R[2]
and expect to jump by link. What you have in your R[2]? Most likely value between 0 and 8. Based on processor load.
FIY: you are not linking your timer count into register, you just taking current count and copy to register. if you are getting 0 in R[2] all the time, then try to add WAIT 1 sec before R[2] = TIMER[3]. Then you will see result and feel how timer works.

Thanks thanks and so thanks.

In fact now works. Show 1. But if I need to show milliseconds? I use this timer to check tool open and close to check if is closed or opened right.

Offline scotty

  • Sr. Member
  • ****
  • Thank You
  • -Given: 15
  • -Receive: 35
  • Posts: 317
  • NewbieRobot XD
Re: TIMER not start
« Reply #8 on: June 16, 2018, 01:22:38 AM »
In case if you are using some sensor to detect tool opened and toil closed position,  the. You can fo next:
Start timer
Open tool
Reset timer
Wait for sensor triggering
Save timer value into register
Stop timer