
Originally Posted by
mbox
Hello everyone,
I'm trying to turn On Led1,Led2,Led3 with the Hyperterminal, using pic16F628a. I have this initial code that simply blinks 3 leds. Please guide me on how to configure the bits that enable RX in Rb1 using 4 Mhz internal clock. Please check my initial code below...
<font color = red>[codes]</font color>
Define OSC 4
CMCON = 7 ' PortA = digital I/O<font color=red> not quite, it means Comparators off.</font color>
VRCON = 0 ' A/D Voltage reference disabled
<font color=blue>"lets add this so PortA does not act like a radio antenna and create Ghost problems
PortA=0
TRISA=0
</FONT COLOR>
TRISB = %11110000 '<font color=green>ports7:4 inputs, ports 3:0, outputs, is that what you want? </font color>
PortB = %00000000 ' Turn pins to low state<font color=red> Put this before TRISB so when PortB becomes all outputs they initialize in a state set by you, instead of chance</font color>
Led1 var byte ' Led1 as a byte(8 bits) variable
myvar var word ' myvar as a word(16 bits) variable
begin:
high PortB.0
pause 100
low PortB.0
pause 100
high PortB.1
pause 100
low PortB.1
pause 100
high PortB.2
pause 100
low PortB.2
pause 100
goto begin
<font color = red>[\codes]</font color>
Should be CODE not CODES
<br>
<b> OH BY THE WAY, Congratulations, you have just written your first successful LED chaser, project using PBP and internal OSC, it works very nicely here.
Last edited by Archangel; - 14th October 2008 at 02:28.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks