离线
离线
感谢回复,
这个CID, DID 是用来识别新唐 和 N76E003 这个型号对吗?
是只读的吗?
离线
我应该如何才能在代码里面把 CID, DID读出来呢?
离线
感谢回复,
这个CID, DID 是用来识别新唐 和 N76E003 这个型号对吗?
是只读的吗?
是的只读, 我估计是用来给应用升级程序判断你现在芯片的型号,避免烧完了起不动。
正好在玩 N76E003,
写了一段代码把 CID, DID读出来:
/*---------------------------------------------------------------------------------------------------------*/
/* */
/* Copyright(c) 2017 Nuvoton Technology Corp. All rights reserved. */
/* */
/*---------------------------------------------------------------------------------------------------------*/
//***********************************************************************************************************
// Nuvoton Technoledge Corp.
// Website: http://www.nuvoton.com
// E-Mail : MicroC-8bit@nuvoton.com
// Date : Apr/21/2017
//***********************************************************************************************************
//***********************************************************************************************************
// File Function: N76E003 Read actual bandgap value by IAP command
//***********************************************************************************************************
#include "N76E003.h"
#include "Common.h"
#include "Delay.h"
#include "SFR_Macro.h"
#include "Function_define.h"
//read Company ID
UINT8 READ_CID(UINT8 Addr)
{
UINT8 DATATEMP;
set_IAPEN;
IAPCN = CID_READ;
set_IAPGO;
DATATEMP = IAPFD;
clr_IAPEN;
return DATATEMP;
}
//READ Device ID
UINT8 READ_DID(UINT8 Addr)
{
UINT8 DATATEMP;
set_IAPEN;
IAPAL = Addr; //The Acture UCID addrss is begin from 0x20
IAPAH = 0x00;
IAPCN = DID_READ;
set_IAPGO;
DATATEMP = IAPFD;
clr_IAPEN;
return DATATEMP;
}
void main(void)
{
UINT8 READ1,READ2, READ3;
Set_All_GPIO_Quasi_Mode;
InitialUART0_Timer3(115200);
//---------toggle GPIO1---------
clr_GPIO1;
Timer0_Delay1ms(100);
set_GPIO1;
Timer0_Delay1ms(100);
clr_GPIO1;
Timer0_Delay1ms(100);
set_GPIO1;
Timer0_Delay1ms(100);
//---------end toggle GPIO1---------
READ1 = READ_CID(0x00);
READ2 = READ_DID(0x01);
READ3 = READ_DID(0x02);
while(1)
{
printf ("\n Value = 0x%bx %bx %bx",READ1, READ2, READ3);
}
}
输出结果:
Value = 0xda 36 50
Value = 0xda 36 50
Value = 0xda 36 50
Value = 0xda 36 50
Value = 0xda 36 50
离线
你说的都对,估计ICP和ISP就是用这个CID和DID来检测连接的MCU型号,
应该是只读的,我没有玩过N76E003哈,都是瞎猜的。
ISPTool里面有源码可以查看到0x3650
离线