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>