Menu

Time management with GCB

Help
Capaction
2009-12-03
2013-05-30
  • Capaction

    Capaction - 2009-12-03

    I am in trouble to manage time, some tests are OK others are not,   please have a look on my  GCB  coding.

    http://capaction.free.fr/JVC91203a.txt

    Thank you for your comments

     
  • Alistair George

    Alistair George - 2009-12-03

    What is the problem with your time is it very inaccurate?

     
  • Capaction

    Capaction - 2009-12-04

    Alygeoge  the problem is simple:
    I do not get any timer  count with CCP1CON b'00000111'
    Did you see on my GCB code there is a comment Test OK or Test Fail.
    The cases where the test fail are those  using Timer 1 and CCP1

     
  • kent_twt4

    kent_twt4 - 2009-12-04

    Is this now "in circuit" in an automobile?  Could be a severe noise problem if so.  If possible try to scope the input to see what you have.  There was a similar post with a noise problem in an auto environment.

    Try blipping an led prior to main to see if the PIC is resetting in those modes you are having trouble with.  Heavy filtering, opto-isolation, metal box, or any number of other means may be required to reduce noise.

        Dim CapturedTime As Word Alias CCPR1H, CCPR1L

    Never tried that personally, may be perfectly valid.  Wouldn't hurt to try some other byte variables, rather than the CCPR1 registers.

     
  • Capaction

    Capaction - 2009-12-04

    Kent  The printed  board is inside a metal box on the workshop bench.
    see picture http://capaction.free.fr/Bench.jpg
    The cable between the hall sensor and the printed circuit are connected with a shield cable, common ground is taken on the box.
    I wonder if the "init" and  "main" labels are in the correct place in my coding.
    I will try to put a blinking led before the "main" label  and see what happen on case 11
    Thank you for this idea

     
  • Alistair George

    Alistair George - 2009-12-05

    I havent tested, but you did not define name osc therefore maybe you need to change intrc_osc_noclkout to #config osc = int
    Some processors are a bit picky the docs mention.
    I know you did osc in settings but above might be needed? Also I notice your syntax wait 50 10ms surely wait 50 ms??

     
  • kent_twt4

    kent_twt4 - 2009-12-05

    The code in both the sub Ignition, sub TestIgnition need some math work so they work with a common time base.  Apply wait units after all math done.  Not aware of how the following statements are ever going to work:

    SnapTiming = TimeHalfCycle  - TimeCharge ms ;substract loading time
    SnapTiming = SnapTiming  + TimeOffset ;add automatic advance

    SnapTiming = TimeHalfCycle 10us - TimeCharge ms ;substract loading time
    SnapTiming = SnapTiming 10us + TimeOffset 10us ;add automatic advance

     
  • Capaction

    Capaction - 2009-12-07

    Thank you Alygeorge. <BR>
    You put your finguer on one of  my  problems. <BR>The HELP file says that if the clock speed is 4MHZ or less the external oscillator mode is selected by GCB. and there is none on my circuit ! <BR>
    I put the statement #config = int and the TIMER1 and CCP1 run showing other problems …..

     
  • Alistair George

    Alistair George - 2009-12-07

    NP getting config right is always tricky; sometimes I config then do something else later eg TRISB, which overrides the original config settings and wonder why its not working properly.
    Another suggestion is to check the settings as GCBasic has written them to the asm file. I have found GCB sometimes does not do exactly what your original intention was. Another thing to consider is the chip you have selected. Is it suitable for the job? I have spent a week doing code using a PIC12F206, only to find that the timing methods are taking too much time, and any button press is not being responded to as my code defines. So now I have to use another chip with interrupt driven i/o. Your code looks good and wish you well with your project. Unfortunately, I have been having some major problems with GCBasic, which is something to do with they way its installed on my system which I cant fix, so Im forced to use something else which is disappointing.
    Best wishes,
    Alistair

     

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.