Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

starter,want help!

Altera_Forum
Honored Contributor II
1,020 Views

hello,every body. 

sorry for my poor english,my first language is not englsh.i began to learn niosII about two weeks ago,and i want to design a fpga which contains a soft cpu core to replace MCU(MCS-51,e.g.8031).The c code of the 8031 are partly as follows:# include <reg51.h># include <intrins.h># include <absacc.h> 

long i,j; 

sbit p10=P1^0;  

sbit p11=P1^1;  

sbit p12=P1^2;  

sbit p14=P1^4;  

sbit p15=P1^5;  

sbit p13=P1^3; 

........ 

........ 

........ 

main() 

InitializeA();  

TMOD=0x20;  

TL1=0xfd;TH1=0xfd;  

PCON=0x00;  

TR1=1;  

p11=0; p11=1 

 

xx=0; 

while(1)  

p11=1; 

//delay(20); 

p11=0; 

//delay(20); 

p11=1;  

p12=0;  

p13=1;  

p10=0;  

p10=1;  

i=0; 

p15=1; 

xx=p15; 

while (xx==0) 

p15=1; 

xx=p15; 

p15=1; 

xx=p15; 

if(xx==1)  

p11=0; 

p11=1;  

p12=1;  

for(i=0;i<286;i++) 

{//for1 

for(j=0;j<360;j++)//720 

{ //for2 

P0=0xff; 

re_am=P0; 

if(j<359) //718 359 

SBUF=re_am;  

while(TI==0)  

TI=0; //delay(5); 

P2=0xff; 

re_am=P2;  

if(j<359)//359 

SBUF=re_am; 

while(TI==0) 

TI=0; //delay(5);  

p13=0;p13=1; 

} //for2 

} //for1 

 

}//if_end 

}//first while_end  

 

i want to write this code into niosII,and use the cpu soft core to achieve the fuctions play by the MCU. 

as show above,MCU uses p10...p17 as control signals,how can i achieve this in nios?can i use PI/Os to replay p10...p17 to play control fuctions?if it does,how can i link the p10...p17 to the PI/Os in c code? 

and SBUF in MCU is a serial port,can i use UART to replace it?and the examples altera provides always use UART to transfer charicters,then how can i use it to transfer control signals,as 0,1? 

i think the function i want to achieve is not difficult,but i am a poor starter,and i have been confused with it for a long time .can you help me with it ,kind persons?
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
279 Views

I think you should look at the documentation, which can be found in the altera\kits\nios2\documents directory, probably starting with n2cpu_nii5v1.pdf and n2sw_nii5v2.pdf. 

 

After that if you launch the Nios II IDE, you&#39;ll find lots of helpful tutorials.
0 Kudos
Reply