Go to Post Nothing motivates people to join like the promise of a trip to far-away lands of regional/championship competition during school days :) - Joe G. [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
  #1   Spotlight this post!  
Unread 18-01-2008, 20:15
rhoads2234's Avatar
rhoads2234 rhoads2234 is offline
Registered User
AKA: Erin
FRC #2234
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: PA
Posts: 80
rhoads2234 will become famous soon enough
Testing for bits in EasyC

my team wants to use the USB chicklet with the x-box360 controller

in the FIRSTwiki it explains how to test an individual bit in MPLab
I would like to make sure that code like the following is supported in EasyC

#define BUTTON_5 ((~p1_wheel &0x80)!=0)
I think it should work but there might be some obscure reason why it might not

Confirmations with reasons or denials would be great! Thank you in advance!
__________________
ALWAYS a mechanical problem!
  #2   Spotlight this post!  
Unread 18-01-2008, 22:07
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: Testing for bits in EasyC

Paul recommend we use

dpad_top = (GetOIAInput ( 1 , 3 )&1<<7)?0:1 ;
dpad_bottom = (GetOIAInput ( 1 , 3 )&1<<6)?0:1 ;
dpad_left = (GetOIAInput ( 1 , 3 )&1<<5)?0:1 ;
dpad_right = (GetOIAInput ( 1 , 3 )&1<<4)?0:1 ;

left_top = (GetOIAInput ( 1 , 4 )&1<<7)?0:1 ;
right_top = (GetOIAInput ( 1 , 4 )&1<<6)?0:1 ;
left_trigger = (GetOIAInput ( 1 , 4 )&1<<5)?0:1 ;
right_trigger = (GetOIAInput ( 1 , 4 )&1<<4)?0:1 ;


I'm not sure how to properly define this so the compiler does barf but if you can do it in C you can do it in easyC

edit: I got it to work I think...

Click on the projects tab and paste:

#define BUTTON_5 ((~GetOIAInput ( 1 , 3 ) &0x80)!=0) // same as p1_wheel

Into UserInclude.h

Also the Xbox controller itself isn't the best unit the thumbsticks stick and don't recenter well. The Logictech "PS2" like controller works better.
__________________
FIRST Team 501 PowerKnights - Mentor
FIRST Team 40 Checkmate - Mentor Alum
FIRST Team 146 Blue Lightning - Alumni

Last edited by Kingofl337 : 18-01-2008 at 22:18.
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
pic: Almost ready for testing Doug G Robot Showcase 4 04-02-2006 18:49
How do i connect the camera for testing? naor52 Programming 1 12-01-2006 01:11
Testing Motor for Specs? indieFan Motors 12 07-11-2004 18:36
Budget OI/RC for testing Racer26 General Forum 1 09-07-2004 21:15
Tips for Sensor Programming and Testing EricEnsor Programming 3 24-01-2003 11:28


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

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