On Thu, 17 Jan 2013, khouryelie wrote:
> hello i am trying to use my COM2 port on the TS 7200 in RS-485 Full
> duplex mode
>
> apparently i have to change the mode register to hex 01 at physical
> address 0x22C0_0000
I think you need to do a byte write - otherwise you are writing
hex 00 to 0x22C0_0000 0x22C0_0001 0x22C0_0002 and hex 01 to 0x22C0_0002
when you write the integer hex 01 to 0x22C0_0000
Just try changing Made to unsigned char *
Don't why you have the infinite loop!
>
>
> _______________________________________________
> the first is the code i tried to make
>
> the second is provided within the Manuel
>
> can som1 point out my problem and why is it not working ?
>
> ______________________________________________
> #include<unistd.h>
> #include<sys/types.h>
> #include<sys/mman.h>
> #include<stdio.h>
> #include<fcntl.h>
> #include<assert.h>
>
> int main(void)
> {
> int fd,v;
> volatile unsigned int *Mode,*check;
>
> assert(fd != -1);
>
> fd = open("/dev/mem", O_RDWR | O_SYNC);
>
> Mode = (unsigned int
> *)mmap(0,getpagesize(),PROT_READ|PROT_WRITE,MAP_SHARED,fd,0x22C00000);
>
> *Mode = 0x01;
>
> while(1)
> {
> *Mode = 0x01;
> sleep(5);
> }
>
> check = (unsigned int
> *)mmap(0,getpagesize(),PROT_READ|PROT_WRITE,MAP_SHARED,fd,0x22C00000);
> printf("%p\n",check);
>
>
> }
>
>
> ________________________________________________
>
>
>
> #include <linux/ts_sbc.h>
> #include <linux/include/asm/ioctls.h>
> #define TIOC_SBCC485 _IOW('T',0x70,int) /*TS RTS/485 mode Clear*/
> #define TIOC_SBCS485 _IOW('T',0x71, int) /*TS RTS/485 mode Set */
> #define AUTO485FD 1
> #define RTSMODE 2
> #define AUTO485HD 4
> mcr = AUTO485FD;
> //mcr = AUTO485HD; //for half duplex
> ioctl (fd, TIOC_SBCS485, &mcr);
> //write() and read() from fd
> ioctl (fd, TIOC_SBCC485, &mcr);
> //further reads() and writes() may not behave
>
>
>
>
------------------------------------
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/
|