找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2039|回复: 0
打印 上一主题 下一主题
收起左侧

5110画点程序出错求解

[复制链接]
跳转到指定楼层
楼主
求助,这个程序是从百度文库里的STM32移植过来的,不知为什么编译出错误,unitrecord[y_unit][x] = unitrecord[y_unit][x] | write_table[y_pos];这个语句有什么问题吗?求助


#include "reg51.h"
#include "intrins.h"
#define uchar unsigned char
#define uint unsigned int
const unsigned char code write_table[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
const unsigned char code clear_table[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
const unsigned char code unitrecord[6][84]={0};
void drew8bits(uchar X,uchar Y,uchar dat) //共84X6个单元 可在指定单元里画点        X 0-83 Y 0-5
{
  X=X;
        Y=Y;
        dat=dat;
}
void makepoint(uchar x ,uchar y ,uchar point )//x 0-83 y 0-47        point为1 该点亮
{
    uchar x_pos,y_pos,y_unit;
    x_pos = x;        // x坐标 0-83
    y_unit = y/8; //看指定坐标在哪个单元 0-5
    y_pos = y-(y_unit*8);        //在单元中的具体位置 0-7
    if(point==1)
                        {
                                unitrecord[y_unit][x] = unitrecord[y_unit][x] | write_table[y_pos];
                                drew8bits(x_pos, y_unit, unitrecord[y_unit][x]);
                        }
           else if(point==0)
                        {
                                unitrecord[y_unit][x]= unitrecord[y_unit][x] & clear_table[y_pos];
                                drew8bits(x_pos, y_unit, unitrecord[y_unit][x]);
                        }
}

void main()
{
        makepoint(2,2,1);
        while(1);
}

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

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