I'm a PIC newcomer, and having succeeded in getting that LED flashing, I've moved on to a servo. I'm having a little trouble with that - it seems I can only make the servo move toward one of its extremes, and not back the other way.
I'm using the 16f690 PIC, which is what comes with Microchip's PICKit
2, and programming in PicBasic Pro. I'm guessing that my troubles have something to do with the special features of this chip, like the internal oscillator. I've been hunting for some example code for this chip to learn from, but 90% of what's out there is for the 16f84.The code below is what I've been using. I would really appreciate having any glaring errors pointed out to me.
position var byte position = 150 TRISC=0 PORTC=0
sweep: pulsout PORTC.5,position position = position + 1 pause 18 if position > 110 then sweepback goto sweep
sweepback: pulsout PORTC.5,position position = position - 1 pause 18 if position < 190 then sweep goto sweepback
I've also tried adjusting the pulses to see if I can get a different movement, but I get the same result every time.