ts-7000
[Top] [All Lists]

[ts-7000] [ts 7200] DIO Code

To:
Subject: [ts-7000] [ts 7200] DIO Code
From: "Giulio D'Aversa" <>
Date: Sun, 14 Nov 2010 13:49:50 +0100


Hi all,

I'm Alba and this is my first Post,
sorry if I'm asking something old but I couldn't find the
answer so far.

Im using a ts 7200
I need a example code (C) in order to move the DIO pins.

I tried to use this but its not working

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
#include "print.h"


static int ThreadID;

static void *Thread(void);


int main (void)
{
GEN_DBG_PRT_DEBUG_FL("Main is starting");
if (pthread_create(&ThreadID, NULL, Thread, NULL)!= 0)
        {
        GEN_DBG_PRT_DEBUG_FL("pthread_create return error");
        }
while(1) sleep(1000);
return 0;
}

static void *Thread(void)
    {
    GEN_DBG_PRT_DEBUG_FL("Thread is starting\n");
    fflush(NULL);
    volatile unsigned int *PEDR, *PEDDR, *PBDR, *PBDDR, *GPIOBDB;
       
   
  unsigned char *start;
  int fd = open("/dev/mem", O_RDWR);
 
  // TRACE(printf("DIO_SETUP()\n"));
   start = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0x80840000);
   // DIO registers
  PBDR = (unsigned int *)(start + 0x04);     // port b
  PBDDR = (unsigned int *)(start + 0x14);    // port b direction register
  PEDR = (unsigned int *)(start + 0x20);     // port e data
  PEDDR = (unsigned int *)(start + 0x24);    // port e direction register
  GPIOBDB = (unsigned int *)(start + 0xC4);  // debounce on port b
    GEN_DBG_PRT_DEBUG_FL("ok1\n");
    fflush(NULL);
  *PBDDR =0xFF; 
  *PBDR=0x01;                            // upper nibble output,
  *GPIOBDB = 0x01;                           // enable debounce on bit 0
  GEN_DBG_PRT_DEBUG_FL("ok2\n");
  fflush(NULL);

  // *PEDDR = 255;                             // all output (just 2 bits)
  close(fd);
//}   

}



   
    


Thanks in advance.
Alba




__._,_.___


Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: =Email Delivery: Digest | m("yahoogroups.com?subject","ts-7000-fullfeatured");=Change Delivery Format: Fully Featured">Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | =Unsubscribe

__,_._,___
<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