BasicMicro - Forums

www.basicmicro.com
It is currently Mon May 21, 2012 1:00 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: ATOM Pro 28-M Interrupts
PostPosted: Sun Jun 06, 2010 2:18 pm 
Offline
New User

Joined: Sun Jun 06, 2010 12:17 pm
Posts: 3
I just started using Basic Micro (after using another type for a few years), and I'm enjoying it so far. I'm working on a project that requires interrupts and I can't seem to get it working on the ATOM Pro 28-M. Here is the code:

Code:
oninterrupt irq2int,flag

prefix var byte
clr var byte

enable irq2int

prefix=0xFE
clr=0x51

main
   
   serout p16,I9600,[prefix,clr]
   serout p16,I9600,["Hello world!"]
   
   pause 1000
   
   SEROUT P16,I9600,[prefix,clr]
   
   pause 1000
   
   goto main

flag

   HIGH P13

   pause 1000
   LOW P13
   
   resume


All I'm trying to do is a "proof of concept" with the interrupt. When I execute this code on the micro processor, the main routine executes and displays "Hello World" on an LCD display. I attempt to apply a logic high or low on P18 in hopes of activating the "flag" routine. When activated, the "flag" routine should cycle the LED connected to P13. But, when the signal is applied, nothing happens.

Any ideas as to why I can't seem to trigger an interrupt? I'm using Basic Micro Studio 1.0.0.15 to write/compile/execute.

Thanks in advance!


Top
 Profile  
 
 Post subject: Re: ATOM Pro 28-M Interrupts
PostPosted: Mon Jun 07, 2010 6:00 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
Hi,

I have a lot of information about interrupts up on this thread on the Lynxmotion forum: http://www.lynxmotion.net/viewtopic.php?f=4&t=3496

On your sample program, first problem is that you probably need to enable global interrupts as well as the specific one. That is you need to do something like:
Code:
    enable irq2int
    enable


My guess is that might do the trick.

Kurt


Top
 Profile  
 
 Post subject: Re: ATOM Pro 28-M Interrupts
PostPosted: Tue Jun 08, 2010 8:38 pm 
Offline
New User

Joined: Sun Jun 06, 2010 12:17 pm
Posts: 3
Kurt,

Thanks for the Lynxmotion link on interrupts.

I inserted the global enable line into my code as you suggested but that didn't seem to change anything. With the global interrupt enable command I tried a few different interrupts, all with no success. Any more ideas?

Thanks!


Top
 Profile  
 
 Post subject: Re: ATOM Pro 28-M Interrupts
PostPosted: Wed Jun 09, 2010 6:50 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
The next question is how are you triggering the interrupt. If you are trying it by doing a HIGH P18 or LOW P18, that may not work as the High/low code may make sure the IO port is set to be a standard IO Pin and not an Interrupt type pin...

You could probably emulate it, but taking a servo extension wire and jumper from some other IO pin to the interrupt pin. For example you could connect P0 to P18 and then do either a HIGH or a LOW pin p0.
Which will trigger depends on the state of the IO register IEGR1.bit2 More information about this is in the H8/3694 document.

It has been a little while since I played with these interrupts, especially in basic. So let me know if that works out :D.

Update: I am not having any luck with P2 here either. I tried with both Basic and ASM... I tried a jumper from P17 to P18 and my test program looks like:
Code:
ASMINT con 1
#ifdef ASMINT
onasminterrupt irq2int,IRQ2_INT
#else
oninterrupt IRQ2INT, IRQ2_INT
#endif

PMR1.bit6 = 1 ; enable pin to IRQ2 interrupt instead of normal I/O
IEGR1.bit2 = 1 ; Interrupt IRQ2 on rising edge
enable irq2int
enable
LOW P6
main:
   toggle p5
   pause 500
   high p17
   pause 1
   low p17   
   goto main

#ifdef ASMINT
  BEGINASMSUB
IRQ2_INT:
;   push.l er1                  ; first save away ER1 as we will mess with it.
   bclr #2,@IRR1:8               ; clear the IRQ2 bit in the interrupt pending mask
   andc #0x7f,ccr               ; allow other interrupts to happen
   
   ;
   BSET #6,@PCR5:8
   BNOT #6,@PDR5:8
   
   rte
   ENDASMSUB
#else
IRQ2_INT:
   toggle p6
   resume
#endif

This is an BAP28 on an old Lyxmotion atom bot board which has LEDS on P4-P6, I would expect to have the two LEDS both blink. I am getting the one that shows the program is running... I am running this on Studio Build 30...

Will email BasicMicro with this...

Kurt


Top
 Profile  
 
 Post subject: Re: ATOM Pro 28-M Interrupts
PostPosted: Wed Jun 09, 2010 7:53 pm 
Offline
New User

Joined: Sun Jun 06, 2010 12:17 pm
Posts: 3
I'm trying to trigger the interrupt externally. For this proof of concept I'm manually touching a +5 jumper to the interrupt pin. In practice, the interrupt will be triggered from another (totally independent) microcontroller that sends a logic high signal.

To be clear, I've also tried this on WKPINT_0 (which is supposed to work on a pin change) with no success.

Thanks for contacting Basic Micro....I'm interested to hear what they have to say...


Top
 Profile  
 
 Post subject: Re: ATOM Pro 28-M Interrupts
PostPosted: Wed Jun 09, 2010 8:30 pm 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
I played around a little and found it looks like IRQ2 may be on P19? I moved my jumper from P18 to P19 and I started to get my P6 LED to flash...

Not sure about WKPINT_0 yet. But you may need to do a slight tweak on setting a few bits...

That is you may need to add:
PMR5.bit0 = 1 ; Change the pin from IO to interrupt pin.
IEGR1.bit0 = ? ; 1 if you want it on the rising edge 0 if you want it on the trailing edge.

Kurt


Top
 Profile  
 
 Post subject: Re: ATOM Pro 28-M Interrupts
PostPosted: Thu Jun 10, 2010 2:48 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
Below is the BasicAtomPro 28 pin module pinouts to Renesas pins

Yes, IRQ2 is on p19

Also if you are using the Universal Development Board the 28pin modules P16 to P19 come out on P28 to P31 of the solderless breadboard are.

Code:
BAP28   Renesas
P0   (P50/WKP0)<->(PB0/AN0)   
P1   (P51/WKP1)<->(PB1/AN1)   
P2   (P52/WKP2)<->(PB2/AN2)   
P3   (P53/WKP3)<->(PB3/AN3)   
P4   (P54/WKP4)               
P5   (P55/WKP5/ADTRG)         
P6   (P56/SDA)<->(P74/TMRIV on RevD)
P7   (P57/SCL)<->(P10/TMOW on RevD)
P8   (P80/FTCI)<->(P15/IRQ1)   
P9   (P81/FTIOA)<->(P74/TMRIV pre RevD)
P10   (P82/FTIOB)
P11   (P83/FTIOC)
P12   (P84/FTIOD)<->(P10/TMOW pre RevD)
P13   (P85)<->(P20/SCK3)       
P14   (P86)<->(P21/RXD)       
P15   (P87)<->(P22/TXD)       
P16   (P11)<->(PB7/AN7)       
P17   (P12)<->(PB6/AN6)           
P18   (P17/IRQ3)<->(PB4/AN4)   
P19   (P16/IRQ2)<->(PB5/AN5)   


I also tested Kurts code above and it seems to be working as expected.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO