ts-7000
[Top] [All Lists]

[ts-7000] Unable to set anything but B[1] on TS-7800 PC-104

To:
Subject: [ts-7000] Unable to set anything but B[1] on TS-7800 PC-104
From: "craignied" <>
Date: Sun, 21 Nov 2010 17:40:33 -0000
This is really strange.  The following code should set all of the TS-7800 
PC-104's row A to square waves when OFFSET is 0x10, all of row B when it's 
0x14, C when it's 0x18 and D when it's 0x1C, right?  But I'm only seeing a 
square wave on the 2nd pin of row B (the first pin is GND.)  None of the other 
pins in row B show waves when OFFSET is 0x14, and none of the other rows ever 
show waves no matter what the OFFSET is.  What am I doing wrong?

TIA,
Craig

#include <stdio.h>      // printf()
#include <fcntl.h>      // open()
#include <sys/mman.h>   // mmap()
#include <unistd.h>     // getpagesize()
#include <assert.h>

#define BASE    0xE8000000
#define OFFSET  0x10

int main(int argc, char **argv)
{
        volatile unsigned int *base, *DR, *DDR;
        unsigned int i, val;

        int fd= open( "/dev/mem", O_RDWR|O_SYNC );
        assert( fd != -1 );
        
        // Get pointers to the base address, GPIO and DDR registers
        base = ( unsigned int * ) mmap( 0, getpagesize(), PROT_READ | 
PROT_WRITE, MAP_SHARED, fd, BASE );
        DR =  ( unsigned int * ) ( base + ( OFFSET / 0x04 ) ); // data register
        DDR =  ( unsigned int * ) ( base +  ( ( OFFSET + 0x10 ) / 0x04 ) ); // 
data direction register
        
        *DDR = 0xFFFFFFFF; // set all on DDR to outputs
        
        for ( i = 0; i < 100000; i++ )
        {
                *DR = 0xFFFFFFFF; // turn all pins on DR on
                usleep( 10000 );
                *DR = 0x0; // turn 'em off
                usleep( 10000 );
        }
        
        close( fd );
        return 0;
}



------------------------------------

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>
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