Hello everyone,
Can anyone share a code in using Picbasicpro v.2.50 using pic16f628a to turn on Led1 and Led2 in portB.4 and portb.5 using internal clock. And to trigger the Led1 and Led2 I would press 1 or 2 to the hyperterminal commanding my pic to lit the leds and I want to use the internal usart.
here is a code I found but not working...
----deleted some of the code you wrote.....
Hserin [inputData]
cnt = inputData
if Cnt = 1 then high PortB.4
pause 1000
goto main
What are you trying to achieve here? And what do you mean by "not working"
From the code it looks like when Cnt=1 you turn on PortB.4, which is okay. Now what happens when Cnt takes the values 0, 2, 3,.....? You have not told the micro what to do?
I would expect the code to be something like this after you get data from the USART (check the syntax with the compiler, I have not used Basic in the past 10 years!!)
if Cnt = 1 then
high PortB.4 //turn on port B pin 4
low PortB.5 //turn off port B pin 5
else if Cnt = 2 then
low PortB.4 //turn off port B pin 4
high PortB.5 //turn on port B pin 5
else //any other value
low PortB.4 //turn off both pins port B 4 and 5
low PortB.5
endif