Menu

Wait xx us and 8mhz osc

kent_twt4
2007-09-20
2013-05-30
  • kent_twt4

    kent_twt4 - 2007-09-20

    Trying to debug some flakey code recently, so want to clear up a question about GCBasic wait routines.  Looking at the source code, it might appear that using 'wait xx us' delays with an 8mhz osc would be illegal?  Yet, a software Uart code that uses 'wait 104 us' with no problem.  But I know on occasion, the compiler will complain that 'us' delays not supported, or something to that effect.

     
    • Hugh Considine

      Hugh Considine - 2007-09-21

      On 20 MHz and higher chips, GCBASIC uses a delay subroutine for the us delay. This means that it can handle both variables and constants as length parameters.

      On chips that are less than 20 MHz, it creates inline delay code. To do this, it needs to know the length of the delay beforehand and thus only constants can be used.

      This doesn't apply to any other delays, since they're all long enough to call without adding significant extra overhead.

       
    • kent_twt4

      kent_twt4 - 2007-09-21

      I appreciate the clarification, Thanks, that helps!  The delay was like 'wait RMotorOut 10us', so its somewhere else. 

      Been trying to decode an R/C transmitter signal.  It seems that by luck a valid signal is presented to the 16f684.  The difficultly is changing the R/C signal to a suitable PWM.  Had the PWM down cold with a substitute potentiometer, inserted back into the main code, tinkered with it, then lost it.  Oh well, back to the grindstone.

       

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.