Menu

1.1ms = 6ms??

Help
BFGXTC
2008-01-24
2013-05-30
  • BFGXTC

    BFGXTC - 2008-01-24

    Hi, I am having some trouble controlling a servo, and I realized to day that the pulses I am outputting are not what I specified in code.  I checked them with an oscilloscope and it shows the pulses being 6ms.  Is anything obviously wrong with my code? Note: I am using the internal oscillator, I am getting some crystals tomorrow)

    #chip 16F688, 20
    #config OSC = INTOSC            
    dir PORTC.2 OUT
        Dim i As Byte
    Do
         i = 1
         For i=1 To 50
             PULSEOUT PORTC.2, 110 10us
             Wait 140 10us
         Next
    Loop

     
    • BFGXTC

      BFGXTC - 2008-01-24

      I figured it out!  I didn't realize that the internal OSC was only 4mhz, so my code cycling the amount of time it would need to output a 1.1ms pulse at 20mhz, but was only running at 4, so the values ended up getting multiplied by around 5.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.