| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1189 人关注过本帖
标题:初学者求助,请各位大神帮忙
取消只看楼主 加入收藏
ixsecs
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2015-1-7
结帖率:0
收藏
已结贴  问题点数:20 回复次数:4 
初学者求助,请各位大神帮忙
本人学了一个月还是稀里糊涂,请各位高手帮忙,先谢谢了
图片附件: 游客没有浏览图片的权限,请 登录注册

图片附件: 游客没有浏览图片的权限,请 登录注册
2015-01-07 21:45
ixsecs
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2015-1-7
收藏
得分:0 
C代码就可以了,谢谢。
英文是因为我上的英文的课程。
2015-01-07 23:41
ixsecs
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2015-1-7
收藏
得分:0 
下面是我写的,改密码那个想不出来,请大神帮忙修改代码
#include <f330lib.h>

unsigned char n[4];
unsigned char p[4]={'2','4','1','0'};        // compare password 2410

void keyGetPwd(void)        //define function "keyGetPwd"
{
    unsigned char i,j=0;    // unsigned i,j
    lcdInit();        // initialise lcd screen
    lcdSetXY(0,0);        // 1st column and 1st row
    lcdPutStr("WELCOME");        // place "WELCOME" at 1st column and 1st row
    lcdSetXY(0,1);        // 1st column and 2nd row
    lcdPutStr("Password:");        // palce "Password:" at 1st column and 2nd row  

    for (i=1;i<5;i++)        // for loop get key char,until i=4,total 4 words(2410)
    {
        j=keyGet();        // j get from keypad
        lcdPutCh('*');        // "*" is present instead of what char get from key pad
        n[i-1]=j;        // use "*" to clear the word
         
        if (j==0x2A)    // if "*" entered
        {
            lcdInit();  
            lcdSetXY(0,0);     
            lcdPutStr("WELCOME");
              lcdSetXY(0,1);   
            lcdPutStr("Password:");     
            i = 0;        // after clear restart
        }

        else if (j==0X23)    // if "#" entered
        {
            lcdInit();  
            lcdSetXY(0,0);     
            lcdPutStr("New Password:");
              lcdSetXY(0,1);   
            lcdPutStr("");
        }
    }
}

void main (void)
{
    unsigned char m = 0;
   
    Init_Device();        // initialize device
    keyInit();        // initialize keypad
    lcdInit();        // initialize lcd screen

    while(1)
    {
        keyGetPwd();        // keygetpassword function      
        if ((p[0] == n[0])&&(p[1] == n[1])&&(p[2] == n[2])&&(p[3]))  // compare the n[] array data from key set with unsigned char p[] array
        {  
            lcdInit();
            lcdSetXY(0,0);
            lcdPutStr("WELCOME");
            lcdSetXY(0,1);
            lcdPutStr("Correct");        // if 2 array are same, display Correct
            m = 0;        // if correct password rerun
        }
        else
        {
            lcdInit();
            lcdSetXY(0,0);
            lcdPutStr("WELCOME");
            lcdSetXY(0,1);
            lcdPutStr("Incorrect");        // if 2 array are not same, display Incorrect
            m++;
            if (m == 3)        // only can keyin 3 times wrong password
            {
                lcdInit();
                lcdSetXY(0,1);
                lcdPutStr("Entry is Locked!"); // after key 3 times wrong password display
                while(1);        // refuse any password entry   
            }
        }
                delayms (5000);        // delay 5 seconds
   
    }
}
2015-01-08 14:59
ixsecs
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2015-1-7
收藏
得分:0 
各位见笑了,这是我的作业,16号就要交了,有能帮忙的吗?
2015-01-09 07:54
ixsecs
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2015-1-7
收藏
得分:0 
已经搞定,仍然要感谢各位关注。
2015-01-17 09:57
快速回复:初学者求助,请各位大神帮忙
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025321 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved