same problem...for some reason the timer is not counting into the high byte, so hence its maximum value is only 256.
im looking at the timer through the watch window, and it doesnt seem to go upto the value specified in the CCPR register, but then when i looked at the simulator logic analyser, and measured the pulses, it seems like its working. to measure the frequency of pulses in the logic analyser, do i just need to line the cursor with the respective point and then multiply the no of cycles by (Fosc/4)?
i'll be able to test it tomorrow using the hardware and i will get back to you.
this is part of a major project which involves ultrasound sensors, IR sensors, keypad, LCD and servos.the guy working on the ultrasound is using CCP1 to pulse the US module, so i cant use that..
i'll check it using the minimal-PIC18 board tht we're using since it has the 10MHz clock and get back to you regarding whether it worked or not. thanks for your help!
or if i have time, i might even re-do the calculations for my PICDEM board and do it at home!
The PIC18f452 doesn't have a internal oscillator Most all compilers use 18f542 in there samples It's a fussy Chip.
I never had any problems using code from the 18f1320 after you set the OSC right you should be good to go
That's the code I'm running now. The program seems to work on the simulator. I earlier wanted to test it on the minimal-PIC18 board that we're using, but there was some difficulty debugging it.
the PICDEM board has a 4MHz crystal, and using no prescaler the timer will increment every 1microsecond right? so based on that the settings for CCPR2 were 20000 for the "OFF" time and between 1000-2000 for the control pulse...are these right?
however, intially when pluggin the servo in, i think we mayb hav inadvertantly plugged in -5V to the control signal pin, and then -5V to the ground pin..then we corrected everything and plugged in the ground pin to the groun of the PICDEM board and the control signal to the AN2 port..but now when i run the code i jus hear the servo buzzing..has it blown?do we need a new servo?or is there something with the code/calculations/board?
the servos keep twitching and dont respond to the control signals from the PIC..sometimes the twitching is more controlled with a control signal, & sometimes it isnt.they twitch from the time i plug in the power..
the oscillocope shows perfect pulses of min 1ms and max 2ms. what am i doing wrong/not doing?
the power supply for it is 5V regulated 3A.
it doesnt work in proteus either... here's the code again.. for 10Mhz