Problem with ports help plz
i donno where is the problem portb or a doesnt work to high many LEDs
example:
define osc 4
Include "modedefs.bas"
portb = 0
trisa = 0
main:
portb = %0111111
pause 100
portb = %10001101
goto main
doesnt work it works just if u toggle led by led
like:
high portb.1 or portb.2
need help please i tested it on many PICs th same problem????????????
E Beer, is there anything it can't do ?
HiYa wbubel,
PortA = %01000000 means portA.6 is going high when port is made an output, so if it crosses that place in space time while the PIC is initializing you will see PortA.6 output high. You want to set PortA.6 as zero and do it before you set the tris register to input or output so when it becomes an output or input the latch register is set in a known state, setting it as 1 does not enable pullups or anything like that, so you should have:
Code:
PortA = %00000000 ' set port latches low
TrisA = %01000000 ' make RA6 input
You ever watched an old mechanical slot machine? Figure your registers are going like that until the pic boots and settles into the default mode, usualy 11111111, then it follows your code.