Hi,Eris
Seems you have to read some closer the µChip Datasheet section 3 ...
Lots ( ! ) of registers to set " by hand " that PbP do not handle !!!
to confirm that, just program a dusty 16F84 ... will work properly with your example !!!
Alain
Hi,Eris
Seems you have to read some closer the µChip Datasheet section 3 ...
Lots ( ! ) of registers to set " by hand " that PbP do not handle !!!
to confirm that, just program a dusty 16F84 ... will work properly with your example !!!
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
The internal oscillator doesn't automatically run at 8MHz. You have to
write to OSCCON to switch to 8MHz.
The default value of OSCCON frequency select bits is for 4MHz. See the
datasheet for the default value in this register at power up.
Also PULSOUT toggles the pin twice to produce your pulse, so the initial
state of the pin determins the polarity of the pulse.
You want a high-going pulse for your servo, so clear the pin before the
PULSOUT command.
See if this works.
Code:@ DEVICE INTRC_OSC_NOCLKOUT, MCLR_OFF,WDT_OFF,PROTECT_OFF DEFINE OSC 8 servo var PORTC.5 i var word OSCCON = %01110000 ' Now it's going to run at 8MHz PORTC.5 = 0 ' <-- make pin low before PULSOUT (toggles high then low) TRISC.5 = 0 ' make pin an output loop: for i = 200 to 400 low servo pulsout servo,i pause 18 next i goto loop
Hi Eriswerks,
Try using another servo or at least make sure that your servo is ok.
Also, as you know, for most of the servos, the pulse range is from 100mS to 200mS.
For some recent ones, range is from 60mS to 240mS (wider movement).
Also, below is a code to consider while playing with servos.
servo var portc.5
freq var byte
pulse var byte
loop:
pot portc.3,255,pulse
pot portc.4,255,freq
if pulse>240 then pulse=240 'Max pulse protection.
If pulse<60 then pulse=60 'Min pulse protection
If freq>30 then freq=30 'Frequency protection
IF freq<5 then freq=5 'Frequency protection
pulsout servo,pulse
pause freq
goto loop
-----------------------
If you also use an LCD, you can see at what value(s) your servo does what it does and how it does.
------------------------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
[QUOTE=sayzer]
Try using another servo or at least make sure that your servo is ok.
Also, as you know, for most of the servos, the pulse range is from 100mS to 200mS.
> That's really new ...
> Mhhhh, I do not know who's inside ... but he has a lot to learn about R/C Equipments ...
Alain
PS: ALL servos accept the 40-50 Hz frame rate ...
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
---------------------------------------------
There must be some language in PicBasic to tell the PIC to which frequency to set the internal oscillator, but I haven't been able to find it.
What am I (still) doing wrong here?
---------------------------------------------
Yes, there is a PicBasic command... POKE
Use POKE to write values to ANY register in the datasheet. I usually use binary values so it's easier to see and change individual bits:
POKE OSCON, %10110001
(this is a made up value, I don't know what you will need exactly)
For Acetronics,
This is not the place for your egoistic posts.
Why don’t you go to a primary school and show the little kids how much you know about everything you think you know about?
You can top your ego that way.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Sayzer,
If you want to know, I do not do care about my EGO ... no time for that.
I'd just like you NOT to tell wrong things to those who do not know ...
It's difficult enough to learn pic's programming ... try not to add your own errors nor misunderstandings ... verify first !!!
Alain
Engineer, 30 years of DiY R/C, ... and always doubting ...
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Ok, Acetronics I agree . People make mistake even the ones with 30yrs of experiences.
Could you pls tell us what happens if we send 250mS - 300mS pulse to an R/C servo at 50Hz?
Also, 350mS and 400mS at the same freq?
How would servo respond to these pulse(s) ?
Pls do not make it so complicated so that we, the learners without 30 yrs of experiences, can learn something from your valuable words. Before you post your answer, make sure that your answer does not conflict with your previous posts;
----------------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Hi, sayzer
So, you've decided to be frankly ridiculous ... your problem !!!
250ms pulses @ 50 HZ gives .... a firm "1" ( or "0" ) level !!! you've just recreated the resettable monostable mutivibrator !!!
Who should go back to primary school ??? ( period = 1 / frequency ... no need a highschool for that )
your servo wil just have the little "jump" for amplifier settling at power up ... and won't move any more.
you shouldn't have tried .... you're really boring.
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks