ts-7000
[Top] [All Lists]

[ts-7000] Re: Looking into the ts-7xxx

To:
Subject: [ts-7000] Re: Looking into the ts-7xxx
From: Mike Dodd <>
Date: Sun, 11 Sep 2005 22:21:39 -0400
>>This includes 20 DIOs and that is what I want to know about. How would
>>I go about writting c++ code to access the DIOs.
>>
>>I'm new to C++ and perhaps I ought not bo worried about this end of
>>the field yet but I am. I'm guessing I can use fscan to read info and
>>maybe fprint to write data.

The I/O ports are mapped into memory area. You "open" /dev/mem, then read 
and write using pointers. Here's a snippet from button.c which I believe is 
in the Files section.

    unsigned char *start;
    int fd = open("/dev/mem", O_RDWR);

    start = mmap(0, getpagesize(), PROT_READ|PROT_WRITE,
        MAP_SHARED, fd, 0x80840000);
    PBDR = (unsigned int *)(start + 0x04);  // port b
    PBDDR = (unsigned int *)(start + 0x14); // port b dir. register
    PEDR = (unsigned int *)(start + 0x20);  // port e data
    PEDDR = (unsigned int *)(start + 0x24); // port e dir. register
    GPIOBDB = (unsigned int *)(start + 0xC4);  // debounce on port b

    *PBDDR = 0xf0;  // upper nibble output, lower nibble input
    *PEDDR = 0xff;  // all output (just 2 bits)
    *GPIOBDB = 0x01;  // enable debounce on bit 0

    state = *PBDR;  // read initial state
    while (state & 0x01)  // wait until button goes low
    {
      state = *PBDR; // remember bit 0 is pulled up with 4.7k ohm
    }

There's more; you have to include some header files. So grab the entire 
file and see what you can make it do.

Mike


------
Mike Dodd - Montpelier, VA
http://www.mdodd.com



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/CFFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

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

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