Forum Discussion
Altera_Forum
Honored Contributor
14 years agoCommand FPGA using Matlab
Hi, I would like to know how to command my FPGA board with Matlab. I explain : I would like for exemple switch on a LED with Matlab and RS232 connexion. I don't know how to make it... If I...
Altera_Forum
Honored Contributor
14 years agoThanks,
I have implemented niosII on my fpga with the uart and serial device. I have made a C program in order to send Hello World on serial port and it's successful.#define RS232_UART_DATA ((volatile int*) 0x10001010)
# define RS232_UART_CONTROL ((volatile int*) (0x10001010+4))
int main()
{
unsigned char hwld = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
unsigned char *pOutput;
pOutput = hwld;
while(*pOutput) //strings in C are zero terminated
{
//if room in output buffer
if((*RS232_UART_CONTROL)&0xffff0000 )
{
//then write the next character
*RS232_UART_DATA = (*pOutput++);
}
}
} With this code my FPGA send "hello world" to my computer. But now I would like to send information on my FPGA with serial port in order to control my FPGA. I explain: If I send '1' from my computer to the FPGA I would like that the LEDG(1) turn on. If I send '2' the LEDG(2) turn on... I don't know how to make it... I know that I have to take the information on RX but I don't know how to do it