Im just experimenting with DIO before I actually need to use it, so I
wrote a simple program to toggle the DIO0..7 pins as follows:
fd = open("/dev/mem", O_RDWR|O_SYNC);
gpioregs = (char *)mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_SHARED,fd,
0x12c00000);
gpioregs[0] = 0xff; /* data direction register set to all outputs */
for (;;) {
gpioregs[2] = 0xff; /* output high to DIO_01 and DIO_4, all
else low */
gpioregs[2] = 0x0; /* output high to DIO_01 and DIO_4, all else
low */
}
close(fd);
exit(0);
For some reason, the pins never toggle. If I remove the for loop, and
execute gpioregs[2] = 0xff; OR gpioregs[2] = 0x0; the pins will change
state. What am I doing wrong?
Rich
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/
|