void test_eeprom2(void) { DateStruct g; g.datePosition = 0xa; g.dateWaterpressure = 0x55; writeEpdat(IAP_ADDRESS, (unsigned char*)&g, sizeof(g)); delayMS(1); readEpdat(IAP_ADDRESS, (unsigned char*)&gDate, sizeof(gDate)); UART_Send_Char(gDate.datePosition); UART_Send_Char(gDate.dateWaterpressure); }
/********************************************************************************************* 函数名:UART_Send_String 作 用: 参 数:需要UART串口发送的数据(8位/1字节) 返回值:无 结 果:向串口发送一个字符串,长度不限。 备 注:例:UART_Send_Char("d9887321$"); 此函数需要#include <string.h>头文件支持。 **********************************************************************************************/ void UART_Send_String (unsigned char *str) { while(*str != '\0') { UART_Send_Char(*str); *str++; } *str = 0; }
__interrupt void TIMERA_ISR(void) { if (lsx != 0) { UART_Send_Char(); } lsx = 0; lsy = 0; rsx = 0; rsy = 0; ADC12CTL0 |= ADC12SC; // Begin another conversion //__bic_SR_register_on_exit(LPM0_bits); // Exit LPM0 }
void test_eeprom(void) { unsigned int i; unsigned char dat; //清除数据 IapEraseSector(IAP_ADDRESS); for(i = 0; i < 512; i++) { if(IapReadByte(IAP_ADDRESS + i) != 0xff) { goto err; } } _nop_(); _nop_(); _nop_(); _nop_(); //写入数据 for(i = 0; i < 512; i++) { IapProgramByte(IAP_ADDRESS + i, (unsigned char)i); } _nop_(); _nop_(); _nop_(); _nop_(); //verify for(i = 0; i < 512; i++) { if((dat = IapReadByte(IAP_ADDRESS+i)) != (unsigned char)i) { goto err; } UART_Send_Char(dat); } err: while(1) { } }