Menu

multiple cases?

Help
2020-11-13
2020-12-26
  • Reginald Neale

    Reginald Neale - 2020-11-13

    I'm a beginner. Looking for the most efficient way to continually loop, monitoring an input for one of four possible patterns as shown in the attached file. I need to jump to a different subroutine for each pattern.
    I'm using GCB with a 16F1829 and a PicKit 3 and LPC Demo Board.

     
  • Anobium

    Anobium - 2020-11-14

    You should read http://ww1.microchip.com/downloads/en/appnotes/01473a.pdf this will give you some insights. Once you have digested the pdf then post again.

    Select-Case may be answer but the pdf will help you determine the strategy.

     
  • Reginald Neale

    Reginald Neale - 2020-12-25

    Thanks, that does give me some ideas. I don't really need to measure the waveforms, just discriminate between them. One thing I didn't mention is that this is a micropower application, so I am using 32kHZ clock and many configs turned off. Is it possible to change configuration items inline with GCB code? For instance, turning on comparator function for a few milliseconds to monitor a signal, then turning it back off to reduce current drain.
    I hope my question makes sense.

     
  • David Stephenson

    I think you've got to decide whether to monitor the duty cycle using a gated timer. Or you count the number of pulses in a fixed time period (has to be > 10s to capture the slow one).
    Either way timer1 is probably the way to go and counting the pulses may work in SLEEP if you want to keep the current down.

     

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.