blueroomelectronics Well-Known Member Feb 19, 2009 #1 Just getting the hang of C30 and in 8 bit assembly you could use... X = high(0x1234) Y = low(0x1234) to tell the assembler to put 12 into X and 34 into Y Now I'm looking for a 16 bit word equivalent in C30.
Just getting the hang of C30 and in 8 bit assembly you could use... X = high(0x1234) Y = low(0x1234) to tell the assembler to put 12 into X and 34 into Y Now I'm looking for a 16 bit word equivalent in C30.
arhi Member Feb 19, 2009 #2 blueroomelectronics said: Just getting the hang of C30 and in 8 bit assembly you could use... X = high(0x1234) Y = low(0x1234) to tell the assembler to put 12 into X and 34 into Y Now I'm looking for a 16 bit word equivalent in C30. Click to expand... not sure I understand the question ? X = 0x1234 >> 8; Y = 0x1234 & 0x00ff; or X = 0x11223344 >> 16; Y = 0x11223344 & 0xffff;
blueroomelectronics said: Just getting the hang of C30 and in 8 bit assembly you could use... X = high(0x1234) Y = low(0x1234) to tell the assembler to put 12 into X and 34 into Y Now I'm looking for a 16 bit word equivalent in C30. Click to expand... not sure I understand the question ? X = 0x1234 >> 8; Y = 0x1234 & 0x00ff; or X = 0x11223344 >> 16; Y = 0x11223344 & 0xffff;
Mike - K8LH Well-Known Member Feb 20, 2009 #3 Here's one method from Forum.Microchip for pulling the hi and lo bytes from an INT; Code: unsigned char Lo = 0; unsigned char Hi = 0; #define LOBYTE(x) (char)((x)&0xFF) #define HIBYTE(x) (char)((x)/256) Lo = LOBYTE(CCPR1); Hi = HIBYTE(CCPR1); Last edited: Feb 20, 2009
Here's one method from Forum.Microchip for pulling the hi and lo bytes from an INT; Code: unsigned char Lo = 0; unsigned char Hi = 0; #define LOBYTE(x) (char)((x)&0xFF) #define HIBYTE(x) (char)((x)/256) Lo = LOBYTE(CCPR1); Hi = HIBYTE(CCPR1);