发送寄存器和地址上的所有值
uart_send(0xa1); uart_send(*((char code*)0x2001)); uart_send(*((char code*)0x2002)); uart_send(*((char code*)0x2003)); uart_send(*((char code*)0x2004)); uart_send(*((char code*)0x2005)); uart_send(*((char code*)0x2006)); uart_send(0xa2); uart_send(TRMVAL32K); uart_send(OPINTEN); uart_send(OPOUTFLAG); uart_send(LVIINT); uart_send(PMUINTEN); uart_send(ADCON1);
发送寄存器和地址上的指定bit值
uart_send(0xa8);//nvr读取trim值 trimValue =(*((char code*)0x2001))&0x0f; //32k bit3-0 uart_send(trimValue); trimValue= ((*((char code*)0x2002))>>3)&0x1f; //ocp bit7-3 uart_send(trimValue); trimValue= ((*((char code*)0x2003))>>3)&0x1f; //ovp bit7-3 uart_send(trimValue); trimValue= ((*((char code*)0x2004))>>3)&0x1f; //lvi bit7-3 uart_send(trimValue); trimValue= ((*((char code*)0x2005))>>2)&0x1f;//banfgap bit6-2 uart_send(trimValue); trimValue= ((*((char code*)0x2006))>>4)&0x0f;//adcRef bit7-4 uart_send(trimValue);
uart_send(0xa9); //寄存器读取trim值 trimValue =TRMVAL32K&0x0f; //32k bit3-0 uart_send(trimValue); trimValue= (OPINTEN&0xf8)>>3; //ocp bit7-3 uart_send(trimValue); trimValue= (OPOUTFLAG&0xf8)>>3; //ovp bit7-3 uart_send(trimValue); trimValue= (LVIINT&0xf8)>>3; //lvi bit7-3 uart_send(trimValue); trimValue= (PMUINTEN&0x7c)>>2;//banfgap bit6-2 uart_send(trimValue); trimValue= (ADCON1&0xf0)>>4;//adcRef bit7-4 uart_send(trimValue);