Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- FPGA
- Vivado
- boj
- AMBA BUS
- verilog
- vitis
- baekjoon
- SQL
- Backjoon
- 자격증
- 정보처리기사
- 정처기
- linux
- hdl
- Xilinx
- 코딩테스트
- chip2chip
- 실기
- java
- UNIX
- Zynq
- C++
- Bus
- Beakjoon
- axi
- HDLBits
- 리눅스
- verilog HDL
- amba
- 백준
Archives
- Today
- Total
Hueestory
08 PL with AXI 본문
Vitis C Code
#include <stdio.h>
#include "xgpio.h"
#include "xgpiops.h"
#include "platform.h"
int main()
{
static XGpio GPIOInstance_Ptr;
static XGpioPs psGpioInstancePtr;
XGpioPs_Config *GpioConfigPtr;
u8 count = 0;
int xStatus;
int BtnPinDirection1 = 0, BtnPinNumber1 = 50;
int Readstatus = 0, OldReadstatus = 0;
init_platform();
// Step 01 : AXI GPIO Initialization //
xStatus = XGpio_Initialize(&GPIOInstance_Ptr, XPAR_AXI_GPIO_0_DEVICE_ID);
if(XST_SUCCESS != xStatus)
print("GPIO INIT FAILED \n\r");
// Step 02 : AXI GPIO Set the Direction (OUTPUT) //
XGpio_SetDataDirection(&GPIOInstance_Ptr, 1, 0);
print("Hello World\n\r");
// Step 03 : PS GPIO Initialization //
GpioConfigPtr = XGpioPs_LookupConfig(XPAR_PS7_GPIO_0_DEVICE_ID);
if(GpioConfigPtr == NULL)
return XST_FAILURE;
xStatus = XGpioPs_CfgInitialize(&psGpioInstancePtr, GpioConfigPtr, GpioConfigPtr -> BaseAddr);
if(XST_SUCCESS != xStatus)
print("PS GPIO INIT FAILED \n\r");
// Step 04 : PS GPIO pin setting to Input //
XGpioPs_SetDirectionPin(&psGpioInstancePtr, BtnPinNumber1, BtnPinDirection1);
XGpioPs_SetOutputEnablePin(&psGpioInstancePtr, BtnPinNumber1, 0);
while(1)
{
Readstatus = XGpioPs_ReadPin(&psGpioInstancePtr, BtnPinNumber1);
if((Readstatus == 1) && (OldReadstatus == 0))
{
print("BTN8(PB1-MI050) PUSH Button pressed \n\r");
count++;
XGpio_DiscreteWrite(&GPIOInstance_Ptr, 1, count);
}
OldReadstatus = Readstatus;
}
print("\r\n");
print("***********\r\n");
print("BYE \r\n");
print("***********\r\n");
cleanup_platform();
return 0;
}
'FPGA(중단) > zynq' 카테고리의 다른 글
09 LED toggle (0) | 2023.03.22 |
---|---|
07 PS MIO (0) | 2023.03.03 |
06 BRAM tutorial (0) | 2023.02.18 |
05 Keypad tutorial (0) | 2023.02.18 |
04 VGA tutorial (0) | 2023.02.18 |
Comments