- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I am using IOWR_ALTERA_AVALON_PIOS macros to write data onto pios. But when I am writing the data onto 1 pins, all the other pins are assigned the same value at the same time. Does anyone know why this happens? Thank you very much!- Tags:
- Intel® Cyclone®
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Maybe how data has interpreted is a problem. LSB bits are considered during reading & writing.- What is the PIO width set?
- Can you share your code?
IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, count & 0x01);
while(delay < 2000000)
{
delay++;
}
count++;
Example2: 2-PIO of 3bits of width, for switches and leads.
int in;
while (1)
{
in = IORD_ALTERA_AVALON_PIO_DATA(SW_PIO_BASE) & 0x07;//we are consedering/requried least 3bits from switch
if(in==0)//if all swith are zero
IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, 0);
else if(in==1)
IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, 1);
............
}
Let me know if this has helped resolve the issue you are facing or if you need any further assistance. Best Regards, Anand Raj Shankar (This message was posted on behalf of Intel Corporation)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Hi, Maybe how data has interpreted is a problem. LSB bits are considered during reading & writing.
- What is the PIO width set?
- Can you share your code?
IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, count & 0x01);
while(delay < 2000000)
{
delay++;
}
count++;
Example2: 2-PIO of 3bits of width, for switches and leads.
int in;
while (1)
{
in = IORD_ALTERA_AVALON_PIO_DATA(SW_PIO_BASE) & 0x07;//we are consedering/requried least 3bits from switch
if(in==0)//if all swith are zero
IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, 0);
else if(in==1)
IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, 1);
............
}
Let me know if this has helped resolve the issue you are facing or if you need any further assistance. Best Regards, Anand Raj Shankar (This message was posted on behalf of Intel Corporation) --- Quote End --- Hi, The DB Width I am setting is 8 bits. It is for driving LCD. I have fixed previous problem. But now, I have a new problem. When I am trying to write DB. I got nothing on this 8-bits width signal out onto oscilloscope. The code is attached. # include "stdio.h"# include "stdint.h"# include "unistd.h"# include "system.h"# include "linker.h"# include "lcd_driver.h" //#include "Character.h"# include "altera_avalon_pio_regs.h" //#include "lcd_driver.h" int main() { while(1){ IOWR_ALTERA_AVALON_PIO_DATA(LCD_DB_BASE, 0x01); usleep(50000); IOWR_ALTERA_AVALON_PIO_DATA(LCD_DB_BASE, 0x00); usleep(50000); } return 0; } In this code, DB[0] should be toggled, right? which is not. My setting for this pio peripheral is 8-bit width as output. Could you help me with that? Thank you very much!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page