Go to Post At a much more pragmatic level, organization is what seperates a team full people with really cool unrealized dreams and a team that is trying to figure out it's alliance picks. - phrontist [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
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
  #2   Spotlight this post!  
Unread 27-01-2006, 20:14
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Digital I/O Help

There are two ways you can do what you want. The first is the easy way:
  1. Create either a global variable or a static local variable where you will store your count
  2. Somewhere in the 26.2 ms loop area, have an if statement which increments the variable if the digital io is pressed. IE:
    Code:
    if(digital_io_01 == 0) // Note that the inputs are pulled high, so when the sensor is indicating it is pressed, you are actually getting 0
        countVariable++;

The second way involves using interrupts and is slightly more difficult, but necessary if you are going to be getting digital IO state changes at a high rate. (An encoder on a drive wheel would be an example of something which typically needs interrutps.)
__________________

 


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
Digital Caliper as a Digital Readout on Small Mill sanddrag Technical Discussion 9 13-10-2005 22:51
Dynamic Input/Output Changing Paolo Control System 6 23-09-2004 19:09
heres the code. y this not working omega Programming 16 31-03-2004 15:18
digital inputs not valid just after initialization? WizardOfAz Programming 2 26-01-2004 13:21
digital i/o connectors Mercutio Electrical 4 19-01-2004 19:20


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

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