liuweiele 发表于 2008-10-13 09:28:51

用NEC3.5寸 TFT LCD做的"示波器" 【恢复】

http://cache.amobbs.com/bbs_upload782111/files_11/ourdev_450610.jpg

 (原文件名:Image.jpg) 

liuweiele 发表于 2008-10-13 09:44:10

进度条和游标的生成算法:





int        GUI_BuildProgress(int x,int y,int dx,int dy,U8 Style,U32 Size,U32 Value,struct GUI_PROGRESS *Output)

{

        switch(Style)

        {

        

                        case        Hor:

                        

                        if(Size>= 0x800000)                //if>8M

                        {

                                Size>>=4;

                                Value>>=4;

                        }

                                        

                        /////////



                        if(Value!=0)                

                        {

                                if(Value<Size)

                                {

                                        Value=((dx-2)*Value)/Size;        //16*2/4 ((-2)外框占两个像素。)

                                }

                                ////

                                else

                                {

                                        Value=dx-2;

                                }

                        }

                                        

                        ////

                                

                        Output->X0=x+1;

                        Output->Y0=y+1;

                        Output->Dx0=Value;

                        Output->Dy0=dy-2;

                        

                        Output->X1=x+1+Value;

                        Output->Y1=y+1;

                        Output->Dx1=dx-Value-2;

                        Output->Dy1=dy-2;

                        

                        Output->X=x;

                        Output->Y=y;

                        Output->Dx=dx;

                        Output->Dy=dy;

                        

                        Output->Style=Style;

                        Output->Size=Size;

                        Output->Value=Value;



                        return        1;

                        

                        ///////////////////////////////////////////////////

                        

                        case        Ver:

                        

                        if(Size>=0x800000)                        //if>8M

                        {

                                Size>>=4;

                                Value>>=4;

                        }

                                                

                        /////////



                        if(Value!=0)                

                        {

                                if(Value<Size)

                                {

                                        Value=(dy*Value)/Size;        //16*2/4

                                }

                                ////

                                else

                                {

                                        Value=dy;

                                }

                        }

                                                

                        ////        

                        

                        Output->X0=x+1;

                        Output->Y0=y+dy-Value-2;

                        Output->Dx0=dx-2;

                        Output->Dy0=Value+1;

                        

                        Output->X1=x+1;

                        Output->Y1=y+1;

                        Output->Dx1=dx-2;

                        Output->Dy1=dy-Value-2;

                        

                        Output->X=x;

                        Output->Y=y;

                        Output->Dx=dx;

                        Output->Dy=dy;

        

                        Output->Style=Style;

                        Output->Size=Size;

                        Output->Value=Value;



                        /*        

                        GUI_FillRectangle(x_addr,y_addr+dy-Val,dx,Val,Front_RGB);                //显示前景.

                        GUI_FillRectangle(x_addr,y_addr,dx,dy-Val,Back_RGB);                        //显示背景.

                        GUI_Rectangle(x_addr,y_addr,dx,dy,Pane_RGB);                                //显示外框.

                        */

                        return        1;

                        

                        ///////////////////////////////////////////////////

                        

                        

                        

                        default:        return        0;

                        

                        ///////////////////////////////////////////////////

        

        

        }

}

liuweiele 发表于 2008-10-13 09:38:39

LCD驱动文件源码:





点击此处下载 ourdev_450670.rar(文件大小:2K) (原文件名:S3C2440LCD_NEC35.rar) 

liuweiele 发表于 2008-10-13 09:29:42

"示波器"源码:





void        Show_Wave_Window(void)



{

        int        a;

        

        GUI_ClrScreen(RGB565(0,0,0));

        

        GUI_FillRectangle(0,0,240,160,RGB565(0,0,0));

        GUI_FillRectangle(0,160,240,160,RGB565(16,40,0));

        GUI_Rectangle(0,160,240,160,RGB_Black);

        



        for(a=0;a<160;a+=32)

        {

                GUI_DotLine(0,a,240,a,RGB565(16,32,16));                //Hor Line

        }

        ////

        for(a=0;a<240;a+=20)

        {

                GUI_DotLine(a,0,a,160,RGB565(16,32,16));                //Ver Line

        }

                        

        GUI_DotLine(239,0,239,160,RGB565(16,32,16));                //Ver Line



        ////////

        

        a=1;

        GUI_Printf(1,a,RGB_Green(58),RGB_Tran,Font_ASC_5_8,"%.2f",3.0*(float)(5.0/5));

        

        a+=32;

        GUI_Printf(1,a,RGB_Green(58),RGB_Tran,Font_ASC_5_8,"%.2f",3.0*(float)(4.0/5));



        a+=32;

        GUI_Printf(1,a,RGB_Green(58),RGB_Tran,Font_ASC_5_8,"%.2f",3.0*(float)(3.0/5));

        

        a+=32;

        GUI_Printf(1,a,RGB_Green(58),RGB_Tran,Font_ASC_5_8,"%.2f",3.0*(float)(2.0/5));

        

        a+=32;

        GUI_Printf(1,a,RGB_Green(58),RGB_Tran,Font_ASC_5_8,"%.2f",3.0*(float)(1.0/5));

        

        ////

        a=20+1;

        GUI_Printf(a,160-8,RGB_Blue(31),RGB_Tran,Font_ASC_5_8,"5");

        

        a+=20;

        GUI_Printf(a,160-8,RGB_Blue(31),RGB_Tran,Font_ASC_5_8,"10");

        

        a+=20;

        GUI_Printf(a,160-8,RGB_Blue(31),RGB_Tran,Font_ASC_5_8,"15");

        

        a+=20;

        GUI_Printf(a,160-8,RGB_Blue(31),RGB_Tran,Font_ASC_5_8,"20");

        

        a+=20;

        GUI_Printf(a,160-8,RGB_Blue(31),RGB_Tran,Font_ASC_5_8,"25");

        

        a+=20;

        GUI_Printf(a,160-8,RGB_Blue(31),RGB_Tran,Font_ASC_5_8,"30");

        

        a+=20;

        GUI_Printf(a,160-8,RGB_Blue(31),RGB_Tran,Font_ASC_5_8,"35");

        

        a+=20;

        GUI_Printf(a,160-8,RGB_Blue(31),RGB_Tran,Font_ASC_5_8,"40");



        a+=20;

        GUI_Printf(a,160-8,RGB_Blue(31),RGB_Tran,Font_ASC_5_8,"45");

        

        a+=20;

        GUI_Printf(a,160-8,RGB_Blue(31),RGB_Tran,Font_ASC_5_8,"50");

        

        a+=20;

        GUI_Printf(a,160-8,RGB_Blue(31),RGB_Tran,Font_ASC_5_8,"55");

        

        ////                



        GUI_Label(0,160,240,32,RGB_Green(56),RGB565(20,20,0),RGB_Black,Center,Font_ASC_8_16,"Sensor Test");

                

        ALCO_2Button_Below(GUI_MSG_CANCEL,GUI_MSG_NEXT,"Exit","ReStart");

        ////



}



/*============================================================================*/

/*============================================================================*/



void        Wave_Sample(void)



{



        #define                Wave_XSIZE        240

        #define                Wave_YSIZE        160

        #define                RGB_LINE        RGB565(31,0,0)

        #define                AD_Vref        3.0

        #define                AD_MAX        0x0fff



        ////

        

        

        float        x,faddata,voltage,time;

        float        x0,y0,x1,y1;

        U8                 Uart_Key;

        U16                addata;

        int                ii;

        

        U16        i;

        int val;

                        ////



        ////

        

        ////



        /////////////

        

Wave_ST:

        

        TS_Scan_Clr_Stop();

//        Key_Scan_Clr_Stop();

        ALCO_Heat_ON();

        

        time=0;

        GUI_MemdevEnable();

        Show_Wave_Window();

        GUI_DisplayUpdata(0,0,LCD_XSIZE,LCD_YSIZE);

        GUI_MemdevDisable();

        

        x0=0;

        addata=Get_ALCO_Addata();

        faddata=addata;

        voltage=faddata*(AD_Vref/AD_MAX);        

        y0=Wave_YSIZE-(voltage/(AD_Vref/Wave_YSIZE));

        

        for(x=0;x<Wave_XSIZE;x++)

        {

                                        

                //Reset_LCD_Backlight_Time_Count();        

                addata=Get_ALCO_Addata();

                                

                faddata=addata;

                voltage=faddata*(AD_Vref/AD_MAX);        

                y1=Wave_YSIZE-(voltage/(AD_Vref/Wave_YSIZE));

                

                Tick15msDecCnt=(250/15);                                //Delay250ms.

                while(Tick15msDecCnt>0)

                {

                        

                        Uart_Key=Uart_GetKey(0);

                        if(ALCO_Cancel_Key_Pressed())        return;

                        

                        

                                

                                

                        val=TS_GetButtonValue(ALCO_2Button,&i);

                        

                        if(val==GUI_MSG_CANCEL)

                        {

                                ALCO_Heat_OFF();

                                return;

                        }

                        ////

                        if(val==GUI_MSG_NEXT)        goto        Wave_ST;

                        

                        

                }

                

                time+=0.25;

                ////

                

                x0=x;

                x1=x+1;

                

                GUI_Line(x0,y0,x1,y1,RGB_LINE);

                

        

                //GUI_Wave(0,0,RGB_Blue(31),240,160,1,x,x1,y1);



                ////

                ii=200;

                GUI_Printf(4,ii,RGB_Blue(20),RGB_Gray,Font_ASC_8_16," Time=%.2fS ",time);

        

                ii+=20;

                GUI_HorVernier(4,ii,240-4-4,16,8,RGB565(10,20,31),RGB565(20,40,50),RGB_Black,60,time);



                ////

                

                ii+=20;

                GUI_Printf(4,ii,RGB_Red(20),RGB_Gray,Font_ASC_8_16," Voltage=%04XH / %.4fV ",addata,voltage);

                

                ii+=20;

                GUI_ShadeHorProgress(4,ii,240-4-4,16,RGB565(31,56,28),RGB_Red(24),RGB565(20,40,50),RGB_Black,AD_MAX,addata);

                

                x0=x1;

                y0=y1;

                



        }

        ////

        

        ALCO_Heat_OFF();

        Uart_Puts(0," Sensor Test Stop!\n");

        while(1)

        {

                //Reset_LCD_Backlight_Time_Count();        



                Uart_Key=Uart_GetKey(0);

                if(ALCO_Cancel_Key_Pressed())        return;

                if(ALCO_Enter_Key_Pressed())        goto Wave_ST;

                ////

                

                val=TS_GetButtonValue(ALCO_2Button,&i);

                if(val==GUI_MSG_CANCEL)

                {

                        ALCO_Heat_OFF();

                        return;

                }

                ////

                if(val==GUI_MSG_NEXT)        goto        Wave_ST;

                

                

        }

        



}

xielihong 发表于 2008-10-13 17:44:21

以前有,但热情过了之后就没有了,简单的连我自己都不敢用,复杂的又做不来,何必呢,何况我一向是拿来主义的,别人已经做好的,我能用就用。那我还不如直接用稳定的,有人维护的OS。

liuweiele 发表于 2008-10-13 17:29:33

不过对本人来讲开发GUI比开发OS要相对容易一些. 不知蚂蚁是否有兴趣自己开发一个OS.

本贴被 liuweiele 编辑过,最后修改时间:2008-10-13,17:39:04.

thinkker 发表于 2008-10-13 16:16:00

收藏了

xielihong 发表于 2008-10-13 15:37:10

如果是OS的话,netbsd倒是不用担心付费和版权的问题,但资料和驱动都比较少。

GUI不付费的话,商用的确实比较难办。

yin66 发表于 2008-10-13 15:37:04

怎么加了楼主的QQ



一直都没消息啊。

liuweiele 发表于 2008-10-13 15:15:01

本人不会Linux,一直玩WinCE.不过,公司老板很小气.不愿用付费操作系统和GUI,硬是让我把ARM当单片机用,自己开发GUI.学了WINCE也无用武之地呀!

xielihong 发表于 2008-10-13 14:53:43

linux

netbsd的话,如果我的功力达到的话,可能也会搞,毕竟它是BPL协议的。

liuweiele 发表于 2008-10-13 14:24:41

可运行在S3C2440上的目标文件:

点击此处下载 ourdev_451750.rar(文件大小:152K) (原文件名:S3C2440可执行文件.rar) 

liuweiele 发表于 2008-10-13 14:13:19

LS打算用哪个OS呢?

xielihong 发表于 2008-10-13 14:04:32

做得很漂亮,

这板我也买了,不过在这么大的空间下不喜欢裸奔,现在已经将原来Uboot1.16移植到这开发板上,迷你龟1.33的也已经编译成库了,就是还没写应用。

luojunzhou 发表于 2008-10-13 13:25:35

赞一个./emotion/em126.gif

liuweiele 发表于 2008-10-13 13:17:23

好像那个'迷你龟'不是免费的呢!

liuweiele 发表于 2008-10-13 13:10:21

不是MiniGUI也不是ucGUI

xielihong 发表于 2008-10-13 12:51:36

楼主用的是什么GUI的,minigui吗

tjzhky 发表于 2008-10-13 11:50:26

嗯?。。?

关注一下

Junker 发表于 2008-10-13 11:44:21

mark

wyk8808 发表于 2008-10-13 10:52:39

强人啊~留个地方 关注一下

liuweiele 发表于 2008-10-13 10:24:50

LS厉害!这样也能看得出来.难道LS是FriendlyARM的.

wanghu1232001 发表于 2008-10-13 10:16:09

哇,友善之臂的ARM板呀。。

mjkxxn 发表于 2009-3-5 12:35:40

ARM实验板600   可惜我没RMB

robinyuan 发表于 2009-3-8 12:35:20

看来还是下决心买个QQ板

zxttgg 发表于 2009-3-8 13:33:25

我的2440烧了,友善的布线有问题。

vr2whf 发表于 2009-3-8 22:03:11

【25楼】, 请问是什麽问题?

armfans 发表于 2009-3-8 23:13:54

如果用WINCE的话,版权费用要怎么算,大概多少啊,看目前的形式,比较敏感的东西要注意了。

liuweiele 发表于 2009-3-9 00:42:43

我的这块Mini2440,有一次用错电源,+12V输入,把Mouse和键盘都电坏了(USB接口);还好,板子还可以正常使用../emotion/em035.gif

bbsniua 发表于 2009-3-9 03:04:02

太贵!玩不起!
不过还是要顶一下!

liuweiele 发表于 2009-4-1 19:49:07

没有付出,哪有回报?
这块板子价格还算合理,

ShawnLinson 发表于 2009-4-3 20:16:37

mark

daye 发表于 2009-4-15 11:02:55

LZ每次只上一段程序,怎么不上个整个源程序???????

liuweiele 发表于 2009-4-17 21:21:58

LS所指的"整个源程序"是指哪些?

s3c44b0 发表于 2009-5-19 22:27:36

有谁知道那个NEC的显示屏资料,共享一个,前几年流行3310的屏,不知道现在这个屏可不可以流行在开发领域

sharpufo 发表于 2009-5-21 17:13:36

不错,我也有套mini2440

liuweiele 发表于 2009-5-21 22:10:37

最近经对比测试发现,S3C2440的速度的确很快.

http://cache.amobbs.com/bbs_upload782111/files_15/ourdev_446739.jpg
(原文件名:IMAG0334.jpg)

xiaob135 发表于 2009-5-30 08:21:56

来顶一下~

hc235280 发表于 2009-5-31 10:07:10

留名关注

yxm433 发表于 2009-6-1 15:36:57

mark

lvjun1013 发表于 2009-6-12 08:05:54

mark

yfz0574 发表于 2009-6-13 11:02:15

请教一下,这个示波器能达到什么性能?

liuweiele 发表于 2009-6-13 17:59:08

Re:【41楼】 yfz0574
这并不是一个通用性的示波器,此程序一开始就是针对用于测试和记录某传感器在60秒钟内的电压波型所设计的.

yfz0574 发表于 2009-6-14 12:06:57

楼主能不能说说
如果用这个开发板做个通用的示波器能达到什么性能?

liuweiele 发表于 2009-6-14 12:11:14

如果用2440内部自带的ADC,在理想的情况下最高大约可以测量到50~100HZ的正弦波.

yfz0574 发表于 2009-6-14 12:47:44

那是没什么用处的
如果另外加个ADC不知道方便不
有一个TQ2440是分两层的
核心板是6层的,放在4层的底板上

yfz0574 发表于 2009-6-14 12:52:43

用个开发板做个多功能手牚机多好
既有OFFICE,可以办公,又有测试仪器,可以调试,还有游戏、影音,可以娱乐,还需要知识库系统,可以随时提取资料。
还有摄像头,可以现场取证。

liuweiele 发表于 2009-6-14 13:03:23

好玩而已

jjj206 发表于 2009-6-14 13:28:56

厉害

huyaping2000 发表于 2009-6-15 11:15:15

佩服的五体投地。

ppptawong 发表于 2009-6-23 17:46:48

如果用2440内部自带的ADC,在理想的情况下最高大约可以测量到50~100HZ的正弦波.

---------------------------------------------------------------------------
樓主可有考慮外加ADC,以增加實用性!!!

liuweiele 发表于 2009-6-23 21:30:50

正在考虑外加一个独立的ADC芯片(20~80MHZ)

yfz0574 发表于 2009-7-8 09:42:57

再加个手机用的QWERTY全键盘,功能就齐了。

liuweiele 发表于 2009-7-10 23:29:52

其实,软键盘功能已经有了:

http://cache.amobbs.com/bbs_upload782111/files_16/ourdev_460108.jpg
(原文件名:IMAG0289.jpg)

laoki8888 发表于 2009-7-11 00:08:08

还以为楼主那6410和2440比速度,原来是2450

都是arm9的核,当然差不太多的

zjinkui 发表于 2009-7-11 01:14:20

怎么像山寨机的屏幕,LZ是从事手机开发的?

liuweiele 发表于 2009-7-11 01:22:25

实际应用中,同频率的2450整体性能还是要比2440快30%以上.过一些时间,再测试一下S3C6410有多强悍.

shaoyidong 发表于 2009-7-11 06:32:01

mark

FREEXP 发表于 2009-7-11 09:48:17

看了后偶都不好意思,买了MINI2440半年了都没怎么会用

liuweiele 发表于 2009-7-11 13:41:28

LS玩MIPS内核 ?

muaythai 发表于 2009-7-14 15:59:29

牛!

capron 发表于 2009-7-18 03:20:25

很不错,
36楼的那根插头,
简直就是一根屎棍插在鲜花上啊,哈

liuweiele 发表于 2009-7-18 22:47:48

呵呵,那根USB线是同事的杰作.

dwrszgq 发表于 2009-11-16 16:15:28

mark

dwrszgq 发表于 2009-11-16 16:20:10

学习啦

wuxinping 发表于 2010-2-9 12:47:11

Thanks 。

Morgery 发表于 2010-2-9 13:49:33

边标记变看……

ju748 发表于 2010-2-9 15:34:57

标记

moon0213 发表于 2010-2-24 12:13:58

mark

ep1c3 发表于 2010-3-30 15:54:54

mark

airwolf09921 发表于 2010-3-30 16:02:52

不顶不行!!!!

xixiangfeng 发表于 2010-4-10 11:15:15

真的不顶不行!

zhs19850202 发表于 2010-4-11 20:40:47

mark

qiao900209 发表于 2010-4-22 00:53:04

mark

myhonour 发表于 2010-4-22 14:36:29

mark

demi123 发表于 2010-5-29 16:54:21

mark!

Jerry88 发表于 2010-12-9 16:45:02

mark

yungke 发表于 2010-12-20 23:38:22

强人。学习!

hshl2010 发表于 2010-12-23 10:01:00

此强人之贴,见者必顶!!!

sjh20042009 发表于 2010-12-24 11:39:25

MARK!!!

442502587 发表于 2011-2-21 18:27:51

mark

liusoldier 发表于 2011-2-21 18:48:46

友善之臂??

yuanye0814 发表于 2011-2-26 14:14:26

MARK~

cunlingwang 发表于 2011-4-28 23:50:55

顶一下!!!

Hello_World 发表于 2011-4-29 00:17:01

强悍!
页: [1]
查看完整版本: 用NEC3.5寸 TFT LCD做的"示波器" 【恢复】