It's the old R-M-W issue (Read-Modify-Write).
PIC's can't write to individual Pins in a PORT. It's not possible for the hardware to just set a pin high or low directly.
It has to Read the entire PORT, Modify the bit it wants to change, then Write the value back to the Entire PORT.
When it Reads the PORT, it actually reads the state of the Pins, not the state it was told to be in last.
In your code ...
Code:
MAIN:
OLO=1 : PAUSE 1000 : OLO=0
OLM=1 : PAUSE 1000 : OLM=0
OMD=1 : PAUSE 1000 : OMD=0
OMH=1 : PAUSE 1000 : OMH=0
OHI=1 : PAUSE 1000 : OHI=0
GOTO MAIN
The OLM=1 statement is executed immediately(125nS) after the OLO=0 statement.
If the voltage on the OLO pin has not reached the level required to register a 0, then it reads OLO as 1 and writes that back to the PORT, ignoring that fact that you just told it to be 0.
Capacitance on the Pin will increase the amount of time it takes to reach the requested state.
Solderless breadboards can add quite a bit. LED's add some too.
Just like the 18F's, the 16F1's have LATx (DATA LATCH) registers.
If you use PORTB.0, it does the RMW on the PORT, then writes it to the LATB register which controls the pins state.
If you write directly to LATB.0, it doesn't read the port first.
It still does a read-modify-write, but what it reads is the LATB value (last requested state), not the state of the Pins.
DO NOT! use HIGH, LOW, TOGGLE, or any other PBP commands like SERIN/OUT, PULSIN/OUT etc. with LATx.x as a Pin.
It will cause big problems.
But writing to the LATx bits directly with a 1 or 0 can eliminate the dreaded R-M-W problem.
hth,
Bookmarks