hello
I am working on a class project that require interfacing a p18F8680 with a analog joystick.
what is happening is that I have a code that should configure Analog and digital ports... and all the necessary settings respectively. however, testing the digital port to determine the output which is expected . it is still at LOW this should have been adjusted accordingly in the software and the movement of the joystick in either direction .... I am sure that I have an error some place maybe i will include a copy of my code for viewing
#include<p18f8680.h>
#include<delays.h>
void main(void)
{
unsigned delay1;
unsigned delay;
TRISD=0x00;
TRISA=0x01;
ADCON0=0x01;
ADCON1=0x0E;
ADCON2=0xA6;
CCP2CON=0x0B;
ADCON0bits.GO=1; // set to 1
ADCON0bits.DONE=0;
while(1) // while loop
{
while(!(ADCON0bits.GO));
Delay1KTCYx(200);
delay=ADRESH;
delay1=ADRESL;
}
}
I will appreciate any input to this