No program response, including config instructions


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: No program response, including config instructions

    First post your code here...
    Clkout is FOSC/4, so OSC is set to 8MHz, you should get 2MHz on pin.

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: No program response, including config instructions

    Analyser shows the clock "ticking" at 1MHz, corresponding to the default 4MHz/4, not the 2MHz I intended to set.

    The analyser shows GPIO.5 going Hi and staying there until the power is turned off.

    Power is 3 x 1.5 AA cells.




    Code is:

    ' Name : 12F683 Simplex Test
    ' Circuit :
    '


    ' Description : PICBASIC Program to Test 12F673 config & set up statements


    ' Circuit :


    ' Hardware :
    '
    ' Target PIC : 12F683
    ' Pins : 8
    ' Compiler : PICBASIC PRO Compiler 2.6
    ' Assembler : MPASM
    '
    ' Oscillator : Internal 1 MHz
    '
    ' ************************************************** ****************************
    ' Comments
    ' Functions:
    ' Inputs



    ' Outputs
    ' Pulde pin GPIO.5




    '
    ' ************************************************** ****************************
    ' Initialise
    ' CONFIG Register
    ' Notes:
    ' Config directive options are in PIC12F683.INFO in C:\PB3\Device_Reference
    ' Format example is:
    ' cfg1 = _INTOSC ; Oscillator
    ' cfg1 = sfg1 $ _WDT_OFF ; Watchdog timer
    ' and so on, thus keeing lines short

    ' config1 for bits 0-7 of the config word, config2 for 8-15

    ' config1
    ' Oscillator
    ' cfg1 = _INTOSCIO ; INTOSCIO osc I/O on RA4/OSC2/CLKOUT
    ; RA5/OSC1/CLKIN

    ' Watchdog timer disabled
    ' cfg1 = cfg1 & _WDT_OFF ;WDT disabled

    ' Power-Up timer enabled
    ' cfg1 = cfg1 & _PWRTE_ON ;PWRT enabled

    ' MCLR Function is internal
    ' cfg1 = cfg1 & _MCLRE_OFF ;MCLR is input, MCLR int tied to VDD

    ' Code Protection OFF
    ' cfg1 = cfg1 & _CP_OFF ;Prog mem code protection is disabled

    ' Data code protection OFF
    ' cfg1 = cfg1 & _CPD_OFF ;Data memory code protection disabled


    ' config bits 8-15
    ' Brown-Out detect enabled
    ' cfg1 = cfg1 & _BOD_ON ;BOR enabled

    ' Internal Switchoover disabled
    ' cfg1 = cfg1 & _IESO_OFF ;Int Ext Switchover mode disabled

    ' Failsafe Clock disabled
    ' cfg1 = cfg1 & _FCMEN_OFF ;Fail-Safe Clock Monitor is disabled


    ' Statement to write CONFIG WORD bits 0-15
    ' __CONFIG _CONFIG1, cfg1

    #CONFIG

    cfg1 = _INTOSCIO
    cfg1 = cfg1 & _WDT_OFF
    cfg1 = cfg1 & _PWRTE_ON
    cfg1 = cfg1 & _MCLRE_OFF
    cfg1 = cfg1 & _CP_OFF
    cfg1 = cfg1 & _BOD_ON
    cfg1 = cfg1 & _IESO_OFF
    cfg1 = cfg1 & _FCMEN_OFF
    dgg1 = cfg1 & INTOSC


    __config cfg1

    #ENDCONFIG
    '
    ' Power control - PCON register
    ' Bit 0 Brownout Reset Status - Reset in software after Power-On or BOR
    ' Bit 1 POR Status - Reset in software after Power-On
    ' Bit 2 and 3 unimplemented

    ' Bit 4 Software BOR enable = 1
    PCON.4 = 1

    ' Bit 5 ULPWUE Ultra low power wake up = 0
    PCON.5 = 0

    ' Bit 6 and 7 unimplemented


    ' Define oscillator configuration 8MHz internal bits 6-4 = 111
    OSCCON.6 = 1
    OSCCON.5 = 1
    OSCCON.4 = 1

    ' A to D Off - set bit 0 = 0
    ADCON0 = 0

    ' All comparators off - Bits 0-2 111
    CMCON0.0 = 1
    CMCON0.1 = 1
    CMCON0.2 = 1

    ' Set all pins digital
    ANSEL = 0

    ' Internal Pull-Ups off
    ' OPTION_REG bit 7 = 0
    OPTION_REG.7 = 0

    ' UPU bits 0 -2, 4-5 = 0
    WPU.0 = 0
    WPU.1 = 0
    WPU.2 = 0
    WPU.4 = 0
    WPU.5 = 0

    ' Set TRISIO and outputs to 0 on boot
    ' GPIO.0 = Output
    TRISIO.0 = 0
    GPIO.0 = 0
    'GPIO.5 = Input
    TRISIO.5 = 1

    ' Set unused pins as output (but GPIO.3 must be input)
    TRISIO.1 = 0
    GPIO.1 = 0

    TRISIO.2 = 0
    GPIO.2 = 0

    TRISIO.3 = 1

    TRISIO.4 = 0
    GPIO.4 = 0


    TRISIO.5 = 0
    GPIO.5 = 0

    ' ************************************************** ****************************
    ' Variables etc
    ' Alias's and variables
    PulsePin VAR GPIO.5 ' Output


    ' Counters
    I VAR WORD




    ' ************************************************** ***************************
    ' Main Loop
    MainLoop:


    ' Turn PulsPin On
    PulsePin = 1


    ' Pause
    PAUSE 50


    ' PulsePin Off
    PulsePin = 9


    ' Back to MainLoop
    GOTO MainLoop




    '************************************************* ***************
    End

Similar Threads

  1. how to read sine wave response from sensor
    By klaus1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 23rd April 2011, 21:51
  2. Easy HID Command -Response application
    By ptig185 in forum USB
    Replies: 25
    Last Post: - 22nd September 2010, 20:56
  3. DS1994 memory response problem
    By chika in forum Off Topic
    Replies: 7
    Last Post: - 28th March 2007, 23:35
  4. ad pot fastest response!
    By Alaskanphoenix in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 26th July 2006, 23:21
  5. No Modem response
    By jimboho in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 11th November 2004, 06:58

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