ts-7000
[Top] [All Lists]

[ts-7000] relays control

To: <>
Subject: [ts-7000] relays control
From: salva g <>
Date: Thu, 15 Oct 2009 10:48:09 +0200


Hi I'm working with this code in order to control relay switch, (the TS-Relay8 Board) on a TS7800,

#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <unistd.h>
 #include <time.h>
 #include <ctype.h>
 #include <sys/mman.h>
 #include <fcntl.h>
 
 #define RELAYBASE 0xEE000140
    
 int main() 
{
      volatile unsigned int *PBDR;
      unsigned char state; 
      unsigned char *start; 
      int fd = open("/dev/mem", O_RDWR|O_SYNC);
      start = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, RELAYBASE);
      PBDR = (unsigned int *)(start + 0x02);
      state = *PBDR;
      printf("Result: %x\n",state);
      return 0;
}

Can be compiled, but return Segmentation Faults when it runs. Instead, with the shell I can do peek16 0xEE000142 with no problem.
Any ideas please?


Todo el espacio y cuidado que merecen tus fotos digitales lo tienes en Windows Live Fotos. ¡Pruébalo!

__._,_.___


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