ts-7000
[Top] [All Lists]

[ts-7000] Re: need help reading GPIOs or DIOs pins logic level

To:
Subject: [ts-7000] Re: need help reading GPIOs or DIOs pins logic level
From: "yanniepa" <>
Date: Mon, 20 Oct 2008 06:51:04 -0000
Here is another code I have tried (which just as the code you showed
me), I got it from one of the posting here in the group. The LED is
flashing periodically (1ms) but I can't see any change of state on
DIOs pins. Is there something wrong with it?




--- In  "pekalo1" <> wrote:
>
> --- In  "yanniepa" <yanniepa@> wrote:
> >
> > Hello,
> > 
> > I would like to be able to change the logic level of a few IOs by
> > either writing to GPIOs pins or reading their state level.
> > 
> > I used this sample code :
> > 
> > int fd = open("/dev/mem", O_RDWR|O_SYNC);
> > char *gpioregs;
> > gpioregs = (char *)mmap(o,4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd,
> > 0x12c00000);
> > gpioregs[0] = 0xff;
> > gpioregs[2] = 0x12; //1 on DIO_1 and DIO_4 and zero on others
> > 
> > could someone help me with that ? I tried this and I see no changes on
> > the outputs levels on DIO_1 and DIO_4.
> > 
> > I hope someone can help.
> > Thanks
> > 
> > Yan~
> >
> 
> 
> Hi man 
>       try to use this code it is for DIO1 i use it and it is good 
> 
>   volatile unsigned int  *PBDR, *PBDDR;
>   int fd = open("/dev/mem", O_RDWR|O_SYNC);
>   GPIO1 = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd,
>        0x80840000);
>    PBDR  = (unsigned int *)(GPIO1 + 0x04);     // port b data
>    PBDDR = (unsigned int *)(GPIO1 + 0x14);    // port b direction reg
>    *PBDDR = 0x00; // set port b 0xff > output , 0x00 > input.
>    
>    then u can read or write to the Data Regester 
>    *PBDR..
>  
>   Hope to help u with this 
>   
>   Best Regards
>    khaled.
>



------------------------------------

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