Canīt get DTīs interrupts working
Hy guys.
Iīm trying to build a little counter to count pulses of varying speed from nil to 120Hz.
YEEES it will be a tripmaster speedo someday.
Tried that with "count" and it works so far, but looses pulses of course and I need every, at least 99,9% of these.
So I tried to get into DTs interrupts and Iīm falling on my face (hurts of course)
because I dunno where to start. Tried "Hello World", "Blinky Light", wont do.
So I thought its because of the missing definitions and tried some....wont do
all I get after compiling is the error:
ERROR: Variable wsave3 position request 416 beyond RAM_END 335.
I got Microcode studio 3.0.0.5, picbasic pro 2.50 C
heres my code (stolen from DT of course)
Code:
'****************************************************************
'* Name : ElapsedtimerDT1 *
'* Author : Darrel Taylor *
'* Notice : Copyright (c) 2010 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 25.04.2010 *
'* Version : 1.0 *
'* Notes : 16F628A, 4mhz , donīt care about correct timing *
'* : *
'****************************************************************
'* Date : Jan 10, 2006 *
'* Notes : This is a simplistic demo of the Elapsed Timer *
'***************************************************************
define LOADER_USED 1
define OSC 4
' Define LCD connections
DEFINE LCD_DREG PORTA ' LCD Data Port
DEFINE LCD_DBIT 0 ' Starting Data Bit
DEFINE LCD_RSREG PORTA ' Register Select Port
DEFINE LCD_RSBIT 4 ' Register Select Bit
DEFINE LCD_EREG PORTA ' Enable Port
DEFINE LCD_EBIT 5 ' Enable Bit
DEFINE LCD_BITS 4 ' Data Bus Size
DEFINE LCD_LINES 2 ' Number of Lines on LCD
ADCON1 = 7 ' Set portA outputs to Digital / No ADC
'CMCON = 7
LCDOUT $FE,1 ' Initialize LCD
PAUSE 200
include "DT_INTS-14.bas"
INCLUDE "ReEnterPBP.bas"
INCLUDE "Elapsed_INT.bas"
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _ClockCount, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
INT_ENABLE TMR1_INT ; Enable Timer 1 Interrupts
ENDASM
Gosub ResetTime ' Reset Time to 0d-00:00:00.00
Gosub StartTimer ' Start the Elapsed Timer
Main:
if SecondsChanged = 1 then
SecondsChanged = 0
LCDout $FE,$C0, dec Days,"d-",dec2 Hours,":",dec2 Minutes,":",dec2 Seconds
endif
GOTO Main
maybe its about compiler version or something.
any suggestions beyond cry me a river?
regards Mugelpower
DT_INTS-14.bas version 1.0
Man where do I get the newest version:
DT_INTS-14.bas version 1.0
????
regards
Mugelpower
got a supersimple DT Timer working
Hi Guys & Dolls,
got the DT program running but needed to implement a stupid LCD comment first!
otherwise the lcd shows only rubbish
Code:
'**************************************************************** *
'* Notes : To use this example with MicroCode Studio, you *
'* : should: *
'* : PIC 16F88 4 MHZ crystal *
'* WORKS! ī *
'****************************************************************
CMCON = 7 ' Disable analog comparator
ANSEL = %00000000 ' set all to digital
Include "modedefs.bas"
define OSC 4 ' this example uses a 4MHz clock
CMCON = 7 ' RA0-RA3 are digital I/O
TRISA = 0 ' PORT A is output
TRISB = 3 ' RB0 is Input count RB1 Input reset others output
Minute var byte ' Define minute variable
Second var byte ' Define second variable
Ticks var byte ' Define pieces of seconds variable
DoUpdate var byte ' Define variable to indicate update
clear ' clear all RAM (sets all VAR declarations to zero)
DoUpdate = 1 ' Force first display
OPTION_REG = %00000101 ' Set TMR0 configuration
INTCON = $A0 ' Enable TMR0 interrupts
On Interrupt Goto TickInterrupt
PAUSE 100
LCDOUT $FE,1,"Guten"
pause 2000
LCDOUT $FE,1,"Tag"
pause 2000
' Main program loop
MainLoop:
if DoUpdate then
LCDOUT $FE,1
LCDOUT $FE,1,DEC2 Minute, ":",DEC2 Second
DoUpdate = 0
endif
Goto MainLoop
' Interrupt routine to handle each timer tick
' Disable interrupts during interrupt handler
disable
TickInterrupt:
Ticks = Ticks + 1 ' Count pieces of seconds
If Ticks < 61 Then ExitInterrupt ' 61 ticks per second
' One second elasped - update time
Ticks = 0
Second = Second + 1
If Second >= 60 Then
Second = 0
Minute = Minute + 1
If Minute >= 60 Then
Minute = 0
endif
Endif
DoUpdate = 1 ' Set update
ExitInterrupt:
INTCON.2 = 0 ' Reset timer interrupt flag
Resume
end
this is a far cry from my goal but at least a big jump for me, an unbelievable small step for mankind, maybe a step back.....