Hi
The coorect way is to connect this way
'D4 --- PORTD.4
'D5 --- PORTD.5
'D6 --- PORTD.6
'D7 --- PORTD.7
'Not
'D4 --- PORTD.3
'D5 --- PORTD.4
'D6 --- PORTD.5
'D7 --- PORTD.6
No need to use Output PortD/PortB, use this instead:
TRISB = [COLOR=Red]0[/COLOR]
TRISD = [COLOR=Red]0[/COLOR]
Also LCDOUT takes care of TRISD any way, and make the used Port bits as outputs already.
Don't forget to define the crystal speed:
[B]Define[/B] Osc [COLOR=Red]4[/COLOR]
I don't know why you are using so many Pause statemnets as long as they have the same delay, use this way in order to make it easier for you to examine your firmware:
Delay:
[B]Pause[/B] [COLOR=Red]50[/COLOR]
[B]Return[/B]
You can use this as follows:
I also see that you use
High Port.Bit, this is not nes\cessary, provided you have cleared TRISB:
TRISB = [COLOR=Red]0[/COLOR]
[COLOR=Navy]' Now use this:[/COLOR]
PortB.[COLOR=Red]0[/COLOR] = [COLOR=Red]0[/COLOR]
[B]GoSub[/B] Delay
PortB.[COLOR=Red]0[/COLOR] = [COLOR=Red]1[/COLOR]
[B]GoSub[/B] Delay
Another way that makes your code much smaller:
i [B]Var[/B] [B]Byte[/B]
[B]For[/B] i = [COLOR=Red]0[/COLOR] [B]To[/B] [COLOR=Red]7[/COLOR]
PortB.[COLOR=Red]0[/COLOR][i] = [COLOR=Red]0[/COLOR]
[B]GoSub[/B] Delay
PortB.[COLOR=Red]0[/COLOR][i] = [COLOR=Red]1[/COLOR]
[B]GoSub[/B] Delay
[B]Next[/B] i
This will go through all PortB pins and make what you are doing.