Forum Discussion
Altera_Forum
Honored Contributor
20 years agoc programming for Pin pio
Hi there...i'm currently having problem of understanding the pin input pio.... my nios is connected to the 16 bits pio pin in the development board...how to write a c code to retrieve the i...
Altera_Forum
Honored Contributor
20 years ago --- Quote Start --- originally posted by paolo.gai+dec 7 2005, 08:38 am--><div class='quotetop'>quote (paolo.gai @ dec 7 2005, 08:38 am)</div>
--- quote start ---
<!--quotebegin-niceguylow@Dec 7 2005, 02:56 PM hi there...i'm currently having problem of understanding the pin input pio....
my nios is connected to the 16 bits pio pin in the development board...how to write a c code to retrieve the inputs from this pio..
since this inputs are in binary, do i need to convert to decimal or the system itself will convert for me in c language.
thnaks and regards
wayne
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=11393)
--- quote end ---
--- Quote End --- You can try using the PIO functions made available by Altera... like the one used in the count_binary example of the HAL... The numbers you'll read from the PIO have to be interpreted as a set of bits inside a 32-bit integer... For example, if you have a 2 bit PIO, you'll end up having the 2 bits valies inside the 2 less significant bits of the integer you read from the peripheral. bye Paolo <div align='right'><{post_snapback}> (index.php?act=findpost&pid=11396)</div> [/b] --- Quote End --- this is my sample of the c ....will it work ? let say my pio is a 16 bit input...would it put receive the 16 bits input. since np_pio is defined as int...the 16 bits are automatically converted into integer? np_pio *pio = na_pio; if i want to access obtain the data... pio->np_piodata;