ps_pl_led.c
本代码为ZYNQ3-PS端协同PL端控制LED流水灯实验的配套代码,实验流程和程序亲测可用,欢迎交流。
verilog文件.rar
本资源主要为PL端调用PS时钟控制LED和按键所用到的V文件,程序亲测可实现预期操作。
调用PS端时钟.docx
对于ZYNQ7系列开发板中,XC7z020CLG400的开发板中,PL端没有独立的时钟供给,如需用到PL端的开发,可以调用PS端的时钟或者在底板上外接时钟。主要就如何在VIVADO中调用PS端时钟供给PL端开发进行讲述。
12864显示的万年历
/*-----------------------------------------------------------*/
#define LCD_OFF 0x3E
#define LCD_ON 0x3F
#define Add_X 0xB8 //the start address of the page 0 ;(0~7)
#define Add_Y 0x40 //the start address of the Y counter ; (0~64)
#define Add_Z 0xC0 //the start address of the DDRAM ; (0~64)
#define UPLINE 0x01
#define UNDERLINE 0x80
/*-----------------------------------------------------------*/
#define LCD12864_DATA_PORT P0
sbit LCD12864_EN =P1^4;
sbit LCD12864_RW =P1^3; //0:write ; 1:read
sbit LCD12864_RS =P1^2; //0:the command .1:the data
sbit LCD12864_CS_L =P1^1; //select the left of the lcd when 1
sbit LCD12864_CS_R =P1^0;
sbit LCD12864_RST =P1^5;
/*------------------------------------------------------------*/
void delayus(unsigned int us)
{
while(us--);
}
void delayms(unsigned ms)
{
unsigned int i,j;
for (i=0;i<ms;i++)
{
for (j=0;j<1000;j++)
;
}
}
/*--------------------------select the LCD--------------------*/
void LCDSel(unsigned char sel)
{
switch(sel)
{
case 0: LCD12864_CS_L=0;LCD12864_CS_R=0;break;
case 1: LCD12864_CS_L=1;LCD12864_CS_R=0;break; //left
case 2: LCD12864_CS_L=0;LCD12864_CS_R=1;break; //right
default:;
};
}
/*------------------------------------------------------------*/
void WaitLCD()
{
unsigned char flag;
LCD12864_DATA_PORT=0xFF;
LCD12864_RW=1;
LCD12864_RS=0;
LCD12864_EN=1;
LCD12864_EN=1;
LCD12864_EN=0;
LCD12864_DATA_PORT=0xFF; //读有效数据
LCD12864_RW=1;
LCD12864_RS=0;
;
LCD12864_EN=1;
do
{
flag=LCD12864_DATA_PORT;
LCD12864_DATA_PORT=0xFF;
}while(!((flag&0x80)==0x80));
LCD12864_EN=0;
} //*/
/*-------------------------------------------------------------*/
void WriteDatToLCD12864(unsigned char dat)
{
WaitLCD();
LCD12864_RS=1; //the data
LCD12864_RW=0; //write
LCD12864_DATA_PORT=dat;
LCD12864_EN=1;
;
LCD12864_EN=0;
74ls138的应用
/*************** writer:shopping.w ******************/
#include <reg52.h>
#define uint unsigned int
#define uchar unsigned char
void Delay(uint x)
{
uchar i;
while(x--)
{
for(i=0;i<120;i++);
}
}
void main()
{
P2 = 0x00;
while(1)
{
P2 = (P2+1)%8;
Delay(50);
}
}74ls138的相关应用及仿真