Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Switch Function Problems (http://www.chiefdelphi.com/forums/showthread.php?t=62738)

darkdwarven 28-01-2008 19:51

Switch Function Problems
 
1 Attachment(s)
I am using a switch function with MPLAB within the autonomous section fo user_routines_fast.c and the code I've written up does not seem to be executing...ever. For example, when I load the attached code, the motors attached to the PWM outputs only turn for 3-4 seconds and stop. I asked another team about it and their response was that the delay right above the while loop was the reason. I changed the value to 570 and the results were the same.

Do you think the numbers next to the "#define" section are the issue or does MPLAB hate us and the switch function alltogether?

Any and all help is appreciated!
Thanks in advance,
Team 2348.

Joe Ross 28-01-2008 20:01

Re: Switch Function Problems
 
Code:

        static unsigned char delay;
          static unsigned char direction;
        static unsigned char time;

An unsigned char's maximum value is 255. Since you want to use values greater then that for time, you should use an int.

darkdwarven 29-01-2008 03:16

Re: Switch Function Problems
 
Thanks!

It works perfectly now. Next thing to do, figure out where we went wrong with IR sensors and I'm sure there is a thread out there with the information I need.


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

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