• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::


Browsing this Thread:   1 Anonymous Users






Re: dsPIC跟LCD問題?
#10
資深會員
資深會員


查看用戶資訊
我都這樣做

const rom unsigned char LCMAddrY[]={0x80,0xc0,0x94,0xd4};


ty=LCMAddrY[CurY];
WriteCmdLCD( ty+ CurX);

發表於: 2009/5/4 18:48
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: dsPIC跟LCD問題?
#9
初級會員
初級會員


查看用戶資訊
參照:

Ryang 寫道:
因為每一行有不同的起始位址再加 0x80 :

第一行 : 0x00 ->0x80
第二行 : 0x40 ->0xc0
第三行 : 0x14 ->0x94
第四行 : 0x54 ->0xd4

我的修改方法是這樣
好像怪怪的....
但是顯示沒問題....
void setcurLCD(unsigned char CurX, unsigned char CurY)
{
unsigned char tx,ty;
switch(CurY)
{
case 0:ty = 0x00;

break;
case 1:ty = 0x40;

break;
case 2:ty = 0x15;

break;
case 3:ty = 0x54;

break;
default:ty = 0x00;

break;
}
switch(CurY)
{
case 0:tx = 0x80;

break;
case 1:tx = 0x80;

break;
case 2:tx = 0x7b;

break;
case 3:tx = 0x7c;

break;
default:tx = 0x80;

break;
}
WriteCmdLCD(tx + ty + CurX) ;
LCD_S_Delay() ;
}
有其他大大有更好的方法嗎?

發表於: 2009/5/2 16:52
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: dsPIC跟LCD問題?
#8
版主
版主


查看用戶資訊
因為每一行有不同的起始位址再加 0x80 :

第一行 : 0x00 ->0x80
第二行 : 0x40 ->0xc0
第三行 : 0x14 ->0x94
第四行 : 0x54 ->0xd4

發表於: 2009/4/29 16:21
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: dsPIC跟LCD問題?
#7
初級會員
初級會員


查看用戶資訊
順便問一下...
為甚麼1604上用不了?_?
第三和第四行不能顯示...
但都是用HD44780的....

發表於: 2009/4/28 21:51
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: dsPIC跟LCD問題?
#6
版主
版主


查看用戶資訊
程式不可只看上半部,有呼叫函數也要進去看一下。LCD 在 Initialiaztion 時有呼叫 LCD_CMD_W_Timing( ) ,函數內就有設定 LCD 的 RS & R/W 的動作。

//***********************************************
// Subroutine to 
// Write a command to LCD module
// RS=0, R/W=0, E=H->L F(alling Edge)

void LCD_CMD_W_Timingvoid )                    // LCD Command writing timming
{
    
LCD_RS ;    // Set for Command Input
    
Nop();
    
LCD_RW ;
    
Nop();
    
LCD_E ;
    
Nop();
    
Nop();
    
Nop();
    
Nop();
    
LCD_E ;
}

發表於: 2009/4/17 10:44
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: dsPIC跟LCD問題?
#5
新會員
新會員


查看用戶資訊
大大, 我修改部份是LCD初始化的, 原來C30教程那個代碼裏有注明要在初始化的部分將RS, R/W設成"low", 但代碼裏沒有做到。

所以我有點疑惑, 你可以發過正確的LCD代碼讓我看看嗎?

發表於: 2009/4/16 17:07
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: dsPIC跟LCD問題?
#4
版主
版主


查看用戶資訊
RS & RW 的動作是在 Write 的函數中動作的,尤其是RS一定要驅動的,不然LCM 惠不知是DATA 還是 Command ?

發表於: 2009/4/16 15:50
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: dsPIC跟LCD問題?
#3
新會員
新會員


查看用戶資訊
多謝大大, 我昨天查看了一下那個LCD代碼, 發現好像寫少了一些部份。

原來的代碼裏 (C30_EVM_LCD.c):

void OpenLCD(void)

{
Temp_LCD_DATA = LCD_DATA ; // Save the Port Value of LCD_DATA

LCD_E_MODE =1 ; // Initialize RB7 as digital I/O
LCD_E = 0 ; // RS & R/W --> Low
LCD_DATA &= 0xfff0; // LCD DB[4:7] & RS & R/W --> Low (PORTD[0:3] as LCD DB[4:7])
DIR_LCD_DATA &= 0xfff0; // LCD DB[4:7} & RS & R/W are output function (PORTD[0:3] as LCD DB[4:7])
DIR_LCD_E = 0; // Set E pin as output
DIR_LCD_RS = 0 ;
DIR_LCD_RW = 0 ;
...
}

其中 LCD DB[4:7] & RS & R/W --> Low (PORTD[0:3] as LCD DB[4:7])的部份, RS跟R/W好像沒有處理, 只見E跟LCD DB[4:7] 有做過處理。

我在LCD_E=0之後加入了以下代碼:
LCD_RS = 0; // Code missing
LCD_RW = 0; // Code missing

這樣改對嗎?

還有, 我找了一個LCD, 它說是跟HD44780相容的, 可以給我看一下能用嗎?
http://www.maplin.co.uk/Media/PDFs/N25AZ.pdf

它的接腳跟HD44780標準好像都一樣, 但有兩個PIN叫"A"跟"K"的, 要怎麼連呢?

發表於: 2009/4/16 15:02
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: dsPIC跟LCD問題?
#2
版主
版主


查看用戶資訊
相容於 HD44780 的標準 LCD Module. 需注意的是LCD Module 的接腳會因廠牌而異,接腳不同。

HD780 規格上網一查就有。

發表於: 2009/4/16 10:11
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


dsPIC跟LCD問題?
#1
新會員
新會員


查看用戶資訊
我想問一下, C30 modules 教程中那個"dsPIC30F4011-30I/P"的"APP020 EVM Board"是用哪一蕊片的LCD?

我想重用一下它的代碼。

發表於: 2009/4/16 0:48
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------