Go to Post The answer the last 3 years would be any regional that 1114 attends. - Cory [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
  #31   Spotlight this post!  
Unread 12-03-2004, 20:16
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: quick question: TIMERS

I just relized something. In the initialize routines for the timers, the first 2 lines are address setters (I think). Most of mine are 0x00! Does this make a difference?
  #32   Spotlight this post!  
Unread 12-03-2004, 22:21
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,825
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: quick question: TIMERS

Quote:
Originally Posted by Astronouth7303
I just relized something. In the initialize routines for the timers, the first 2 lines are address setters (I think). Most of mine are 0x00! Does this make a difference?
No. Those just mean the timer starts at 0.

Believe I found the problem.
TICKS is declared as char (-127 to 127)
You are checking for 255 as an overflow.
TIME will never increment.


I grabbed Kevins interrupt code and added your code to the interrupt handler.
Only difference is I just declared your globals as static just within interrupts.c for my ease of duplicating your results.

TICKS and AUTOCLOCK increment as you wanted.

In Initialize_Timer_1 I changed:
Code:
PIE1bits.TMR1IE = 1;
T1CONbits.TMR1ON = 1;
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #33   Spotlight this post!  
Unread 12-03-2004, 22:47
Xufer's Avatar
Xufer Xufer is offline
8 Seasons and as stable as ever
AKA: Working, 2/4 degrees complete still schooling...
FRC #1740 (The Cyber Colonels)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Waterford, CT
Posts: 231
Xufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to behold
Send a message via AIM to Xufer Send a message via MSN to Xufer Send a message via Yahoo to Xufer
Re: quick question: TIMERS

before i enable one of those timers, is there anythign i should know about which one would work best are there significant differences for them, i noticed you can change the ammount of time each tick increses the clock by.

once i enable one im still confused as far as the state switches and the case statements, idon't understand how the whole thing works is there any documentation or sample code i can look through, im really stumped and i would like to get a timer working.
__________________


If saftey is first and i put FIRST ahead of everything, then i must be the safest guy in the world.

Team 521 Alumni -- Team 1740 Mentor-- Go Go 1740!
Sometimes I think I've been doing this too long and other times I think I haven't done this enough... but all the times I'm sure I'm crazy
Photonics, It's Your Future
  #34   Spotlight this post!  
Unread 13-03-2004, 22:58
10intheCrunch's Avatar
10intheCrunch 10intheCrunch is offline
Who's John V-Neun?
AKA: Alex Baxter
None #0254 (Cheesy Poofs)
Team Role: College Student
 
Join Date: Feb 2004
Rookie Year: 2004
Location: San Jose, CA
Posts: 129
10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough
Send a message via AIM to 10intheCrunch
Re: quick question: TIMERS

OK...I really want to help you dude but it seems like you don't understand what we're trying to say each time, or I can't explain it well enough...why don't you IM me (sn: TenintheCrunch)? I think I'll be able to help you more talking directly

Cheers,
__________________
~Alex Baxter
Programming, Arms operation, Team 254
  #35   Spotlight this post!  
Unread 15-03-2004, 07:29
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: quick question: TIMERS

I changed a compiler option to assume Char is unsigned. I only use a signed char one place, -1 - 1, and it's declared as signed. I also sent TICK to dashboard, and it didn't work. I didn't have IE set to 1, but I didn't think it would make a difference (it would just be slower, right?)
  #36   Spotlight this post!  
Unread 15-03-2004, 10:14
10intheCrunch's Avatar
10intheCrunch 10intheCrunch is offline
Who's John V-Neun?
AKA: Alex Baxter
None #0254 (Cheesy Poofs)
Team Role: College Student
 
Join Date: Feb 2004
Rookie Year: 2004
Location: San Jose, CA
Posts: 129
10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough
Send a message via AIM to 10intheCrunch
Re: quick question: TIMERS

Where's the option for making chars unsigned by default? Does that affect ints and longs as well?
__________________
~Alex Baxter
Programming, Arms operation, Team 254
  #37   Spotlight this post!  
Unread 15-03-2004, 10:36
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,825
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: quick question: TIMERS

Quote:
Originally Posted by 10intheCrunch
Where's the option for making chars unsigned by default? Does that affect ints and longs as well?
You set compiler flags in MPLAB
Project->Build Options...->Project
under tab "MPLAB C18"

There is a quick radio button for treating "char" as unsigned and one for forcing all calculations to be performed at least as int rather than the smallest type included in the calculation.
You can also enter your own flags by clicking on "Use Alternate Settings" and typing into the box that becomes enabled. You'll find the available compiler flags documented in the MPLAB C18 C Compiler User's Guide that came on the MPLAB installation CD, Appendix C. e.g., -k is the flag for treating char as unsigned. When you click on the radio button you'll see "-k" appear in the "Inherit global settings" window.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #38   Spotlight this post!  
Unread 15-03-2004, 10:41
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,825
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: quick question: TIMERS

Quote:
Originally Posted by Astronouth7303
I didn't have IE set to 1, but I didn't think it would make a difference (it would just be slower, right?)
If you mean:
INTCON3bits.INT2IE = 1;
Yes, this is required. It's your on/off switch for individual interrupts. It enables the interrupt which is disabled by default. Otherwise, nothing will happen.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 15-03-2004 at 11:14.
  #39   Spotlight this post!  
Unread 15-03-2004, 11:24
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: quick question: TIMERS

Banner interupts work, but not timers.
  #40   Spotlight this post!  
Unread 15-03-2004, 11:49
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,825
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: quick question: TIMERS

Quote:
Originally Posted by Astronouth7303
Banner interupts work, but not timers.
Sorry I mistyped and used the external interrupt flag. I meant to type:
Code:
PIE1bits.TMR1IE = 1;
This is required to turn on interrupt on timer overflow.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #41   Spotlight this post!  
Unread 15-03-2004, 16:23
Xufer's Avatar
Xufer Xufer is offline
8 Seasons and as stable as ever
AKA: Working, 2/4 degrees complete still schooling...
FRC #1740 (The Cyber Colonels)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Waterford, CT
Posts: 231
Xufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to behold
Send a message via AIM to Xufer Send a message via MSN to Xufer Send a message via Yahoo to Xufer
Re: quick question: TIMERS

i got my ded reckoning worked out and i have a switch wired up to switch between the two modes how would i do that using case statements?

it should be something like


case1 if (rc_dig_in_10=1)
{auton 1}

case2 else(rc_dig_in10=0)
{auton 2}

i read about them but how would they be used to work with a digital input from the rc
__________________


If saftey is first and i put FIRST ahead of everything, then i must be the safest guy in the world.

Team 521 Alumni -- Team 1740 Mentor-- Go Go 1740!
Sometimes I think I've been doing this too long and other times I think I haven't done this enough... but all the times I'm sure I'm crazy
Photonics, It's Your Future
  #42   Spotlight this post!  
Unread 15-03-2004, 16:48
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,825
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: quick question: TIMERS

Quote:
Originally Posted by Xufer
i got my ded reckoning worked out and i have a switch wired up to switch between the two modes how would i do that using case statements?

it should be something like


case1 if (rc_dig_in_10=1)
{auton 1}

case2 else(rc_dig_in10=0)
{auton 2}

i read about them but how would they be used to work with a digital input from the rc
You don't need a case statement if you only have two choices.
Code:
if (rc_dig_in_10 == 1)  //or just "if (rc_dig_in_10)"
{auton 1}
else
{auton2}
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #43   Spotlight this post!  
Unread 15-03-2004, 23:26
Xufer's Avatar
Xufer Xufer is offline
8 Seasons and as stable as ever
AKA: Working, 2/4 degrees complete still schooling...
FRC #1740 (The Cyber Colonels)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Waterford, CT
Posts: 231
Xufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to behold
Send a message via AIM to Xufer Send a message via MSN to Xufer Send a message via Yahoo to Xufer
Re: quick question: TIMERS

Quote:
Originally Posted by Mark McLeod
You don't need a case statement if you only have two choices.
Code:
if (rc_dig_in_10 == 1)  //or just "if (rc_dig_in_10)"
{auton 1}
else
{auton2}
will that work if my autonmode begins in if statements though ? i tried something along those lines and it didnt seem to work...
__________________


If saftey is first and i put FIRST ahead of everything, then i must be the safest guy in the world.

Team 521 Alumni -- Team 1740 Mentor-- Go Go 1740!
Sometimes I think I've been doing this too long and other times I think I haven't done this enough... but all the times I'm sure I'm crazy
Photonics, It's Your Future
  #44   Spotlight this post!  
Unread 16-03-2004, 10:37
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,825
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: quick question: TIMERS

Quote:
Originally Posted by Xufer
will that work if my autonmode begins in if statements though ? i tried something along those lines and it didnt seem to work...
It will work.
If you try it and it doesn't behave as you expect post the error here and we'll help you debug any problems.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #45   Spotlight this post!  
Unread 16-03-2004, 13:26
10intheCrunch's Avatar
10intheCrunch 10intheCrunch is offline
Who's John V-Neun?
AKA: Alex Baxter
None #0254 (Cheesy Poofs)
Team Role: College Student
 
Join Date: Feb 2004
Rookie Year: 2004
Location: San Jose, CA
Posts: 129
10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough
Send a message via AIM to 10intheCrunch
Re: quick question: TIMERS

Quote:
Originally Posted by Xufer
i got my ded reckoning worked out and i have a switch wired up to switch between the two modes how would i do that using case statements?

it should be something like


case1 if (rc_dig_in_10=1)
{auton 1}

case2 else(rc_dig_in10=0)
{auton 2}

i read about them but how would they be used to work with a digital input from the rc
You don't need to use case statements, but there are a couple other things you have to do.

When you enter autonomous mode, all inputs are reset to neutral, so you have to capture the value from rc_dig_in_10 before autonomous turns on. Create a prevRcDigIn10 variable, and set that equal to the current one at the end of every loop (right before putdata()), then when you move into autonomous, look at that previous varialbe, not the real one (the "real" one will always be zero).
__________________
~Alex Baxter
Programming, Arms operation, Team 254
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
Quick Question Burgabot Programming 31 02-12-2003 19:22
Quick <hr> question Jack Website Design/Showcase 1 31-01-2003 22:19
A quick question Joelster Technical Discussion 6 10-02-2002 09:09
quick question about qualifying points Hymnson General Forum 4 25-09-2001 21:19
Quick Question, i guess Andrew Rudolph Motors 1 12-08-2001 14:39


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

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