Hi there
My question is that how can I know that at what frequency my CPU is running and if I'm using external or internal clock ..
Actually I'm not sure if my circuit contains clock because i don't know how it looks as the components are SMD of which I'm unfamiliar.
My basic problem is that I want to write and then read data from EEPROM, I'm using EEPROM bean of processor expert. I can get ERR_OK both from SetByte and GetByte but the value returned is always 255 while i'm passing it 1..
You can look at the code below
void main(void){unsigned char simar = 1;unsigned char return_val; unsigned char* read_data;//volatile unsigned int* address;// address=(volatile unsigned int*)0x13f000;IEE1_TAddress address;IEE1_TAddress address1,address2,address3;//1306624 - 1310715//address=(IEE1_TAddress)0X13F020;address1=(IEE1_TAddress)0X13F000;address2=(IEE1_TAddress)0X13F000;address3=(IEE1_TAddress)0X13F000; //unsigned long address =1310715UL; /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ DDRT=0xF0; // Setting Port T pin 4,5,6,7 as output return_val = IEE1_EraseEeprom(address1); if(return_val == ERR_OK) { LED3=LED_OFF; } return_val = IEE1_SetByte(address2,simar); if(return_val == ERR_OK) { LED1=LED_OFF; return_val=IEE1_GetByte(address3,read_data); if(return_val == ERR_OK) { if(*read_data == 1) { LED2=LED_OFF ; } } } //IEE1_TAddress Addr,word Data); /* Write your code here */ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
I need to use EEPROM urgently, so please help me.
Also I think there should be some idea to get the clock speed from the debugger.
I'm using code warrior and my processor is mc9s12xd256
Thanks in advance
解決済! 解決策の投稿を見る。
unsigned char* read_data; unsigned char p; read_data = &p; return_val=IEE1_GetByte(IEE1_AREA_START,read_data);
This is what the difference is ...
Declared a pointer and make that pointer to point some variable
What I did is this
unsigned char* read_data;
I have declared a pointer of char type but not initialized it. So may be it take any garbage value. Pointers in C are not automatically assigned memory space. So you can't do simply
*read_data =23;
This will generate some runtime error.. as it does not know where it write data. It does not point to any memory so it does not have a memory..
Only if I do .
unsigned char p;
read_data = &p
we have a memory of address &p and pointer read_data where we can write something..
Using about 3 to 5 lines of assembler code, you can configure pe4 a an e-clock out pin, and observe both the frequency and quality using a DSO.
P&E Microcomputers CASM12 Example Using the MC9S12DP256B.inc header file by Lou Dillard of Motorola 2003 :
$include 'MC9S12DP256B.inc'
E-Clock_Monitor_Configuration:
bset ddre,ddre4; Configure PE4 as an output pin.
bclr pear,neclk ; Configure PE4 as e-clock output.
clr ebictl ; Setup PE4 as e-clock output.
If you add this to your code either as is if you are writing in assembler, or add it as inline assembly using the above inc file as a reference for register locations and bit fields, you will output a buffered and measureable clock on the PE4 pin