Go to Post The robot was spinning, I dont have the energy to spin like that. - Joe Menassa [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 01-03-2008, 09:37 PM
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Interrupt issue with new code

I've been trying to write the drive code for my current prototype drive, but I'm having issues.

This is the setup:
Hardware:
BaneBots gearbox connected to pwm01
Banebots encoder kit and encoder divider board installed on the gearbox.
Divider direction connected to rc_dig_in07
Divider speed connected to rc_dig_in03

Software:
Kevin's new code
In "interrupts.h"
#define ENABLE_INT_3_6 un-commented
In "teleop.c"
"Initialize_Int_3_6();" added to Initialization() where comments indicate.
Code:
void Teleop(void)
{
	static int i, j;
	i ++;
	j ++;

	if (i > 20)
	{
		printf("Encoder 1 Direction = %d\r\n", (int)ENCODER_ONE_DIRECTION);
		printf("Encoder 1 = %d\r\n\r\n", (int)Encoder_One_Count());
		i = 0;
	}

             //Run motor to demomstrate proper functioning
	if (j < 100)
	{
		Motor(1, 50);//in drive.c
	}
	else if (j < 150)
	{
		Motor(1, 0);
	}
	else if (j < 250)
	{
		Motor(1, -50);
	}
	else if (j < 300)
	{
		Motor(1, 0);
	}
	else
	{
		j = 0;
	}
	//Update_OI_LEDs();	// located in ifi_code.c
}
In "interrupts.c"
Call to "Encoder_One_Tick()"(in Drive.c) added in Int_3_Handler

EDIT: I attached the drive.c/.h files
The Direction displays correctly, but the count is always 0.

I'm sure I forgot something really simple, but I can't figure it out.

I'll send the complete project to anyone who wants to look at it.
Attached Files
File Type: c drive.c (854 Bytes, 80 views)
File Type: h drive.h (220 Bytes, 70 views)
__________________
Eric Haskins KC9JVH
 


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
Issue with downloading code to the 2007 RC thefro526 Programming 3 02-10-2007 05:26 PM
Trying to follow C18 interrupt context code... dcbrown Programming 5 12-21-2006 09:01 AM
interrupt in default code Gal Longin Programming 5 02-04-2006 08:10 PM
Interrupt timer, executing code asap? SeanCassidy Programming 10 03-07-2004 01:47 AM
EDU Interrupt and Timer Template Code Kevin Watson Robotics Education and Curriculum 2 12-14-2003 04:28 PM


All times are GMT -5. The time now is 08:30 AM.

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