PIC18F27J53 Disable USB

Status
Not open for further replies.

AtomSoft

Well-Known Member
Hey everyone, im trying to use RC4/5 as GPI (general purpose inputs) and can not seem to get them to read correctly...

My code for init is:
Code:
    ADCON0 = 0;
    ADCON1 = 0x0F;
    CM1CON = 0x00;
    ANCON0 = 0xFF;
    ANCON1 = 0x0F;
    CM2CON = 0x00;
    CCP1CON = 0;
    INTCON = INTCON2 = INTCON3 = 0;
    PIR1 = PIR2 = 0;
    PIE1 = PIE2 = 0;

    //DISABLE USB
    UCON = 0;
    UCFG = 0;

...

    if(PORTCbits.RC4 == 1)
        ToTerminal("CH0/RC4 is HIGH.\r\n\0");
    else
        ToTerminal("CH0/RC4 is LOW.\r\n\0");

Am i missing something? There is no TRIS for these pins as they are Input only... thoughts?
 
Did you see this
 
Yeah my PCB has VUSB to VDD..

 
Also saw this:


Which for some reason is exactly how i have it setup and not working
 
Yes, RC5 works now, but RC4 doesnt let me do anything ..

Code:
 			case 0x31:
				OLD_TRIS = TRISC;
				TRISC |= 0b00010000;
				if(PORTCbits.RC4 == 1)
					ToTerminal("CH0/RC4 is HIGH.\r\n\0");
				else
					ToTerminal("CH0/RC4 is LOW.\r\n\0");
				done = 1;
				TRISC = OLD_TRIS;
				break;
			case 0x32:
				OLD_TRIS = TRISC;
				TRISC |= 0b00100000;
				if(PORTCbits.RC5 == 1)
					ToTerminal("CH1/RC5 is HIGH.\r\n\0");
				else
					ToTerminal("CH1/RC5 is LOW.\r\n\0");
				done = 1;
				TRISC = OLD_TRIS;
				break;
 
I hope its a (just this MCU) problem like perhaps a bad solder or something that burnt out that pin ? lol ill try another MCU and see.

Oh i forgot.. dont have anymore PCBs... ugh... i do have some on the way... about 2 weeks time tho.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…