How does the blink.bas program know to use port b without now trisb or port commands, just high or low, and how can it be changed.
Printable View
How does the blink.bas program know to use port b without now trisb or port commands, just high or low, and how can it be changed.
Hi,
I think I'll just quote the manual on this:
There's more info in the manual....Quote:
HIGH Pin
Make the specified Pin high. Pin is automatically made an output. Pin may be a constant, 0-15, or a variable that contains a number 0-15 (e.g. B0) or a pin name (e.g. PORTA.0).
/Henrik Olsson.
I read the manual. Here is the program, i still don't understand this with Microchip Pic 18f4520.
loop:
High 0 ' Turn on LED connected to PORTB.0
Pause 500 ' Delay for .5 seconds
Low 0 ' Turn off LED connected to PORTB.0
Pause 500 ' Delay for .5 seconds
Goto loop ' Go back to loop and blink LED forever
End
Tell me what, in this program, states PortB pin 0. How is it configured?
Hi,
NOooooooo,
You didn't read your manual ... have a closer look to the TABLE in § 4.11 "PINS" ... page 26 Bottom.
Everything explained ...
Now, for your own sake ... much better to Write " High Portb.0 " !!!
and FULLY use the example shown in page 6 ... of the Manual !!! not that from a STAMP example ... even if compatible.
Alain
Thanks for the reply. I did not look at that table because of it saying BASIC stamp.
You are correct. That is the area to explain the reason it works.
I will go back and read the manual again this time not skipping info on BASIC STAMPS just i ncase i run into this problem again.
Thanks,
Merlin Knight