اطلاعیه

Collapse
No announcement yet.

کار نکردن IAP

Collapse
X
 
  • فیلتر
  • زمان
  • Show
Clear All
new posts

    کار نکردن IAP

    سلام بچه ها
    آقا این برنامه اعصاب منو خورد کرده اگه می تونید کمکم کنید . من می خوام داده رو از sram بریزم داخل flash با IAP حالا به دلایلی.
    همه چیز درست پیش می ره فقط دادهای که توی آدرس sram هست داخل flash نوشته نمیشود oo: oo:
    این هم کدم.ممنون

    #include <lpc17xx.h>
    #include <absacc.h>

    unsigned char IAP_Write(unsigned char *string);
    unsigned char a[5] __at(0x10000200);

    #define IAP_ADDRESS 0x1FFF1FF1
    unsigned int command[5];
    unsigned int result[5];
    typedef unsigned int (*IAP)(unsigned int[], unsigned int[]);
    static const IAP iap_entry = (IAP) IAP_ADDRESS;

    int main(void)
    {
    unsigned char i=0;

    for(i=0;i<5;i++)
    a[i]=i;
    IAP_Write(a);
    }
    unsigned char IAP_Write(unsigned char *string)
    {
    command[0]=50;
    command[1]=8; //Start sector number is 8
    command[2]=8; //Finish sector number is 8
    iap_entry(command,result);
    if(result[0]!=0)
    {
    return 0;
    }
    command[0]=51;
    command[1]=0x00008100; //Addrees of Flash
    command[2]=0x10000200; //Addrees of Sram
    command[3]=256; //How many bytes want to transfer
    command[4]=12000; //Frequency in khz
    iap_entry(command,result);
    if(result[0]!=0)
    {
    return 0;
    }
    else
    {
    return 1;
    }
    }
لطفا صبر کنید...
X