>
> Part 1.1 Type: Plain Text (text/plain)
> Encoding: quoted-printable
Please do not use html in Usenet. This is a pure text medium.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Reply by PhilW●March 25, 20092009-03-25
This is a multi-part message in MIME format.
------=_NextPart_000_0195_01C9ADFE.4134FD60
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
"Marcipicus" <msammon@connect.carleton.ca> wrote in message =
news:ffWdnayE0-NRq1fUnZ2dnUVZ_gOWnZ2d@giganews.com...
> I'm trying to get the timer overflow interrupt working on the hc12 =
dp256b
> but so far I haven't had any luck.
>=20
> The overflow interrupt is never generated in my program(used a =
breakpiont
> in isr) and I can't find the logic error in my code.
>=20
> Here is my work environment:
> CHIP: hc12dp256
> COMPILER: ICC12
> DEBUGGER: NOICE
>=20
> Here's the code that doesn't work
>=20
> =
Same as mentioned above, clear by TFLG2 =3D 0x80. However, you have =
setup to auto clear (TSCR1 |=3D 0x90) which simply requires an access to =
the TCNT registers to auto clear.
>=20
> Thanks to anyone who can help me out
>=20
>
------=_NextPart_000_0195_01C9ADFE.4134FD60
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16809" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>"Marcipicus" <</FONT><A=20
href=3D"mailto:msammon@connect.carleton.ca"><FONT face=3DArial=20
size=3D2>msammon@connect.carleton.ca</FONT></A><FONT face=3DArial =
size=3D2>> wrote=20
in message </FONT><A=20
href=3D"news:ffWdnayE0-NRq1fUnZ2dnUVZ_gOWnZ2d@giganews.com"><FONT =
face=3DArial=20
size=3D2>news:ffWdnayE0-NRq1fUnZ2dnUVZ_gOWnZ2d@giganews.com</FONT></A><FO=
NT=20
face=3DArial size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>> I'm trying to get the timer =
overflow interrupt=20
working on the hc12 dp256b<BR>> but so far I haven't had any =
luck.<BR>>=20
<BR>> The overflow interrupt is never generated in my program(used a=20
breakpiont<BR>> in isr) and I can't find the logic error in my =
code.<BR>>=20
<BR>> Here is my work environment:<BR>> =
CHIP: =20
hc12dp256<BR>> COMPILER: ICC12<BR>> DEBUGGER: NOICE<BR>> =
<BR>>=20
Here's the code that doesn't work<BR>> <BR>>=20
-------------------------------------------------------------------------=
-----<BR>>=20
#include <hcs12dp256.h><BR>> #include <stdio.h><BR>> =
<BR>>=20
#pragma interrup_handler TOVF_ISR() (isrs installed in vector table=20
file)<BR>> <BR>> int count<BR>> <BR>> void =
main(void)<BR>>=20
{<BR>> //setup<BR>> =20
TFLG2|=3D0x80; //Clear interrupt=20
flag</FONT></DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2>You should only clear =
the=20
flag by TFLG2 =3D 0x80 else you will clear any other unserviced =
flags as=20
well. </FONT></DIV>
<DIV><BR><FONT face=3DArial size=3D2>> TSCR2=20
=3D0x8D; //Set timer =
frequency(250kHz), Enable=20
TOVF int<BR>> =
TSCR1|=3D0x90; //enable=20
timer and fast clear TOC7<BR>> <BR>> =20
asm("cli");<BR>> <BR>> count=3D0;<BR>> =20
while(count<3){<BR>> if(i%2000=3D=3D0) =
printf("count:=20
%d\n",count);<BR>> i++;<BR>> }<BR>>=20
<BR>> printf("count reached three\n");</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><FONT color=3D#ff0000>Your returning =
from=20
Main!!!!!!!!!!</FONT></DIV>
<DIV><BR>> }<BR>> <BR>> void TOVF_ISR()<BR>> {<BR>> =
asm("cli"); //reenable interrupts</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><FONT color=3D#ff0000>This is not =
needed, RTI will=20
restore it</FONT></DIV>
<DIV><BR>> count++;<BR>> TFLG2|=3D0X80;</DIV>
<DIV> </DIV>
<DIV><FONT color=3D#ff0000>Same as mentioned above, clear by TFLG2 =3D =
0x80.=20
However, you have setup to auto clear (TSCR1 |=3D 0x90) which simply =
requires an=20
access to the TCNT registers to auto clear.</FONT></DIV>
<DIV><FONT color=3D#ff0000></FONT><BR>> }<BR>>=20
-------------------------------------------------------------------------=
---<BR>>=20
<BR>> Thanks to anyone who can help me out<BR>>=20
<BR>></FONT></DIV></BODY></HTML>
------=_NextPart_000_0195_01C9ADFE.4134FD60--
Reply by Oliver Betz●March 25, 20092009-03-25
"Marcipicus" wrote:
>I'm trying to get the timer overflow interrupt working on the hc12 dp256b
>but so far I haven't had any luck.
>
>The overflow interrupt is never generated in my program(used a breakpiont
>in isr) and I can't find the logic error in my code.
>
>Here is my work environment:
>CHIP: hc12dp256
>COMPILER: ICC12
>DEBUGGER: NOICE
>
>Here's the code that doesn't work
>
>------------------------------------------------------------------------------
>#include <hcs12dp256.h>
>#include <stdio.h>
>
>#pragma interrup_handler TOVF_ISR() (isrs installed in vector table file)
>
>int count
>
>void main(void)
>{
> //setup
> TFLG2|=0x80; //Clear interrupt flag
> TSCR2 =0x8D; //Set timer frequency(250kHz), Enable TOVF int
why? RTI will do so, and your ISR doesn't run very long.
> count++;
> TFLG2|=0X80;
>}
Oliver
--
Oliver Betz, Munich
despammed.com might be broken, use Reply-To:
Reply by Marcipicus●March 25, 20092009-03-25
I'm trying to get the timer overflow interrupt working on the hc12 dp256b
but so far I haven't had any luck.
The overflow interrupt is never generated in my program(used a breakpiont
in isr) and I can't find the logic error in my code.
Here is my work environment:
CHIP: hc12dp256
COMPILER: ICC12
DEBUGGER: NOICE
Here's the code that doesn't work
------------------------------------------------------------------------------
#include <hcs12dp256.h>
#include <stdio.h>
#pragma interrup_handler TOVF_ISR() (isrs installed in vector table file)
int count
void main(void)
{
//setup
TFLG2|=0x80; //Clear interrupt flag
TSCR2 =0x8D; //Set timer frequency(250kHz), Enable TOVF int
TSCR1|=0x90; //enable timer and fast clear TOC7
asm("cli");
count=0;
while(count<3){
if(i%2000==0) printf("count: %d\n",count);
i++;
}
printf("count reached three\n");
}
void TOVF_ISR()
{
asm("cli"); //reenable interrupts
count++;
TFLG2|=0X80;
}
----------------------------------------------------------------------------
Thanks to anyone who can help me out