Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tam
#include <avr/io.h>
#include <util/delay.h>
#include "USART.h"
#include "IO.h"
typedef unsigned char uchar;
typedef unsigned int uint;
#define OFFSET 0x1100
int main(void)
{
MCUCR |= 0b11000000;
DDRD |= (1<<7);
USART_Init();
XMCRB = 0x00;
uint *p = (uint *) (OFFSET + 1); // pointer init
uint a = 10; //pointer offset
uint value = 0xABCD; //set a value to write
*(p+a) = value; // write the value to xram
while(1)
{
USART_nl;
USART_PutStr(">");
USART_PutNumber(10,*(p+a));
USART_PutStr("(0x");
USART_PutNumber(16,*(p+a));
USART_PutStr(")");
USART_PutStr(" @ ");
USART_PutNumber(10,p+a);
USART_PutStr("(0x");
USART_PutNumber(16,p+a);
USART_PutStr(")");
USART_PutStr("<");
USART_nl;
_delay_ms(100);
}
return 0;
}
>-21555(0xabcd) @ 4373(0x1115)<
>-21555(0xabcd) @ 4373(0x1115)<
>-21555(0xabcd) @ 4373(0x1115)<
>-21555(0xabcd) @ 4373(0x1115)<
>5653(0x1615) @ 4373(0x1115)<
>5653(0x1615) @ 4373(0x1115)<
>5653(0x1615) @ 4373(0x1115)<