Elapsed_Int-18 Alteration


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    94


    Did you find this post helpful? Yes | No

    Default

    Hmmm,

    although I said the penny had dropped, I don't seem to be able to make the code work where you said to put it:

    Code:
    </i></font>StartTimer:
        <b>IF </b>OSC = 48 <b>THEN              </b><font color="#000080"><i>; IF OSCILLATOR IS 48MHz THEN
            </i></font>@ BSF T1CON,T1CKPS0, 0    <font color="#000080"><i>; SET PRESCALE VALUE TO 2
        </i></font><b>ENDIF
        </b>T1CON.1 = 0                   <font color="#000080"><i>; (TMR1CS) Select FOSC/4 Clock Source
        </i></font>T1CON.3 = 0                   <font color="#000080"><i>; (T1OSCEN) Disable External Oscillator
        </i></font>T1CON.0 = 1                   <font color="#000080"><i>; (TMR1ON) Start TIMER1
    </i></font><b>RETURN</b>
    Now when I compile my program, it comes up with the error: Bad expression or missing THEN. (Elapsed_INT-18.bas)

    Is this because the oscillator has been defined in my program and not in the Elapsed_INT-18? I've had problems similar to this before when I've tried to create simple modules like you do (not saying that yours are simple I mean my ones!). I like that style of programming I just can't seem to make it work.

    Thanks for any help.

    Rob

    P.s. I looked up your thread "Show us your colours"... I like it!

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Try it like this ...
    Code:
    <font color="#000000"><b>StartTimer</b>:
    <font color="#000080">@   IF OSC == 48                  </font><font color="#0000FF"><b><i>; IF OSCILLATOR IS 48MHz THEN
    </i></b></font><font color="#000080">@       BSF T1CON,T1CKPS0, 0      </font><font color="#0000FF"><b><i>; SET PRESCALE VALUE TO 2
    </i></b></font><font color="#000080">@   ENDIF
        </font><b>T1CON</b>.<font color="#800000"><b>1 </b></font>= <font color="#800000"><b>0                   </b></font><font color="#0000FF"><b><i>; (TMR1CS) Select FOSC/4 Clock Source
        </i></b></font><b>T1CON</b>.<font color="#800000"><b>3 </b></font>= <font color="#800000"><b>0                   </b></font><font color="#0000FF"><b><i>; (T1OSCEN) Disable External Oscillator
        </i></b></font><b>T1CON</b>.<font color="#800000"><b>0 </b></font>= <font color="#800000"><b>1                   </b></font><font color="#0000FF"><b><i>; (TMR1ON) Start TIMER1
    </i></b></font><font color="#008000"><b>RETURN
    </b></font>
    The OSC value isn't directly available to PBP.

    Or, you could make it available, and do it that way...
    Code:
    <font color="#000000"><b>PicOSC  </b><font color="#008000"><b>CON </b></font><b>EXT
    </b><font color="#000080">@PicOSC = OSC
    
    </font><b>StartTimer</b>:
        <font color="#008000"><b>IF </b></font><b>PicOSC </b>= <font color="#800000"><b>48 </b></font><font color="#008000"><b>THEN           </b></font><font color="#0000FF"><b><i>; IF OSCILLATOR IS 48MHz THEN
    </i></b></font><font color="#000080">@       BSF T1CON,T1CKPS0, 0      </font><font color="#0000FF"><b><i>; SET PRESCALE VALUE TO 2
        </i></b></font><font color="#008000"><b>ENDIF
        </b></font><b>T1CON</b>.<font color="#800000"><b>1 </b></font>= <font color="#800000"><b>0                   </b></font><font color="#0000FF"><b><i>; (TMR1CS) Select FOSC/4 Clock Source
        </i></b></font><b>T1CON</b>.<font color="#800000"><b>3 </b></font>= <font color="#800000"><b>0                   </b></font><font color="#0000FF"><b><i>; (T1OSCEN) Disable External Oscillator
        </i></b></font><b>T1CON</b>.<font color="#800000"><b>0 </b></font>= <font color="#800000"><b>1                   </b></font><font color="#0000FF"><b><i>; (TMR1ON) Start TIMER1
    </i></b></font><font color="#008000"><b>RETURN
    </b></font>
    DT

  3. #3
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    94


    Did you find this post helpful? Yes | No

    Thumbs up All sorted!

    Cool - it's working now! Cheers for showing me the second way as well as I think it may help me out with writing modules like you do!

    Thanks very much

    Rob

Similar Threads

  1. Config Settings for the 18 series
    By Ioannis in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 30th June 2009, 21:03
  2. PICPROTO 18 Prototyping Board Examples
    By rick hardy in forum General
    Replies: 9
    Last Post: - 21st April 2008, 05:19
  3. Replies: 3
    Last Post: - 31st January 2008, 07:30
  4. Real Time Clock & Eeprom
    By smart_storm in forum General
    Replies: 8
    Last Post: - 17th February 2006, 19:03
  5. PIC16F62x 18 pin SMT breakout PCB
    By jdgrotte in forum Adverts
    Replies: 1
    Last Post: - 1st January 2004, 08:59

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts