daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * Copyright (c) 2009-2012 Xilinx, Inc.  All rights reserved.
  3.  *
  4.  * Xilinx, Inc.
  5.  * XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
  6.  * COURTESY TO YOU.  BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
  7.  * ONE POSSIBLE   IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
  8.  * STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
  9.  * IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
  10.  * FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
  11.  * XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
  12.  * THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
  13.  * ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
  14.  * FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
  15.  * AND FITNESS FOR A PARTICULAR PURPOSE.
  16.  *
  17.  */
  18.  
  19. /*
  20.  * helloworld.c: simple test application
  21.  *
  22.  * This application configures UART 16550 to baud rate 9600.
  23.  * PS7 UART (Zynq) is not initialized by this application, since
  24.  * bootrom/bsp configures it to baud rate 115200
  25.  *
  26.  * ------------------------------------------------
  27.  * | UART TYPE   BAUD RATE                        |
  28.  * ------------------------------------------------
  29.  *   uartns550   9600
  30.  *   uartlite    Configurable only in HW design
  31.  *   ps7_uart    115200 (configured by bootrom/bsp)
  32.  */
  33.  
  34.  
  35. #include <stdio.h>
  36. #include "platform.h"
  37. #include "xparameters.h" // add
  38. #include "xiomodule.h" // add
  39.  
  40. void print(char *str);
  41.  
  42. int main()
  43. {
  44.     init_platform();
  45.     //while (1){
  46.     u32 data;
  47.     u32 ref;
  48.      XIOModule gpi;
  49.      XIOModule gpo;
  50.  
  51.     print("Hello \n\r");
  52.     data = XIOModule_Initialize(&gpi, XPAR_IOMODULE_0_DEVICE_ID);
  53.     data = XIOModule_Start(&gpi);
  54.     data = XIOModule_Initialize(&gpo, XPAR_IOMODULE_0_DEVICE_ID);
  55.     data = XIOModule_Start(&gpo);
  56.     ref=data;
  57.     u32 i;
  58.     while (1)
  59.     {
  60.     data = XIOModule_DiscreteRead(&gpi, 1); // read switches (channel 1)
  61.     XIOModule_DiscreteWrite(&gpo, 1, data); // turn on LEDs (channel 1)
  62.     if(data!=ref)
  63.     {
  64.         ref=data;
  65.         for(i =0;i<=7;i++)
  66.         {
  67.             if (data &(1<<i)){
  68.                 xil_printf("Numer: %d\n\r", i+1); ;
  69.                 }
  70.         }
  71.  
  72.     //  if (data==0b00000001)
  73.  
  74.         }
  75.     }
  76.     cleanup_platform();
  77.  
  78.     return 0;
  79. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top