Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "xparameters.h"
- #include "xil_types.h"
- #include "xuartlite_l.h"
- #include "xgpio.h"
- void print(char *str);
- int main()
- {
- u8 data;
- int address;
- int n;
- XGpio switches;
- XGpio_Initialize(&switches,XPAR_DIP_SWITCHES_8BITS_DEVICE_ID);
- XGpio_SetDataDirection(&switches,1,0xFF);
- while(1)
- {
- //*********************************************TO DO 1*************************************************//
- //*********************************Primiti 1 bajt podataka putem UART-a********************************//
- data = XUartLite_RecvByte(XPAR_RS232_UART_1_BASEADDR);
- n= XGpio_DiscreteRead(&switches,1);
- address = XPAR_MICRON_RAM_MEM0_BASEADDR + n * 4;
- Xil_Out32LE(address,data);
- //*****************************************************************************************************//
- xil_printf("Primljeni podatak je: %d, a ispisan kao character: %c\r\n", data, data);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement