A little more help

Started by the_oog6789 January 6, 2005

Back again..

I been playing around with my new hcs12 and I've managed to set up
some serial communication, played around with the PLL to increase
the chips clock speed and used the RTI.

What I'm stuck on at the moment is the external interrupts through
Port P or Port H. Firstly, there doesn't seem to be any pins to
port H (MC9S12E-Family Device User Guide V01.04 pg 76) on the chip
and secondly, port P registers for enabling and checking the stats
of interrupts dont seem to exist either. These registers are
refered to in the P.I.M block guide as being 1 address after port
P's polarity select register, but in the device user guide they are
listed as reserver. Further more, codewarrior(which has
autogenerated code for every register so far) has not generated code
for these registers. I tried adding them myself but I cant seem to
trigger the interrupt by driving the pins high or low.

Firstly, can anybody tell me a good way to generate external
interrupts?

Secondly, where is this elusive port H?





The "e" series is a horse of a slightly different color. I believe
only port AD supports interrupts on the pins. I just started a
project with an "e" chip and assumed as you did that it would have
the full palette of interrupt pins. Fortunately, I don't need
interrupt pins on this project, but next time I will examine those
voluminous docs a little closer before starting.

A quick way to test external interrupts is to tie an output pin to
the interrupt pin, then toggle the output pin. The problem is that
this hard-synchronizes the "external" interrupt to your internal
software, but at least this gets you going. I suppose SCK would be
good at generating interrupt bursts, and a TXD port pin tied to an
interrupt input will generate randomish interrupts, depending on the
character sent and baudrate.

For an external interrupt source you can use a function
generator, a 555 timer, a long counter like a CD4040, or even a PC's
parallel printer port. Be careful not to exceed your CPU's VCC
voltage on external logic inputs. You can clock an external counter
through a timer or PWM pin or the ECLK pin. While we're at it, why
not use another microcontroller development board as a signal
generator? Or just a switch pulled up by a resistor -- counting the
number of interrupts per switch closure will teach you about
debounce, and watch out for static discharge.

Bill Tondreau
tel: 505-263-5949
http://www.kupercontrols.com

> Back again..
>
> I been playing around with my new hcs12 and I've managed to set up
> some serial communication, played around with the PLL to increase
> the chips clock speed and used the RTI.
>
> What I'm stuck on at the moment is the external interrupts through
> Port P or Port H. Firstly, there doesn't seem to be any pins to
> port H (MC9S12E-Family Device User Guide V01.04 pg 76) on the chip
> and secondly, port P registers for enabling and checking the stats
> of interrupts dont seem to exist either. These registers are
> refered to in the P.I.M block guide as being 1 address after port
> P's polarity select register, but in the device user guide they are
> listed as reserver. Further more, codewarrior(which has
> autogenerated code for every register so far) has not generated
code
> for these registers. I tried adding them myself but I cant seem to
> trigger the interrupt by driving the pins high or low.
>
> Firstly, can anybody tell me a good way to generate external
> interrupts?
>
> Secondly, where is this elusive port H?





I had a problem where some interrupt vectors pointed to a default
handler which did not clear the interrupt flags. The result was an
unexpected interrupt hanging the system. I verified it with a BDM
breakpoint at the default handler. --jeffs

--- In , "Darren" <djmoore@t...> wrote:
>
> Hi Venkata,
>
> Might help if you post some code here, you haven't
> given us much to go on.
>
> Darren Moore > > -----Original Message-----
> > From: venkat subramanian [mailto:vvs_80@y...]
> >
> >
> > Bob
> > I tried initializing the STACK, it ran for a longer
> > time.However, when I
> > simply commented the psh and pul mnemonics in the code ( just
> > to test) it
> > did make much difference , it hanged as previously.
> > I do not know wat is going wroong?
> >
> > help me!
> >
> > venkata



Maybe you don,t clearing the interrupt flag

do you finish your service rti ruotine with

return of interrupt RTI?

--- venkat subramanian <> escribi
>
> Bob
> I tried initializing the STACK, it ran for a longer
> time.However, when I
> simply commented the psh and pul mnemonics in the
> code ( just to test) it
> did make much difference , it hanged as previously.
> I do not know wat is going wroong?
>
> help me!
>
> venkata > wrote:
> > >
> > > In a message dated 1/14/05 11:20:17 P.M. Eastern
> Standard Time,
> > > writes:
> > >
> > > lds $0c00
> > >
> > >
> > >
> > > ====================
> > > I assume $0c00 is a high ram address. Maybe you
> should use $0bff, and
> > > dont
> > > forget the immediate sign! LDS #$0BFF... you
> told it to "load the
> > > contens of
> > > location $0c00" which had who knows what in
> it..... > __________________________________ >
>
> Yahoo! Groups Links >

_________________________________________________________

In a message dated 1/19/05 7:34:32 P.M. Eastern Standard Time,
writes:

> I tried initializing the STACK, it ran for a longer
> time.However, when I
> simply commented the psh and pul mnemonics in the
> code ( just to test) it
> did make much difference , it hanged as previously.
> I do not know wat is going wroong?
>
> help me!
=========================
If you post your program we will 'eyeball' it.......