Hi all,
I just got my first program working on PBP. I have bought lots of books but am waiting for them to arrive. I was just wondering why I had this problem getting the blink.bas example working.
Portb.0 doesn't work. I tried portb.1 by chance and it worked. As I understand it, there are all sorts of registers to set and I have got the datasheet for the PIC I am using (16F886) but for someone as new as me, the datasheet doesn't tell me why. I have got a lot to learn!
I thought High and Low caused pins to become outputs so I didn't need to do anthing special with registers.
I have done quite a bit of work with PICAXE and when I change the osc freq on PICAXE the pause command is affected. I tried changing the freq from 4 to 8 in this code example and expected the LED to blink twice as fast but it didn't. Is PBP cleverer or have I not actually doubled the clock freq. I am using the internal osc.
Can anybody lend me a small hand with getting started on understanding datasheets and this specific problem.
Thanks
Rich
Code:
define osc 8
led var Portb.0
led2 var Portb.1
loop: High led ' Turn on LED connected to PORTB.0
High led2 ' Turn on LED connected to PORTB.0
Pause 500 ' Delay for .5 seconds
Low led ' Turn off LED connected to PORTB.0
low led2
Pause 500 ' Delay for .5 seconds
Goto loop ' Go back to loop and blink LED forever
End
Bookmarks