Searching \ for '[SX] Trouble resetting the RTCC timer' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/ubicom/sxints.htm?key=rtcc
Search entire site for: 'Trouble resetting the RTCC timer'.

Exact match. Not showing close matches.
PICList Thread
'[SX] Trouble resetting the RTCC timer'
2009\06\29@144003 by baba40n/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, baba40 wrote:

HI to all those whose skill sets exceed mine (suspect that's just about everyone on this forum.)

I have created some SX/B code that starts a one minute timer using the RTCC timer.  I attempted to write the code so that when the minute elapses, the RTCC is reset and the whole process starts over again.  While the process works for one pass, it does not loop and start again.  It just appears to stop.  I have added and LED based trace (which is included in the attached file), and it appears the second pass stops at the
OPTIONS=$88 command at the end of the "start:" routine.


I suspect there is register (or some other basic housekeeping chore that has escaped me) that needs to be reset that I am missing as I can restart the process by hitting the reset button.  Ideally, I would like to reset and restart the RTCC timer without going through a full cold start.


Any help or insights would be greatly appreciated!


Best

Nimbus43
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\06\29@152658 by Fred_5msn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Fred_5ms wrote:

Hi baba40.
In SX-Key Help, There is a SX/B Example: Clock / Timer .

5ms
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831#m363844
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\06\29@164005 by Me_Leen/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Me_Lee wrote:

Have a look at this, I think it will help.

http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol8/col/nv152.pdf

[Quoting: "nv152"]
SX/B as Task Master
This is the biggest and most involved update to SX/B 2.0 is task management. Using tasks allows us to setup and
schedule automated processes; this are like subroutine but are called by a task scheduler instead of by us. For
example: let's say we want to check a sensor every 100 milliseconds no matter what else is going on in the program.
With tasks we can do that pretty easily.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831#m363864
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\06\29@173556 by JonnyMacn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote:

You can use the rate parameter of the INTERRUPT keyword to have SX/B set the correct RTCC return value automatically.  If, for example, you wanted the interrupt to run every 10us you would use
INTERRUPT 100_000
... where the rate is 100,000 interrupts per second.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831#m363880
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)


'[SX] Trouble resetting the RTCC timer'
2009\07\01@153216 by baba40n/a
flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, baba40 wrote:

Hi,

I want to thank those who have responded to my query.  While the idea of converting my timer to a task based process is something I never considered, in looking at Jon's code, the program that will incorporate the timer can't suffer the fair amount of additional code. I will, however, keep the task concept in mind for other adevntures.


I am investigating the rate parameter suggestion, but wonder just how big the value could be?  for example would a 10 minute timer using a value of 1,000,000 be too large.  Put another way, is there any documentation around covering the use of the interrupt rate parameter?


And finally, could 5ms? tell my where I can find his reference to SX-Key help.


You guys have been great and have vastly expanded my horizons.  I didn't expect to be taken to the places referenced in your responses.  I look forward to your comments to the above.


Best,

Nimbus43
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831#m364513
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\07\01@230319 by PJMontyn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, PJMonty wrote:

Nimbus43,
Regarding the help file:

1 - Start the IDE.

2 - Open the menu Help->SX/B Help.

3 - Expand the section that says "Example Projects" in the help file.

4 - Locate the project and read it.

Thanks,
PeterM
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831#m364605
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\07\02@100104 by JonnyMacn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote:

You need to set the INTERRUPT rate parameter based on timing needs of your program.  For example, I have an intervalometer (time-lapse controller) that uses an interrupt rate of 80_000 so that I can use the ISR to modulate an IR LED at 40kHz.  I also need a one-second timer to run in the ISR and this was built, manually, using assembly and three bytes (you can't count to 80_000 with a word).  
The point is that you can do what you want to do -- you just need to think it through and find the lowest common denominator.  Remember, the faster your INTERRUPT rate, the less time you have between interrupts which means you limit the amount of code you can place in the ISR.  My suggestion is that you make the ISR rate as low as possible to do what you want to do.  And avoid tasks if possible as they add a GIGANTIC amount of [necessary] overhead to the ISR.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831#m364711
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\07\08@104914 by Chris Savagen/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Chris Savage wrote:

Hello,
  I'm not sure about some of the things you're doing with the RTCC settings.based on the delay length you want I would think you would set the prescaler to RTCC rather than WDT and you would set a higher prescaler value instead of 1:2/1:1.  In any event I see where you're enabling the RTCC in your main code and I see where it is being disabled in the interrupt code.  Unfortunately I don't see anywhere where you're attempting to re-enable it.  This would support the idea of the loop running once and not again.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831#m366413
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\07\08@134652 by CounterRotatingPropsn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, CounterRotatingProps wrote:

Nimbus
I agree with Chris; there seems to be no re-enable.

Just curious about this too:


  ....
 if minutes<>1 then iout
' minutes roll over to main program
  OPTION=$C8
  p=1
  goto Start iout:
'RETURNINT 50 'This doesn't appear to work.  Had to implement assembler
'retiw instruction that follows.
ASM
mov w,#-50 'Interrupt very 1us
retiw
ENDASM  
                           
' =========================================================================
PROGRAM Start
' =========================================================================
Start:
...


Was the goto start there when you tried the RETURNINT 50?


cheers,
- Howard
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831#m366442
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\07\08@154930 by Chris Savagen/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Chris Savage wrote:

Oh wow Howard!  I didn't even see that!  So it seems the code is not returning properly at all.  In fact it would/should hit the other OPTION command, but I'm not sure the effect of never returning from the interrupt.the shadow registers would not be restored nor would the PC be popped from the interrupt stack.  Oh this is going to get messy.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831#m366463
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\07\09@094524 by baba40n/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, baba40 wrote:

Hi to all who are contributing to this dialogue.  I especially want to thank Chris and Howard for their
recent contributions.


I hope it is not premature to say that I am somewaht releaved to learn that I am not going nuts!

The logic is so simple that I originally thought I was over looling something obvious (may not be out of the woods on that, yet).


Just a brief note on the use of assembler for the ISR return.  While the SX/B compiler allows you to to replace "retiw" and the use of the offset (in this case -50), when I tried it, it did not work properly.

While the code executed, it appeared that the timing loop slowed down by one or two orders of magnitude so that instead of executing:


if minutes<>1 then iout                 'set for a one minute period for debugging

and causing the process to fall out of the interrupt after one minute, it would take over 10 minutes.  By replacing "RETURNINT" (supposedly you do not need to include the offset value[-50] as with "retiw") with the following snippet of assember, I was able to restore the correct timing created by the interrupt code.


iout:
ASM
mov w,#-50                     'Interrupt very 1us
retiw
ENDASM

I look forward to the continuing dialogue on this issue and want to thank Chris (and perhaps others withing Parallax), Howard and all those who have and may add their insights going forward.  Thanks for your help with this and the restoration of my mental health (I hope).


Baba40
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831#m366644
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\07\09@100011 by baba40n/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, baba40 wrote:

HI again,
An additional brief note to my last response.  It appears from traces I have run that the OPTION=$C8 does execute as I can validate proper
sequecing both after the "if minutes<>1 then iout                 'set for a one minute period for debugging" instruction (i.e. the program correctly
jumps to start after the prior OPTION command, and that the init code carried in "start" routine executes properly UP TO the OPTION=$88
statement.  
Hope this helps.

Baba40
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831#m366649
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\07\10@140551 by Chris Savagen/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Chris Savage wrote:

Baba40,
  So after removing the GOTO in your ISR you're still having problems?

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831#m367004
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\07\11@080501 by baba40n/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, baba40 wrote:

Chris,
If you are referring to the GOTO in the following snippet, yes.

' minutes roll over to main program
  OPTION=$C8
  p=1
  goto Start
The program appears to successfully jump to "Start" (so I assume that the OPTION=$C8 is
executing properly and disables the RTCC timer).  From the LED trace it also appears the the
"Start" sequence executes properly UP TO the OPTION=$88 (RTCC enable) where the program
stops.  If I hit reset on the dev. board the program commences at start and the the OPTION=$88
does execute causing the program to jump to org 0 initiating the interrupt timer routine.

So, at the end of 1 or 10 minutes, depending on how I set the value in the loop, the sequence falls
through the loop executing the OPTION=$C8 and the jump to "Start".  Consequently, it appears that
either the OPTION=$C8 or OPTION=$88 or both do not execute and that the only way to force the a
second or n number of enablings of the timer is to hit reset.

I hope this clear.  As I said before, this coding sequence is not rocket science, so I am at a loss to
under stand why only a hard reset is the only way to relaunch the timer.

As always, I appreciate your continuing help.

Nimbus43
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831#m367156
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\07\11@130152 by JonnyMacn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote:

I may be missing something but you seem to be going about this the hard way.  I actually needed a similar 1-second timer for my time-lapse controller.  The way I did it was to use a cascading timer in the ISR that would set a flag when one second had elapsed, then the timer would restart at 0.  The foreground code monitored this flag and when it was detected, acted on it and then cleared it so that the ISR could set it again at the end of then next elapsed second.

The attached program works the same, toggling an LED every 10 minutes.  Looking at the compiled output I determined that no __PARAMx vars are used in the ISR so the NOPRESERVE option is fine.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831#m367229
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\07\11@140002 by Zootn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Zoot wrote:

But you seem to still skip over the RETURNINT in some cases. I am sure this would lead to unpredictable results. But if you are just counting time, why not just count time with a free running interrupt? e.g.:


msLed PIN RA.3 OUTPUT
secLed      PIN RB.4 OUTPUT flags VAR byte ' global variable
isrFlag VAR flags.0 microseconds VAR Word
milliseconds VAR Word
seconds VAR Byte
minutes VAR Byte
hours    VAR Byte
WATCH microseconds
WATCH milliseconds
WATCH seconds
WATCH minutes
WATCH hours
'ISR
  INTERRUPT 1_000_000 ' every micro second, personally I would do milliseconds or maybe 100us (INTERRUPT 10_000) unless you really need micro seconds
  isrFlag = 1

  RETURNINT
Start:

   msLed = 0
   secLed = 0
Main:

  IF isrFlag = 0 THEN Main
      isrFlag = 0
      microseconds = microseconds + 1
      IF microseconds >= 1000 THEN
           microseconds = microseconds - 1000
           milliseconds = milliseconds + 1
           msLed = ~msLed
           IF milliseconds >= 1000 THEN
              milliseconds = 0
              seconds = seconds + 1
              secLed = ~secLed
              IF seconds >= 60 THEN
                 seconds = 0
                 minutes = minutes + 1
                 IF minutes >= 60 THEN
                    minutes = 0
                    hours = hours + 1
                 ENDIF
              ENDIF
           ENDIF
       ENDIF
 
       GOTO Main


---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831#m367249
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\07\12@121927 by Chris Savagen/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Chris Savage wrote:

I would really look at what JonnyMac has to offer.  I can find some bugs or issues in your code, but getting good programming advice for your application is what you really need right now.  I am all for having reference designs for anything, including code.  Why re-invent the wheel?  =)  Take care.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831#m367479
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

More... (looser matching)
- Last day of these posts
- In 2009 , 2010 only
- Today
- New search...