Slow starting up


Closed Thread
Results 1 to 35 of 35

Hybrid View

  1. #1
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Slow starting up

    I thought that pause should be in your main loop. You'd do all the stuff and get the data ready for transmit, pause 500 and then send it to the LCD. I assumed that time was needed to get the LCD to warm up once your main loop starts not simply after the chip is powered up.

    I'd like to know chip as I'm wondering if OSCCON statement is correct.

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: Slow starting up

    Hi, the Holy Squad ...

    I found this was overall a bit strange ...

    so, rewrote the program and tested it with ISIS ... ( note it works fine NOW ... with ISIS !!! )

    just change the DEC3 and DEC4 ( lcdout section ) into DEC ...

    and, please, tell me your results ...

    There's something I really do not understand here ...Alain

    Code:
    '****************************************************************
    '*  Name    : UNTITLED.BAS                                      *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2013 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 10/05/2013                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
    INCLUDE "modedefs.bas" 'Includes supoprt for PicBasic language
    
    OSCCON = %01101000 ' 16F 88 4 Mhz ... for those who didn't find it ... ( LOL )
    DEFINE OSC 4
      
    
    DEFINE LCD_DREG PORTB ' Set LCD Data port
    DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_RSREG PORTA ' Set LCD Register Select port
    DEFINE LCD_RSBIT 2 ' Set LCD Register Select bit
    DEFINE LCD_EREG PORTA ' Set LCD Enable port
    DEFINE LCD_EBIT 3 ' Set LCD Enable bit
    DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 2 ' Set number of lines on LCD
    DEFINE LCD_COMMANDUS 2500
    DEFINE LCD_DATAUS 250
    DEFINE CHAR_PACING 2000
    pause 1500
    LCDOUT $FE,1
    
    
    ' Define ADCIN parameters
    Define ADC_BITS 10 ' Set number of bits in result
    Define ADC_CLOCK 3 ' Set clock source (3=rc)
    Define ADC_SAMPLEUS 50 ' Set sampling time in uS
    
    DEFINE CCP1_REG PORTB 
    DEFINE CCP1_BIT 0
    
    CMCON  = 7
    CVRCON = 0  
    
    ANSEL  = %00000011 ' set   AN0, AN1  as analog, others to digital
    ADCON0 = %11000001 ' Configure and turn on A/D Module
    ADCON1 = %10000000' Set PORTA analog for ten bit ADC
    
    PORTA = 0
    PORTB = 0
    TRISB = %01000010
    TRISA = %00000111
    
    DutyCycle       var word
    OldDutyCycle    Var Word
    Frequency       var word
    OldFrequency    VAR word
    
    WHILE 1
    
    'ADCON0.2 = 1			'Start Conversion
    pause 20	
    ADCIN 0, DutyCycle 'Read channel PORTA.0 Duty Cycle
    ADCIN 1, Frequency 'Read channel PORTA.1 Frequency
    
     'Frequency = Frequency + 245
     'DutyCycle = DutyCycle/4
     
    IF Frequency <> OldFrequency OR DutyCycle <> OldDutyCycle THEN
     
        lcdout $FE,2, "DutyCyc: ", dec3 DutyCycle/4
        lcdout $FE,$C0, "Frequen: ", dec4 Frequency+245
        pause 100
        
        HPWM 1,DutyCycle/4,Frequency+245 'channel, dutycycle, frequency
        OldFrequency = Frequency
        OldDutyCycle = DutyCycle
        pause 20
    ENDIF
    
    WEND
    
    END
    Last edited by Acetronics2; - 14th May 2013 at 20:31.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: Slow starting up

    Hi,

    Nothing Strange .... Just Shame on me

    Alain

    PS: F....ing Timeout !!! I begin to think just a Lester's trick to get more posts on the forum counter ...
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default Re: Slow starting up

    Thanks for he program Alain, way better then mine
    I changed breadboard, redone the circuit and it works !! go figure....
    I tried opersting at 1Mhz to get slower output frequency. used
    OSCCON = %01001000 '
    but DEFINE OSC 1 do not work.
    Do I have to do something else ?
    K

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: Slow starting up

    Yes ...

    Urgent to learn your Holy Manual !!!

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default Re: Slow starting up

    Hey
    belive me I had a look..
    page 278 and 279 of the manual states the define and OSCCON values.
    The datasheet talks about the OSCCON value which I set. But the define OSC 1 Mhz do not work. Lowest it will go is 4Mhz.
    Datasheet stipulates internal oscillation can go as low as 31khz...

  7. #7
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Slow starting up

    I'd like to see the rest of your code but is OSCCON = %01001000 correct? Shouldn't it be OSCCON = %01001110? I'm assuming you're using an internal oscillator, should be stable and it should be used as system clock. I don't know why 4Mhz worked but, if that's all you changed between compiles, then try that.

    This is for a 16F88 and is on page 40 of the datasheet.

Similar Threads

  1. My project is starting
    By cncmachineguy in forum General
    Replies: 91
    Last Post: - 15th February 2011, 01:56
  2. Starting with PIC18F
    By Gérard in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 7th May 2006, 16:40
  3. Starting PC from PIC
    By Tissy in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 25th February 2006, 14:42
  4. Help starting a 876A
    By Naslund in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th March 2005, 09:25
  5. Help for someone just starting
    By Ed Cannady in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 30th March 2003, 11:17

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