Key Wakeups

Started by Sophi Kravitz April 29, 2006
Hi-
I'm using a MC9S12DP256B.
Does anyone have any sample Key Wakeup code?
I have been unsuccessful in getting it to work.
Thanks!
Sophi
Hi Sophi!

Can you please tell me what do you mean with a sample Key wakeup code? Do
you just need some example code to get yourself running?

Waiting for your reply..

Mohammed El Korek
m...@ieee.org
On 4/29/06, Sophi Kravitz wrote:
>
> Hi-
> I'm using a MC9S12DP256B.
> Does anyone have any sample Key Wakeup code?
> I have been unsuccessful in getting it to work.
> Thanks!
> Sophi
>
>
Hi-
Yes that's exactly what I mean. Just some sample code to get it going!
I am using a development board with MC9S12DP256B.
I am using these addresses for init- got them from a CD which came with the
board.
Not sure that they are correct because there have been other errors. Also
not sure that
the interupt vector address is correct....using FFD0.

PORTJ equ $0268
DDRJ equ $026A
KWIEJ equ $026E
KWIFJ equ $026F
RTICTL equ $0038
RTIFLG equ $0037

LDAA #$00 ;PORTJ Input
STAA DDRJ
LDAA #$03 ;KWIEJ Enabled on pin 0 and 1
STAA KWIEJ

SEI
LDAA #$FF
STAA KWIFJ
LDAA KWIFJ ;Load KW Flag
;do some stuff
STAA KWIFJ ;Reset Interupt Flag
CLI ;Enables interupts
org $FFD0 ;Sets KW ISR to KWHAN
fdb KWHAN

On 4/29/06, MK wrote:
>
> Hi Sophi!
>
> Can you please tell me what do you mean with a sample Key wakeup code? Do
> you just need some example code to get yourself running?
>
> Waiting for your reply..
>
> Mohammed El Korek
> m...@ieee.org
>
> On 4/29/06, Sophi Kravitz wrote:
> >
> > Hi-
> > I'm using a MC9S12DP256B.
> > Does anyone have any sample Key Wakeup code?
> > I have been unsuccessful in getting it to work.
> > Thanks!
> > Sophi
> >
> >
> >
> >
> >
> >
> >
> > >.
> ------------------------------
>
Ok Sophi,
find this code below. (delay generator)

#include "Reg9s12.h"

ORG $2000

LDAA #$00

STAA DDRB

START: LDAA #$FF

STAA PORTB

JSR DELAY_500_MS

LDAA #$00

STAA PORTB

JSR DELAY_500_MS

JMP START

DELAY_500_MS: PSHX

LDX #1000

JSR DELAY_500_US

PULX

RTS

DELAY_500_US: PSHX

LDX #2000

JSR DELAY_250_NS

PULX

RTS

DELAY_250_NS: NOP

NOP

DEX

BNE DELAY_250_NS

RTS

another example:

#include "Reg9s12.h"

ORG $2000

LDAA #$FF

STAA DDRB

STAA DDRJ

STAA DDRP

CLR PTJ

LDAA #$FF

STAA PTP

START: LDAA #$FF

STAA PORTB

JSR DELAY_500_MS

LDAA #$00

STAA PORTB

JSR DELAY_500_MS

BRA START

DELAY_500_MS: PSHX

LDX #1000

XX JSR DELAY_500_US

DEX

BNE XX

PULX

RTS

DELAY_500_US: PSHX

LDX #2000

JSR DELAY_250_NS

PULX

RTS

DELAY_250_NS: NOP

NOP

DEX

BNE DELAY_250_NS

RTS

If the addresses are causing you trouble, just try to include a header file
that includes them all by default (a .h file... If the problem persists,
maybe it's the development environment you are using.. there might be some
settings that need to be made in order for you to specify which mode you are
using (developing your code in the RAM or in the EEPROM???).

I am actually currently doing my senior design project on a MC9S12DP256B
board which is the Minidragon+. If your IDE supports C programs, tell me so
I can give you some examples from my own!

Good luck Sophi!

Mohammed El Korek

American Univ. of Sharjah

m...@ieee.org
--- In 6..., MK wrote:
>
> Ok Sophi,
> find this code below. (delay generator)
>
> #include "Reg9s12.h"
>
> ORG $2000
>
> LDAA #$00

I don't see the "Key wakeup" part of these examples. I think key
wakeup involves setting interrupts on a certain port to detect any key
pressed on a grid array.
hello,
I agree with Jeff, KeyWakeups are interrupts on bits of ports H, J
and P. They relay to interrupt vectors respectively $FFCC, $FFCE and
$FF8E. The interrupt routine must test the status register of the
concerned port to know which pin had requested an interrupt.
Regards
JCL

--- In 6..., "Jefferson Smith"
wrote:
>
> --- In 6..., MK wrote:
> >
> > Ok Sophi,
> >
> >
> > find this code below. (delay generator)
> >
> > #include "Reg9s12.h"
> >
> > ORG $2000
> >
> > LDAA #$00
>
> I don't see the "Key wakeup" part of these examples. I think key
> wakeup involves setting interrupts on a certain port to detect any
key
> pressed on a grid array.
>





Thanks for the input-
I hadn't had a chance to try it again yet-
Are those the correct addresses for the interrupt vectors for the
MC9S12DP256B?
Thanks-
Sophi

On 5/4/06, JCL wrote:
>
> hello,
> I agree with Jeff, KeyWakeups are interrupts on bits of ports H, J
> and P. They relay to interrupt vectors respectively $FFCC, $FFCE and
> $FF8E. The interrupt routine must test the status register of the
> concerned port to know which pin had requested an interrupt.
> Regards
> JCL
>
> --- In 6..., "Jefferson Smith" wrote:
> >
> > --- In 6..., MK wrote:
> > >
> > > Ok Sophi,
> > >
> > >
> > > find this code below. (delay generator)
> > >
> > > #include "Reg9s12.h"
> > >
> > > ORG $2000
> > >
> > > LDAA #$00
> >
> > I don't see the "Key wakeup" part of these examples. I think key
> > wakeup involves setting interrupts on a certain port to detect any
> key
> > pressed on a grid array.
> >
> SPONSORED LINKS
> Fast track
> Microcontrollers Technical
> support Intel
> microprocessors
> ------------------------------
> >.
> ------------------------------
>






--- In 6..., "Sophi Kravitz"
wrote:
>
> Thanks for the input-
> I hadn't had a chance to try it again yet-
> Are those the correct addresses for the interrupt vectors for the
> MC9S12DP256B?

Yes they are, but if you use D-Bug12 and the bootloader, you have to
put your interrupt vectors within $3E00-$3E7F, because it's the
bootloader which takes interrupts and redirects them to D-Bug12 which
will redirect them to this range of memory addresses.
The addresses I've posted are the very addresses of those interrupt
vectors.
See the getting-started.pdf doc you may have with your minidragon
board.

So long
JCL

> Thanks-
> Sophi
>
> On 5/4/06, JCL wrote:
> >
> > hello,
> > I agree with Jeff, KeyWakeups are interrupts on bits of ports H, J
> > and P. They relay to interrupt vectors respectively $FFCC, $FFCE
and
> > $FF8E. The interrupt routine must test the status register of the
> > concerned port to know which pin had requested an interrupt.
> > Regards
> > JCL
> >
> > --- In 6..., "Jefferson Smith"
> >
> > wrote:
> > >
> > > --- In 6..., MK wrote:
> > > >
> > > > Ok Sophi,
> > > >
> > > >
> > > > find this code below. (delay generator)
> > > >
> > > > #include "Reg9s12.h"
> > > >
> > > > ORG $2000
> > > >
> > > > LDAA #$00
> > >
> > > I don't see the "Key wakeup" part of these examples. I think key
> > > wakeup involves setting interrupts on a certain port to detect
any
> > key
> > > pressed on a grid array.
> > >
> >
> >
> >
> >
> >
> >
> > SPONSORED LINKS
> > Fast track
t=ms&k=Fast+track&w1=Fast+track&w2=Microcontrollers&w3=Technical+suppo
rt&w4=Intel+microprocessors&c=4&s=88&.sig=e25-7i8tBucE1eBf011Z9w>
> > Microcontrollerst=ms&k=Microcontrollers&w1=Fast+track&w2=Microcontrollers&w3=Technical
+support&w4=Intel+microprocessors&c=4&s=88&.sig=bFu_qpuq1yUlwG8a0ni-
jA> Technical
> > supportt=ms&k=Technical+support&w1=Fast+track&w2=Microcontrollers&w3=Technica
l+support&w4=Intel+microprocessors&c=4&s=88&.sig=3agMLHUjB-
tTW3k83uwUjA> Intel
> > microprocessorst=ms&k=Intel+microprocessors&w1=Fast+track&w2=Microcontrollers&w3=Tech
nical+support&w4=Intel+microprocessors&c=4&s=88&.sig=v-n-
hyvV_R1inJCf7ENHxA>
> > ------------------------------
> > >.
> >
> >
> > ------------------------------
> >
>
>
>
>