找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 2513|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

5110畫(huà)點(diǎn)程序出錯(cuò)求解

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
求助,這個(gè)程序是從百度文庫(kù)里的STM32移植過(guò)來(lái)的,不知為什么編譯出錯(cuò)誤,unitrecord[y_unit][x] = unitrecord[y_unit][x] | write_table[y_pos];這個(gè)語(yǔ)句有什么問(wèn)題嗎?求助


#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個(gè)單元 可在指定單元里畫(huà)點(diǎn)        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 該點(diǎn)亮
{
    uchar x_pos,y_pos,y_unit;
    x_pos = x;        // x坐標(biāo) 0-83
    y_unit = y/8; //看指定坐標(biāo)在哪個(gè)單元 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空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表