ts-7000
[Top] [All Lists]

[ts-7000] XDIO question

To:
Subject: [ts-7000] XDIO question
From: "kvnherrera" <>
Date: Fri, 16 Nov 2007 23:59:54 -0000
Hi there, I've been working on the TS-7300 for a while, I need to use
the XDIOs as inputs, so I downloaded the XDIO API, that's provided on
the webpage, and It worked nice! But then I tried to use the same API
for a custom program, on mine on theory, I configure the DIO3 like an
input, and then I want to count up to a user selected number, my code
is this (well, I didn't include the licence and that stuf):


int main() {
        struct xdio xdio1,xdio2,*xd1=0,*xd2=0;
        long long min,ct;

/*
Here, I believe that the API is proving that the SBC is a TS-7300 or a
TS-7260 then, it activates the XDIO2 memory locations...
*/
        if (open_xdio(&xdio1,0)) {
                xd1 = &xdio1;
        }
        if (open_xdio(&xdio2,1)) {
                xd2 = &xdio2;
        }
        assert(xd1); 

 //set period clock to fast...
  printf("The period clock is: %d ns\n",setClockSpeed(xd1,1));

  setPinDirection(xd1,3,INPUT);         // I believe Xdio3 as input

//      Now to get the user number
        int i; // count
        printf ("Tell me the number:\n");
        scanf("%d", &i);

        int count = 0;
        int aux = 1;    //helper

        while (count < i)
        {
                if ( getPin(xd1,1) == HIGH ){
                        if (aux == 1){
                                usleep(500);
                                aux = 0;
                                count++;
                                printf( "the count is: %d\n", count);
                        }
                }
                else{
                        usleep(500);
                        aux = 1;
                }
        }
        printf("You are done ;)\n");

        return 0;
}

So when it's running, it just doesn't work. When I connect the pin to
GND, it stops the count, but when it's not, it begins to oscilate, I
asked about this behaviour and they theorized that it could be a
bounce, but now, I used a usleep so It doesn't seem like that... so
maybe my problem it's the circuit, so how should I connect this?


should I use a pull-up, or a pull-down resistors, and which resistor
values I must use (if yes), or how am I supposed to connect this?




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<Prev in Thread] Current Thread [Next in Thread>
  • [ts-7000] XDIO question, kvnherrera <=
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU