Wond3rboy
Member
Hi i wanted to create a 16 bit unsigned int in to an 8 bit value so i did a test of anding the Lower byte and then giving it on PORT A(LATCH obviously). I ran it in MPLAB SIM, the code is correct(checked the disassembly code) but even thought there is a clear command to show the number on LATCHA it isnt showing the output.
Code:
#include<p18f1320.h>
void main(void)
{
unsigned int j=0xff02;
unsigned char i;
TRISA=0;
i=(j & 0xff);
LATA=i;
LATAbits.LATA4=(j & 0x01);
}
Last edited: