DT_INTS-14 (Blinky Light) Help ?


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237

    Smile DT_INTS-14 (Blinky Light) Help ?

    Hi All

    I have a little bit of code running on a 16f688 all running great.... I have since added DT's blinky Light code, I have used before all good.... But this time I am losing my Digital Output port RC3 and my ADC Channel AN1.

    I remove the Blinky code and my prog works again.

    Any Ideas

    Anyone

    Thank you for reading

    BR
    Andy

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS-14 (Blinky Light) Help ?

    Hi

    Did you set the ansel register?

    See the data sheet for which bits control your I/O pins

    Code:
    ANSEL = %00000001 'for digital set to 0 and for analog 1
    also post your code so we don't have to guess

  3. #3
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS-14 (Blinky Light) Help ?

    Sorry I forgot to add the code :-

    Any ideas on what I am missing welcome, The two includes are in place and are being used !

    Is placement important ?



    Thank you

    Code:
    '****************************************************************
    '*  Name    :      TRIP.BAS                                      *
    '*  PIC     : PIC16F688                         *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2015 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 29/10/2015                                        *
    '*  Version : 2.0                                               *
    '*  Notes   : 322 Words used                                    *
    '*          : Now has Trip Delay Link                           *
    '*          : and Interupt for flash led                        *                            *
    '*  Process Signal  AN0                                         *
    '*  Alarm Preset    AN1                                         *
    '*  Trip Preset     AN2                                         *
    '*  Flash LED       RC1                                         *
    '*  Delay Trip Lnk  RC2                                         *
    '*  Alarm Relay     RC3                                         *
    '*  Trip Relay      RC4                                         *
    '*  Reset Trip P/B  RC5                                         *
    '****************************************************************
    
    DEFINE OSC 8              ' Set RC Clock to 8 Megs
    
    wsave var byte $70 SYSTEM
        
    '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
    ADCON0 = %10000001         ' Enable ADC / Right justify result (1023)
    ANSEL  = %00000111         ' Enable ADC channels AN2-AN0
    CMCON0 = %10000111         ' Disable both comparators
    
    'Analogs
    PROC_SIG Var word           ' Create PROC_SIG to store result
    ALARM_TRIM Var word         ' Create ALARM_TRIM to store result
    TRIP_TRIM Var word          ' Create TRIP_TRIM to store result
    
    'Digitals
    ALARM_RLY VAR PORTC.3       ' Alarm Relay
    TRIP_RLY VAR PORTC.4        ' Trip Relay
    TRIP_RST VAR PORTC.5        ' Trip Reset PB
    TRIP_DLY VAR PORTC.2        ' Trip Delay Link
    FLASH_LED var PORTC.1       ' Flashy LED
    
    'Constants
    RLY_OFF CON 0               ' Relay Off
    RLY_ON CON 1                ' Relay On
    HYS CON 8                   ' 25 = 1/8Volt
    
    INCLUDE "DT_INTS-14.bas"     ' Base Interrupt System
    INCLUDE "ReEnterPBP.bas"     ' Include if using PBP interrupts
    
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   TMR1_INT,  _ToggleLED1,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    T1CON = $31                ; Prescaler = 8, TMR1ON
    @ INT_ENABLE  TMR1_INT     ; enable Timer 1 interrupts
    
    
    
    MAIN:
    
    START:
    LOW TRIP_RLY                ' Ensures Trip Rly off
    'LOW ALARM_RLY               ' Ensures Alarm Rly off
    
    Gosub ANALOG_READ
    If (ALARM_RLY = RLY_OFF) AND (PROC_SIG >= (ALARM_TRIM + HYS)) THEN ALARM_RLY = RLY_ON
    If (ALARM_RLY = RLY_ON) AND (PROC_SIG <= (ALARM_TRIM - HYS)) THEN ALARM_RLY = RLY_OFF
    If (TRIP_RLY = RLY_OFF) AND (PROC_SIG >= (TRIP_TRIM)) and TRIP_DLY = 0 THEN goto D_TRIP
    If (TRIP_RLY = RLY_OFF) AND (PROC_SIG >= (TRIP_TRIM)) AND TRIP_DLY = 1 THEN goto L_TRIP
    GOTO START
    
    
    L_TRIP:                     ' Latching Trip
    high TRIP_RLY               ' Latch Trip Relay
    IF TRIP_RST = 0 THEN GOTO START     'Release If PB Reset  Pressed   
    Goto L_trip
    
    D_TRIP:                     ' Delayed Trip
    HIGH TRIP_RLY               ' Latch Trip Relay
    PAUSE 1000                  ' Pause for T_Delay
    GOTO START
    
    ANALOG_READ:                ' Read analogs
    ADCIN 0, PROC_SIG           ' Read channel 0 to PROC_SIG
    Pause 2                     ' ADC Settle time
    ADCIN 1, ALARM_TRIM         ' Read channel 1 to ALARM_TRIM
    Pause 2                     ' ADC Settle time
    ADCIN 2, TRIP_TRIM          ' Read channel 2 to TRIP_TRIM
    Pause 2                     ' ADC Settle time
    RETURN
    
    goto MAIN
    
    '---[TMR1 - interrupt handler]--------------------------------------------------
    ToggleLED1:
         TOGGLE FLASH_LED
    @ INT_RETURN

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS-14 (Blinky Light) Help ?

    I don't see any tris statements? I know PBP sets some automatically, but it is a good habit
    to manually set them.

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


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS-14 (Blinky Light) Help ?

    DEFINE OSC 8 ' Set RC Clock to 8 Megs
    that doesn't set any clock ... just tell the compiler to adjust the timings for a 8 Mhz clock ...

    sooo, clock settings are missing ...

    default settings are ...

    Code:
    #CONFIG
        __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
    #ENDCONFIG
    is that what you want ???

    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
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS-14 (Blinky Light) Help ?

    Stand down folks..... I sorted it :-

    LOW ALARM_RLY ' Ensures Alarm Rly off

    Was commented out.... I forgot to put it back.

    Thanks for all suggestions .... Appreciated as always

    BR
    Andy

Similar Threads

  1. Replies: 3
    Last Post: - 15th April 2015, 05:58
  2. DT-INTs Blinky Light question
    By circuitpro in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 5th February 2010, 04:29
  3. Blinky not working with TOGGLE
    By AndrewC in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd November 2008, 09:45
  4. My first Blinky!
    By nomad in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 25th September 2007, 18:29
  5. An other newby, an other blinky probem
    By Maniac in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 23rd September 2005, 16:16

Members who have read this thread : 1

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

Tags for this Thread

Posting Permissions

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