ts-7000
[Top] [All Lists]

[ts-7000] ts-7260 DIO2 Programming

To:
Subject: [ts-7000] ts-7260 DIO2 Programming
From: "ndivner" <>
Date: Thu, 15 Feb 2007 07:46:32 -0000
Hi to All,

I am endeavouring to program the DIO2 Header on the ts-7260
using the following code.

//-----------------------------------------------------------
//              Create File Descriptor for memory mapped devices
//-----------------------------------------------------------
        if ((dev_mem_fd = open("/dev/mem", O_RDWR|O_SYNC)) == -1)
        {
                perror("open /dev/mem");
                exit(1); 
        }

//---------------------------------------------------------
//              map in XDIO registers
//---------------------------------------------------------
        xdio_start = mmap(0, page_size, 
                        PROT_READ|PROT_WRITE,
                        MAP_SHARED, dev_mem_fd, 0x12c00000);
        if (xdio_start == MAP_FAILED)
        {
                perror("mmap");
                exit(1);
        }
        xdio_r0 = (unsigned char *) (xdio_start + 0x0000);
        xdio_r1 = (unsigned char *) (xdio_start + 0x0001);
        xdio_r2 = (unsigned char *) (xdio_start + 0x0002);
        xdio_r3 = (unsigned char *) (xdio_start + 0x0003);

        *xdio_r0 = 0x00; // select Mode 0
        *xdio_r1 = 0xff; // set all 8 bits to output
      *xdio_r2 = 0x55; // alternate bits are ones

I have made the following observations :-

When I read all 4 registers I seem to read the input pins
on both r0 and r2 as hex 77. (Book says all have Pullups) so why not 
Hex ff.
When I write to r1 it works and I can read back what I wrote. ie all 
inputs or all outputs

However with r1 set for output r0 and r2 still give me the
original hex 77. No amount of coaxing can allow me to toggle bits

Also on Page 50 of the TS-7260 Manual it shows 2 entrys for the DIO2 
Header as follows :-
0x12c0_0000-0x12c0_0003 (TS-7260) DIO2 Header TS-XDIO registers
0x12c0_0000-0x12c0_0001 (TS-7260) DIO2 Header Basic DIO registers

This is very confusing as it suggests different addressing.

Does anybody have some simple code that allows one to toggle some 
bits.

Many thanks in advance.

Noel Diviney. 





 
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] ts-7260 DIO2 Programming, ndivner <=
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