corrected Re: rtc_isr_tmr3.jal ?

1 view
Skip to first unread message

vasile surducan

unread,
May 14, 2012, 12:05:19 AM5/14/12
to jal...@googlegroups.com
Hi all,

I have corrected and tested the code, at least for me it's working ok. Care should be taken if INTCON_PEIE must be set for the other program purposes...
I have attached the file, maybe if you don't mind some of you will upload it, my Tortoise does not work right now...

thx,
Vasile

On Sun, May 13, 2012 at 8:14 PM, vasile surducan <vsur...@gmail.com> wrote:
Hi,

I'm trying to use rtc_isr_tmr3.jal from jalpack 2.4o_0.8_0.9_0.9 without success.
I know well the bresenham theory, however something is weird here with the procedure itself.

The initialisation sequence I'm using is here:

procedure initTimer3 ( ) is
-----------------------------------------------------------
T3CON_TMR3ON  = 0        ; TMR3 off
T3CON_T3CKPS   = 0b00     ; 1:1 prescaler
T3CON_TMR3CS = 0          ; internal clock (Fosc/4)
RCON_IPEN = low           ; set low priority interrupts
PIR2_TMR3IF = low         ; clear interrupt flag
PIE2_TMR3IE    = on       ; TMR3 interrupt enabled
; IPR2_TMR3IP     = on        ; Not relevant low priority interrupts are set
INTCON_PEIE    = on       ; peripheral interrupt enabled
INTCON_GIE     = on        ; global interrupt enabled
T3CON_TMR3ON  = 1        ; enable TMR3
end procedure

The ISR procedure from library is here:

var volatile byte seconds               -- global variable updated by ISR
const  _rtc_cycles_per_second = (target_clock / 4)
var volatile dword _rtc_bresenham = _rtc_cycles_per_second

procedure RTC() is
   pragma interrupt
   PIR2_TMR3IF = false              -- clear interrupt flag
   _rtc_bresenham = _rtc_bresenham - 0x1_00_00
   if _rtc_bresenham < 0x1_00_00 then
      seconds = seconds + 1
      _rtc_bresenham = _rtc_bresenham + _rtc_cycles_per_second
   end if
end procedure

comments from library:
-- TMR3 runs on internal clock speed and interrupts on overflow
-- every TMR3 interrupt decreases _rtc_bresenham by 0x1_00_00, or 2^16

Question: how would be this possible since PIR2_TMR3IF is never tested?

maybe Eur can help.

thx,
Vasile


rtc_isr_tmr3.jal

Joep Suijs

unread,
May 14, 2012, 2:06:00 AM5/14/12
to jal...@googlegroups.com
Hi Vasile,

I tried uploading via the web interface, but get a 'unknown server
error'. Not sure if this should work... Anyway, I hope someone else
has a working svn setup to help you out.

Joep

2012/5/14 vasile surducan <vsur...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups
> "jallib" group.
> To post to this group, send email to jal...@googlegroups.com.
> To unsubscribe from this group, send email to
> jallib+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/jallib?hl=en.

Sebastien Lelong

unread,
May 14, 2012, 3:15:08 PM5/14/12
to jal...@googlegroups.com
Hi guys,

Fixes are committed, I'm assuming these changes are ok for Eur ?

Thanks
Seb

2012/5/14 Joep Suijs <jsu...@gmail.com>



--
Sébastien Lelong


Eur van Andel

unread,
May 19, 2012, 7:40:59 AM5/19/12
to jal...@googlegroups.com
On 14 May 2012, at 21:15 , Sebastien Lelong wrote:

Fixes are committed, I'm assuming these changes are ok for Eur ?

intcon_GIE 

should be capitalised. I corrected that. 

---

ir EE van Andel e...@fiwihex.nl  http://www.fiwihex.nl

Fiwihex B.V. Wierdensestraat 74, NL7604BK Almelo, Netherlands

tel+31-546-491106 fax+31-546-491107



Reply all
Reply to author
Forward
0 new messages