搜索
bottom↓
回复: 0

用TERASIC_VGA做的UCGUI有問題

[复制链接]

出0入0汤圆

发表于 2013-6-1 18:24:21 | 显示全部楼层 |阅读模式
本帖最后由 lgeorge123 于 2013-6-1 18:31 编辑

在網上下了一个DE1_NIOS 用TERASIC_VGA 的程序 , 打算移植UCGUI , 編譯到 , HS 和 VS 有訊號 , 出 GUI_BLUE  可是 紅色 , 藍色 和綠色有奇怪 訊號 , 各位可否代我看看有何不对!!
用的是QUARTUS 12.1  和 ECLIPSE .....
文件太大 , 只好逐个列出
  1. module DE1_NIOS(

  2.                 CLOCK_50,                                                //        50 MHz

  3.                 DRAM_DQ,                                                //        SDRAM Data bus 16 Bits
  4.                 DRAM_ADDR,                                                //        SDRAM Address bus 12 Bits
  5.                 DRAM_LDQM,                                                //        SDRAM Low-byte Data Mask
  6.                 DRAM_UDQM,                                                //        SDRAM High-byte Data Mask
  7.                 DRAM_WE,                                                //        SDRAM Write Enable
  8.                 DRAM_CAS,                                                //        SDRAM Column Address Strobe
  9.                 DRAM_RAS,                                                //        SDRAM Row Address Strobe
  10.                 DRAM_CS,                                                //        SDRAM Chip Select
  11.                 DRAM_BA_0,                                                //        SDRAM Bank Address 0
  12.                 DRAM_BA_1,                                                //        SDRAM Bank Address 0
  13.                 DRAM_CLK,                                                //        SDRAM Clock
  14.                 DRAM_CKE,                                                //        SDRAM Clock Enable

  15.                 SRAM_DQ,                                                //        SRAM Data bus 16 Bits
  16.                 SRAM_ADDR,                                                //        SRAM Address bus 18 Bits
  17.                 SRAM_UB,                                                //        SRAM High-byte Data Mask
  18.                 SRAM_LB,                                                //        SRAM Low-byte Data Mask
  19.                 SRAM_WE,                                                //        SRAM Write Enable
  20.                 SRAM_CE,                                                //        SRAM Chip Enable
  21.                 SRAM_OE,                                                //        SRAM Output Enable

  22.                 VGA_HS,                                                        //        VGA H_SYNC
  23.                 VGA_VS,                                                        //        VGA V_SYNC
  24.                 VGA_R,                                                   //        VGA Red[3:0]
  25.                 VGA_G,                                                         //        VGA Green[3:0]
  26.                 VGA_B,                                                  //        VGA Blue[3:0]


  27. );


  28. input                        CLOCK_50;                                //        50 MHz


  29. ///////////////////////                SDRAM Interface        ////////////////////////
  30. inout        [15:0]        DRAM_DQ;                                //        SDRAM Data bus 16 Bits
  31. output        [11:0]        DRAM_ADDR;                                //        SDRAM Address bus 12 Bits
  32. output                        DRAM_LDQM;                                //        SDRAM Low-byte Data Mask
  33. output                        DRAM_UDQM;                                //        SDRAM High-byte Data Mask
  34. output                        DRAM_WE;                                //        SDRAM Write Enable
  35. output                        DRAM_CAS;                                //        SDRAM Column Address Strobe
  36. output                        DRAM_RAS;                                //        SDRAM Row Address Strobe
  37. output                        DRAM_CS;                                //        SDRAM Chip Select
  38. output                        DRAM_BA_0;                                //        SDRAM Bank Address 0
  39. output                        DRAM_BA_1;                                //        SDRAM Bank Address 0
  40. output                        DRAM_CLK;                                //        SDRAM Clock
  41. output                        DRAM_CKE;                                //        SDRAM Clock Enable

  42. ////////////////////////        SRAM Interface        ////////////////////////
  43. inout        [15:0]        SRAM_DQ;                                //        SRAM Data bus 16 Bits
  44. output        [17:0]        SRAM_ADDR;                                //        SRAM Address bus 18 Bits
  45. output                        SRAM_UB;                                //        SRAM High-byte Data Mask
  46. output                        SRAM_LB;                                //        SRAM Low-byte Data Mask
  47. output                        SRAM_WE;                                //        SRAM Write Enable
  48. output                        SRAM_CE;                                //        SRAM Chip Enable
  49. output                        SRAM_OE;                                //        SRAM Output Enable

  50. ////////////////////////        VGA                        ////////////////////////////
  51. output                        VGA_HS;                                        //        VGA H_SYNC
  52. output                        VGA_VS;                                        //        VGA V_SYNC
  53. output        [3:0]        VGA_R;                                   //        VGA Red[3:0]
  54. output        [3:0]        VGA_G;                                         //        VGA Green[3:0]
  55. output        [3:0]        VGA_B;                                   //        VGA Blue[3:0]




  56. wire system_reset_n;
  57. assign system_reset_n = 1'b1;


  58. //sys_pll sys_pll_inst(
  59. //        .areset(1'b0),
  60. //        .inclk0(CLOCK_24),
  61. //        .c0(),
  62. //        .locked()
  63. //        );

  64. DE1_SOPC DE1_SOPC_Inst(
  65.                   // 1) global signals:
  66.                    .clk_50(CLOCK_50),
  67.                    .pll_pclk(),
  68.                   
  69.                    .pll_sdram(DRAM_CLK),
  70.                    .reset_n(system_reset_n),
  71.                   
  72.                
  73.                                    

  74.                   // the_sdram
  75.                    .zs_addr_from_the_sdram(DRAM_ADDR),
  76.                    .zs_ba_from_the_sdram({DRAM_BA_1,DRAM_BA_0}),
  77.                    .zs_cas_n_from_the_sdram(DRAM_CAS),
  78.                    .zs_cke_from_the_sdram(DRAM_CKE),
  79.                    .zs_cs_n_from_the_sdram(DRAM_CS),
  80.                    .zs_dq_to_and_from_the_sdram(DRAM_DQ),
  81.                    .zs_dqm_from_the_sdram({DRAM_UDQM, DRAM_LDQM}),
  82.                    .zs_ras_n_from_the_sdram(DRAM_RAS),
  83.                    .zs_we_n_from_the_sdram(DRAM_WE),
  84.                   
  85.                

  86.                   // the_sram
  87.                    .SRAM_ADDR_from_the_sram(SRAM_ADDR),
  88.                    .SRAM_CE_N_from_the_sram(SRAM_C),
  89.                    .SRAM_DQ_to_and_from_the_sram(SRAM_DQ),
  90.                    .SRAM_LB_N_from_the_sram(SRAM_LB),
  91.                    .SRAM_OE_N_from_the_sram(SRAM_OE),
  92.                    .SRAM_UB_N_from_the_sram(SRAM_UB),
  93.                    .SRAM_WE_N_from_the_sram(SRAM_WE),
  94.                   
  95.                   // the_vga
  96.                    .vga_b_from_the_vga(video_b8),
  97.                    .vga_clk_from_the_vga(),
  98.                    .vga_de_from_the_vga(),
  99.                    .vga_g_from_the_vga(video_g8),
  100.                    .vga_hs_from_the_vga(VGA_HS),
  101.                    .vga_r_from_the_vga(video_r8),
  102.                    .vga_vs_from_the_vga(VGA_VS)
  103.                   

  104.                 );
  105.               
  106. wire [7:0]        video_r8;
  107. wire [7:0]        video_g8;
  108. wire [7:0]        video_b8;
  109. assign VGA_R = video_r8[7:4];            
  110. assign VGA_G = video_g8[7:4];            
  111. assign VGA_B = video_b8[7:4];            


  112. endmodule
  113. [code]/*
  114. *********************************************************************************************************
  115. *                                             uC/GUI V3.98
  116. *                        Universal graphic software for embedded applications
  117. *
  118. *                       (c) Copyright 2002, Micrium Inc., Weston, FL
  119. *                       (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
  120. *
  121. *              湣/GUI is protected by international copyright laws. Knowledge of the
  122. *              source code may not be used to write a similar product. This file may
  123. *              only be used in accordance with a license and should not be redistributed
  124. *              in any way. We appreciate your understanding and fairness.
  125. *
  126. ----------------------------------------------------------------------
  127. File        : LCDConf_1375_C8_C320x240.h
  128. Purpose     : Sample configuration file
  129. ----------------------------------------------------------------------
  130. */

  131. #ifndef LCDCONF_H
  132. #define LCDCONF_H
  133. #include"io.h"
  134. #include"system.h"
  135. /*********************************************************************
  136. *
  137. *                   General configuration of LCD
  138. *
  139. **********************************************************************
  140. */

  141. #define LCD_XSIZE      (240)   /* X-resolution of LCD, Logical coor. */
  142. #define LCD_YSIZE      (320)   /* Y-resolution of LCD, Logical coor. */

  143. #define LCD_BITSPERPIXEL (16)
  144. #define LCD_FIXEDPALETTE   (565)
  145. #define LCD_SWAP_RB        (1)
  146. #define LCD_CONTROLLER 3200
  147. #define SRAM     0x01880000
  148. /*********************************************************************
  149. *
  150. *                   Full bus configuration
  151. *
  152. **********************************************************************
  153. */

  154. #define LCD_READ_MEM(Off)           IORD_32DIRECT((U32)SRAM_BASE,(U32)(Off))
  155. #define LCD_WRITE_MEM(Off,data)     IOWR_32DIRECT((U32)SRAM_BASE,(U32)(Off),data)
  156. #define LCD_READ_REG(Off)            *((volatile U16*)(0xc1ffe0+(((U16)(Off))<<1)))
  157. #define LCD_WRITE_REG(Off,data)      *((volatile U16*)(0xc1ffe0+(((U16)(Off))<<1)))=data
  158. #define LCD_INIT_CONTROLLER()  LCD_Controller_Init()
  159. /*********************************************************************
  160. *
  161. *                   Define contents of registers
  162. *
  163. **********************************************************************
  164. */

  165. #define LCD_REG0  (0)                                          /* Product code */

  166. #define LCD_REG1  (0x23)                                       /* Mode reg 0.    0 for 4 bit mono LCD */            \
  167.                                                                /*                1 for 8 bit mono LCD */            \
  168.                                                                /*             0x23 for 8 bit color LCD */           \
  169.                  |(1<<2)                                       /*             Mask FPSHIFT during h.non-display */

  170. #define LCD_REG2 ((3<<6)                                       /* Mode reg 1: Bits per pixel 0:1, 1:2, 2:4, 3:8 */  \
  171.                  |(1<<5)                                       /* High performance bit for accel. of CPU access */  \
  172.                  |(1<<4)                                       /* Input clock divide */                             \
  173.                  |(0<<3)                                       /* Display blank */                                  \
  174.                  |(0<<2)                                       /* Frame repeat */                                   \
  175.                  |(0<<1)                                       /* HW video invert enable */                         \
  176.                  |(0<<0))                                      /* SW video invert */
  177.                  
  178. #define LCD_REG3                                               /* Mode reg 2. 0 for 4 bit mono LCD */               \
  179.                   (0<<7)                                       /* LUT bypass */                                     \
  180.                  |(0<<3)                                       /* LCDPWR override */                                \
  181.                  |(0<<2)                                       /* hw power save enable */                           \
  182.                  |(3<<0)                                       /* Software power save :3 = normal operation */

  183. #define LCD_REG4 (LCD_XSIZE/8-1)                               /* horizontal panel size*/
  184. #define LCD_REG5 ((LCD_YSIZE-1)&255)                           /* Vert. panel size, lsb */
  185. #define LCD_REG6 ((LCD_YSIZE-1)>>8)                            /* Vert. panel size, msb */
  186. #define LCD_REG7 (0)                                           /* FPLine start position (TFT only) */
  187. #define LCD_REG8 (31)                                          /* H.non display period   (0 usually O.K.)*/
  188. #define LCD_REG9 (0)                                           /* FPFrame start pos.    (TFT only) */
  189. #define LCD_REGA (0)                                           /* v.non display period  */
  190. #define LCD_REGB (0)                                           /* mod rate register     0: every frame */
  191. #define LCD_REGC (0)                                           /* Screen 1 start lsb    */
  192. #define LCD_REGD (0)                                           /* Screen 1 start msb    */

  193. #define LCD_REG12 (LCD_BITSPERPIXEL*(LCD_VXSIZE-LCD_XSIZE)/16) /* Memory Address offset (usually 0) */
  194. #define LCD_REG13 LCD_REG5                                     /* Vert. screen 1 size, lsb */
  195. #define LCD_REG14 LCD_REG6                                     /* Vert. screen 1 size, msb */

  196. #define LCD_REG1B (0)                                          /* No swivel mode  (use 0xc0 for alt.swivel)  */
  197. #define LCD_REG1C (0x78)                                       /* bytes per line (stride, for swivel mode only)  */

  198. /*********************************************************************
  199. *
  200. *                   Init sequence for 16 bit access
  201. *
  202. **********************************************************************
  203. */

  204. #if !LCD_SWAP_BYTE_ORDER
  205.   #define LCD_WRITE_REGLH(Adr, d0, d1) LCD_WRITE_REG(Adr, ((d0)<<8) | (d1))
  206. #else
  207.   #define LCD_WRITE_REGLH(Adr, d0, d1) LCD_WRITE_REG(Adr, ((d1)<<8) | (d0))
  208. #endif  



  209. #endif /* LCDCONF_H */

  210.                                                       
复制代码


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

阿莫论坛20周年了!感谢大家的支持与爱护!!

曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-8-27 06:03

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表