BasicMicro - Forums

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

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Can we setup Software Traps on Baps
PostPosted: Sat Oct 09, 2010 2:12 pm 
Offline
Master

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

Can you do an Oninterrupt or an OnAsmInterrupt for the different Trap interrupt vectors? For example I know that the H8/3694 as well as the H8/3687 both have 4 trap vectors.

Kurt


Top
 Profile  
 
 Post subject: Re: Can we setup Software Traps on Baps
PostPosted: Sat Oct 09, 2010 5:59 pm 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
A quick update, I tried a few different combination of names an this compiles:
oninterrupt TRAP0INT, handle_wkp

I have not tried to use it yet. Trying to decide if I wish to still do a WKPINT in asm to catch which of the 6 legs contact switches makes contact. I started off with an ASM interrupt handler, which figures out which pin was WKPINT pin that was triggered as well as my clock time. With that though I may want to send commands to the SSC-32 so doing this an ASM won't be easy. So this part may be better in Basic. Many options here.
1) Convert the WKPINT interrupt to WKPINT_0-WKPINT_5 interrupts. More overhead here, they will all probably then call a common function with which interrupt happened. This will have more overhead to grab the time, but could compensate by guessing it added 7 push.ls...
2) Leave WKPINT as ASM, save away time and channel and then do a trap which would then jump to the Trap handler which could be in basic. Probably more overhead to do it this way but could be fun.

Kurt


Top
 Profile  
 
 Post subject: Re: Can we setup Software Traps on Baps
PostPosted: Mon Oct 11, 2010 8:08 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
You can but I've never tried it. :)

You have to send an ASM trap command to initiate one of the TRAP interrupts so I never saw the use of it since you could just run your code instead of forcing the trap to execute. I'm sure these were primarily designed for use as some kind of BIOS interrupt.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Can we setup Software Traps on Baps
PostPosted: Mon Oct 11, 2010 8:19 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
Yep, also have seen them used in other processors for other exception handling. Like for example if a low level function fails to allocate memory it throws trap x which in it's handler may do something special like GC or maybe someone registered an exception address (like a setjmp), that the handler trims junk off the stack and then sets up to return to a predefined configuration...)

Kurt


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 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