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