Go to Post the always so humble metal-in-motion.....i know your tricks; you all are gonna have a killer robot as usual.... - Stephen Kowski [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 28-09-2003, 01:47
djcapelis's Avatar
djcapelis djcapelis is offline
Fried Manic Custard
None #0675 (Geeks with Power Tools)
Team Role: Programmer
 
Join Date: May 2003
Rookie Year: 2001
Location: Rohnert Park, CA
Posts: 129
djcapelis will become famous soon enoughdjcapelis will become famous soon enough
Send a message via ICQ to djcapelis Send a message via AIM to djcapelis Send a message via Yahoo to djcapelis
Function jump, as in jumping to a function.

For example... (ignore the mix of c++ and the bad syntax, haven't used c-based programming in a bit)

void my_fuction();

void my_fuction()
{
cout << "Doggies run at midnight" << endl;
}

int main()
{
cout << "Jumping" << endl;
my_function();
return 1;
}

When the program calls my_function it would make a function jump and go to another place in the code, I believe... exactly as you described.

This can be hacked in PBASIC with GOTOs but isn't elegant in the least. So interrupts allow you to employ properly coded functions then... am I correct?
__________________
"I have more friends than enemies, I'm working to resolve the issue."
  #17   Spotlight this post!  
Unread 28-09-2003, 02:01
FotoPlasma FotoPlasma is offline
\: |
no team
 
Join Date: Jul 2001
Rookie Year: 2001
Location: San Jose
Posts: 1,900
FotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond repute
Send a message via AIM to FotoPlasma
Ah. I don't think so. What you're doing is calling my_function() from within main(). What an interrupt would look like is this:
Code:
void main(void) {
/* these aren't the droids you're looking for, go about your business */
}

void interrupt1(void) {
/* do this stuff when interrupt 1 is encountered */
}

void interrupt2(void) {
/* do this stuff when interrupt 2 is encountered */
}
So, you wouldn't call interrupt1() or interrupt2() from anywhere in main() (although you could, if you wanted), but whenever the system received an interrupt signal, it would stop what it's doing in main(), and execute (or jump to, if you prefer) the predefined interrupt function, and then come back to main(). Another way of thinking of it might be to think of the system inserting a function call into the program at any point, depending on when it receives the interrupt signal. Whenever that signal is received, it automatically executes this predefined function.

Hrm. I just repeated myself a few times. I hope it makes some sense.

As for PBASIC, that language has subroutine functionality (through GOSUB and labels), which is sort of like a function, but it doesn't take any arguments and it doesn't return any value.
__________________
I played hacky sack with Andy Baker.

2001-2004: Team 258, The Sea Dawgs
2005: Team 1693, The Robo Lobos

Last edited by FotoPlasma : 28-09-2003 at 02:03.
  #18   Spotlight this post!  
Unread 28-09-2003, 02:09
djcapelis's Avatar
djcapelis djcapelis is offline
Fried Manic Custard
None #0675 (Geeks with Power Tools)
Team Role: Programmer
 
Join Date: May 2003
Rookie Year: 2001
Location: Rohnert Park, CA
Posts: 129
djcapelis will become famous soon enoughdjcapelis will become famous soon enough
Send a message via ICQ to djcapelis Send a message via AIM to djcapelis Send a message via Yahoo to djcapelis
Oh, ic... an external interface triggers the interrupts, not the program itself.

I get it now... thanks.

(BTW, declaring main as void violates the language standards, technically that isn't legal. Compilers compile it anyways because people like breaking it... but exit codes are a good thing. Anyways...)

(Also, in case you were wondering where the jump part came from, I'd guess it's roots are probably in the ASM jmp instruction.)
__________________
"I have more friends than enemies, I'm working to resolve the issue."
  #19   Spotlight this post!  
Unread 28-09-2003, 02:12
FotoPlasma FotoPlasma is offline
\: |
no team
 
Join Date: Jul 2001
Rookie Year: 2001
Location: San Jose
Posts: 1,900
FotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond repute
Send a message via AIM to FotoPlasma
Ah. I should have made that more clear.

Glad I could be of service, though.

(I never claimed to adhere to standards )

(Yeah, it is)
__________________
I played hacky sack with Andy Baker.

2001-2004: Team 258, The Sea Dawgs
2005: Team 1693, The Robo Lobos
  #20   Spotlight this post!  
Unread 28-09-2003, 12:58
Unsung FIRST Hero
Matt Leese Matt Leese is offline
Been-In-FIRST-Too-Long
FRC #1438 (The Aztechs)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1998
Location: Long Beach, CA
Posts: 937
Matt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond repute
Send a message via AIM to Matt Leese
I wanted to answer the question as to what 10 MIPS means: absolutely nothing. MIPS is really just a meaningless relationship because it doesn't show what type of instruction was executed. It could've been a series of NOP's. It can be rather frustrating trying to figure out how fast a CPU is just by manufacturer's information.

Matt
  #21   Spotlight this post!  
Unread 28-09-2003, 14:38
DanL DanL is offline
Crusty Mentor
FRC #0097
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: Somerville, MA
Posts: 682
DanL is just really niceDanL is just really niceDanL is just really niceDanL is just really niceDanL is just really nice
Send a message via AIM to DanL
In my Cisco Networking class, we learned all about interrupts... if someone was playing a game on the computer rather than work, my teacher would go up to him...
"Do you know what an interrupt is?"
"...interrupt?"
*hits power button* "Yes, interrupt."
__________________
Dan L
Team 97 Mentor
Software Engineer, Vecna Technologies
  #22   Spotlight this post!  
Unread 28-09-2003, 16:57
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
Hehe, learning interrupts the hard way...

The best part is that with ATX, you don't break Windows horrible when you hit the button.


Now, about these interrupts. Do they actually mean anything to us, if the code is structured at all like last year?

Last year, you could process all you wanted, but only output once per cycle. Will it be different now, since we can control all the pins, or will it be the same? If it's switch something whenever, however, then interrupts will be cool, otherwise, they seem nice, but kinda pointless.

Also, any ideas on whether or not we'll be getting a default code to build off of if we so choose?
__________________
AIM --> Woloi
Email --> ian@woloschin.com
  #23   Spotlight this post!  
Unread 28-09-2003, 17:15
djcapelis's Avatar
djcapelis djcapelis is offline
Fried Manic Custard
None #0675 (Geeks with Power Tools)
Team Role: Programmer
 
Join Date: May 2003
Rookie Year: 2001
Location: Rohnert Park, CA
Posts: 129
djcapelis will become famous soon enoughdjcapelis will become famous soon enough
Send a message via ICQ to djcapelis Send a message via AIM to djcapelis Send a message via Yahoo to djcapelis
Random wild speculations on your questions:

1) Interrupts will be useful for external first controlled operations so they can send signals to the bot that we can act on. (Auton triggers? Perhaps _optional_ auton triggers so teams that opt to go auton will be able to get a few extra points or something.) I dunno, just wild speculation. Or Interrupts allow us to press a button and have an action immediately take place.

2) Default code will probably be provided. Especially if the thing is done in C this year, they will need to give teams something to help them out. I can't imagine them not doing that....

3) Raw I/O access seems to indicate that we will be able to pull data in and out of pins at any point in the program. For a good autonomous mode, this seems like it would kinda be neccessary.

Wild speculation that has nothing to do with your message:

4) Auton mode will probably be vastly expanded this year?

5) The game might be changed to include signals from FIRST controllers to the bot that signify special events?

6) Something is up for this year... it's going to be nifty.
__________________
"I have more friends than enemies, I'm working to resolve the issue."
  #24   Spotlight this post!  
Unread 28-09-2003, 19:12
Lloyd Burns Lloyd Burns is offline
Registered User
FRC #1246 (Agincourt Robotics)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Toronto
Posts: 292
Lloyd Burns is an unknown quantity at this point
Interrupts might, for example, make it easy for you to implement shaft encoding on your axles, where a change of voltage level on a pin will cause the encoder service routine to be executed (right away, not after the next block of instructions has been successfully received from the OI, as has been the case).

It will ensure that your special on-board g5-based massively-parallel 49 YHz screamer can pass data to or from the IFI CPU (The little engine that though it might be able ?). Now you can write both computers' programs in the same language... well, maybe not.

BTW, in the microchip PIC series, an interrupt causes the various processor regs to be stored, and then execution always jumps to program memory location 4 hex, so you may have to write an interrupt check-and-sort-it-out routine (in C) to go at hex 4 which will have jumps to the routine appropriate to the interrupt; probably the compiler will insert a jump around all this for start up, which always commences at 0 hex.
  #25   Spotlight this post!  
Unread 28-09-2003, 20:48
FotoPlasma FotoPlasma is offline
\: |
no team
 
Join Date: Jul 2001
Rookie Year: 2001
Location: San Jose
Posts: 1,900
FotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond repute
Send a message via AIM to FotoPlasma
Quote:
Originally posted by Lloyd Burns
BTW, in the microchip PIC series, an interrupt causes the various processor regs to be stored, and then execution always jumps to program memory location 4 hex, so you may have to write an interrupt check-and-sort-it-out routine (in C) to go at hex 4 which will have jumps to the routine appropriate to the interrupt; probably the compiler will insert a jump around all this for start up, which always commences at 0 hex.
I have been reading about various PICs for the past couple days, and some of the higher-end processors have multiple interrupt priorities which you can set (high and low). In the PIC18 series, the interrupt vectors for high and low priority interrupts are 0x8 and 0x18, respectively. You can manually poll the interrupt flags from within an interrupt routine to determine where you're coming from (or perhaps why you're going there), luckilly.

I hope the compiler we're to use supports inline assembly...
__________________
I played hacky sack with Andy Baker.

2001-2004: Team 258, The Sea Dawgs
2005: Team 1693, The Robo Lobos
  #26   Spotlight this post!  
Unread 28-09-2003, 21:26
djcapelis's Avatar
djcapelis djcapelis is offline
Fried Manic Custard
None #0675 (Geeks with Power Tools)
Team Role: Programmer
 
Join Date: May 2003
Rookie Year: 2001
Location: Rohnert Park, CA
Posts: 129
djcapelis will become famous soon enoughdjcapelis will become famous soon enough
Send a message via ICQ to djcapelis Send a message via AIM to djcapelis Send a message via Yahoo to djcapelis
Inline asm is pretty standard on good chips I think...

I'm just gonna be annoyed if it won't work on linux.
__________________
"I have more friends than enemies, I'm working to resolve the issue."
  #27   Spotlight this post!  
Unread 28-09-2003, 22:09
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Interrupts are used when input signals can change state at random times, and you have to respond to that signal immediately.

a so so example is the keyboard on your PC. The processor has no way to anticipate when you will push a key, so that would be an interrupt

whenever you hit one, the code would stop whatever it was doing, go see what key you pressed, put that in a que or buffer somewhere, then go back to its regularly scheduled program

(thats not a really good example because the speed at which we type is extreemly slow to a processor, so it has plenty of time to go see what key you pressed, but you get the general idea)

on a bot something like a shaft encoder that puts out a pulse on each revolution - that could be an interrupt

or important things that need immediate attention, like a kill switch.

But if you want to know what an interrupt REALLY is

back when I was in engineering school, if you were walking down the hall talking to a friend and a girl walked by, that was an interrupt (we would stop talking for a second to activate the track and scan function)

and when she was gone you execute the return-from-interrupt instruction

(ah, those were the days! )
  #28   Spotlight this post!  
Unread 28-09-2003, 22:32
vladg12 vladg12 is offline
Registered User
#0117
 
Join Date: Sep 2003
Location: Pittsburgh
Posts: 7
vladg12 is an unknown quantity at this point
Interrupts

No one has mentioned the most useful purpose of interrupts: TIMERS! Every time a timer overflows (which is in the order of microsecs), an interrupt is generated. This would be important for generating PWM signals (unless the chip has special PWM outputs), as well as for "accurate" (well, more accurate than with PBASIC) dead-reckoning code.
  #29   Spotlight this post!  
Unread 28-09-2003, 23:42
djcapelis's Avatar
djcapelis djcapelis is offline
Fried Manic Custard
None #0675 (Geeks with Power Tools)
Team Role: Programmer
 
Join Date: May 2003
Rookie Year: 2001
Location: Rohnert Park, CA
Posts: 129
djcapelis will become famous soon enoughdjcapelis will become famous soon enough
Send a message via ICQ to djcapelis Send a message via AIM to djcapelis Send a message via Yahoo to djcapelis
Quote:
But if you want to know what an interrupt REALLY is

back when I was in engineering school, if you were walking down the hall talking to a friend and a girl walked by, that was an interrupt (we would stop talking for a second to activate the track and scan function)

and when she was gone you execute the return-from-interrupt instruction

(ah, those were the days! )
You need an interrupt for that? I thought that was the main program loop...

You also seem to be missing the ask_number and make_conversation functions, file corruption perhaps?
__________________
"I have more friends than enemies, I'm working to resolve the issue."
  #30   Spotlight this post!  
Unread 29-09-2003, 03:21
WakeZero WakeZero is offline
FIRST-a-holic Strategist
#1011 (CRUSH)
 
Join Date: Feb 2002
Location: Tucson, AZ
Posts: 316
WakeZero will become famous soon enough
Send a message via AIM to WakeZero Send a message via Yahoo to WakeZero
I like C, this news makes me very happy
__________________
2004 Arizona Regional -- Semifinalist
2003 NAT Galileo Division -- Highest Seeded Rookie (20th)
2003 NAT Galileo Division -- 100% Autonomous Completion (7 for 7)
2003 Arizona Regional -- Rookie All-Star Award
2003 Arizona Regional -- Quarterfinalist

Alumni on Team 64, The Gila Monsters
College Mentor/Founder of Team 1011, CRUSH
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
C controller Rorschach Kit & Additional Hardware 1 29-10-2003 19:21
serious problem found - robot controller resets when jarred! KenWittlief Electrical 23 19-03-2003 13:30
Visibility of Robot Controller and Reset Button Tracy Rules/Strategy 1 17-02-2003 07:36
How do you connect the speed controller fans? Iain Electrical 7 31-01-2003 07:05
visibility of robot controller? davidzhang Rules/Strategy 5 26-01-2003 01:11


All times are GMT -5. The time now is 21:21.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi