C 如何将内容从内存写入数组?

C 如何将内容从内存写入数组?,c,arrays,loops,microcontroller,C,Arrays,Loops,Microcontroller,下面有一个数组 unsigned char pat6[8] = {0x3C,0xFF,0xC3,0xC3,0xC3,0xC3,0xFF,0x3C,}; 如何从这里读取的内存内容填充数组 unsigned char read_byte() //reading from EEPROM serially { unsigned int i; sda=1; reead=0; for(i=0;i<8;i++) { reead

下面有一个数组

unsigned char pat6[8] = {0x3C,0xFF,0xC3,0xC3,0xC3,0xC3,0xFF,0x3C,};
如何从这里读取的内存内容填充数组

unsigned char read_byte()           //reading from EEPROM serially
{
    unsigned int i;
    sda=1;
    reead=0;
    for(i=0;i<8;i++)
    {
        reead=reead<<1;
        scl=1;
        _nop_();
        _nop_();
        if(sda==1)
            reead++;
        scl=0;
    }
    sda=0;
    return reead;               //Returns 8 bit data here
}       
unsigned char read\u byte()//从EEPROM串行读取
{
无符号整数i;
sda=1;
reead=0;

for(i=0;i我不知道我是否正确理解了你的问题,但我认为使用for语句会有效

for (i=0, i<8,i++)
pat6[i]=read_byte();

对于(i=0,i请遵循以下伪代码

function write_into_array()
{
    for i=0 to 8 {
        array[i] = value-to-be-stored;
    }
}
但是在您的代码中,
scl
变量声明在哪里?或者它是一个全局变量,就像
pat6[]
数组一样

哦,你应该把多余的
去掉

unsigned char pat6[8] = {0x3C,0xFF,0xC3,0xC3,0xC3,0xC3,0xFF,0x3C,};

什么是scl
scl
?在哪里声明?
function write_into_array()
{
    for i=0 to 8 {
        array[i] = value-to-be-stored;
    }
}
unsigned char pat6[8] = {0x3C,0xFF,0xC3,0xC3,0xC3,0xC3,0xFF,0x3C,};