i use 18F4550, resonator 4Mhz, 470nf pin 18, 0,1uf in VDD/VSSCode:DEFINE OSC 48 Led Var PORTA.0 Contador Var Byte Dados var Byte[16] USBInit Low LED Inicio: USBService contador = 1 USBIn 3, Dados, contador, Time_Out Toggle LED If Dados[0]="B" Then Dados[0] = "B" Contador = 1 goto Usb_Saida Endif If Dados[0]="T" Then Dados[0] = "T" Contador = 1 goto Usb_Saida ENDIF Time_Out: GOTO Inicio Usb_Saida: USBService USBOut 3, Dados, contador, Usb_Saida Goto Inicio
this code work 100%...but if i add:
...........
ADCON0 = 0 ' Turn off A/D
ADCON1 = 7 ' Set PORTA to digital
CMCON = 7 ' Comparators off
............
If PortA.1=0 then
Dados[0] = "0"
Contador = 1
goto Usb_Saida
Endif
If PortA.1=1 then
Dados[0] = "1"
Contador = 1
goto Usb_Saida
Endif
usb print in serial 11111111111111000000000000011111111111111000000000 0000
not stable 0 or 1
if i put on led.....led on 5s.......led off 5s ....and not have anything in portA.1
i tested in portb,c....... all instable




Bookmarks