Forum Discussion
Suggestions on effectively learning NIOSII Soft programing
- 3 years ago
Hi,
For starters, you can quickly run through any of the booting methods that your board can perform:
Choose boot from OCRAM for example:
Go through the steps up until the "Programming" part.
For learning, you can go through the document as a whole.
I meant the Bitwise Or operation.Here is the code:
#include "sys/alt_stdio.h"
#include "stdio.h"
#include "system.h"
#include "priv/alt_busy_sleep.h"
#include "altera_avalon_pio_regs.h"
#define LCD_BITBANG_BASE 0x11000
void SendCommand(alt_u8 cmd);
void SendData(alt_u8 data);
void SendMessage(char *msg);
int main()
{
SendCommand(0x0038);
SendCommand(0x0001);
SendCommand(0x0006);
SendMessage("IICT");
SendCommand(0x00C0);
SendMessage("FPGA");
SendCommand(0x000C);
return 0;
}
void SendCommand(alt_u8 cmd)
{
IOWR_ALTERA_AVALON_PIO_DATA(LCD_BITBANG_BASE,0x0400|cmd);
alt_busy_sleep(1000);
IOWR_ALTERA_AVALON_PIO_DATA(LCD_BITBANG_BASE,0x0000|cmd);
alt_busy_sleep(1000);
}
void SendData(alt_u8 data)
{
IOWR_ALTERA_AVALON_PIO_DATA(LCD_BITBANG_BASE,0x0600|data);
alt_busy_sleep(1000);
IOWR_ALTERA_AVALON_PIO_DATA(LCD_BITBANG_BASE,0x0200|data);
alt_busy_sleep(1000);
}
void SendMessage(char *msg)
{
while(*msg!=0)
{
SendData(*msg);
*msg++;
}
}
Also I saw some people using usleep instead of alt_busy_sleep.What are the comparative advantages of using one and the other?