Code 1: data transfer from memory to variable and variable to memory of byte size
#include "MKL25Z4.h"
int main(void)
{
volatile char a = 0x06, c=0x00, d= 0x00;
volatile char *b = &c;
*b= a; // variable to memory 8 bit data transfer
d =*b; // memory to variable 8 bit data transfer
return 0 ;
}
Result:
Initial value:
After execution of code
Code 2: data transfer of half word from memory to variable and variable to memory.
#include "MKL25Z4.h"
int main(void)
{
volatile short int a = 0x06, c=0x00, d= 0x00;
volatile short int *b = &c;
*b= a; // variable to memory 16 bit data transfer
d =*b; // memory to variable 16 bit data transfer
return 0 ;
}
Code 3: data transfer of word from memory to variable and variable to memory.
#include "MKL25Z4.h"
int main(void)
{
volatile int a = 0x06, c=0x00, d= 0x00;
volatile int *b = &c;
*b= a; // variable to memory 32 bit data transfer
d =*b; // memory to variable 32 bit data transfer
return 0 ;
}
No comments:
Post a Comment