PIC16F345 and DT_INTS-14


Results 1 to 6 of 6

Threaded View

  1. #3
    Join Date
    Mar 2013
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: PIC16F15345 and DT_INTS-14

    Sorry, it is PIC16F15345. Attached is modified DT_INTS-14 but does not work.

    Code:
    '
    DISABLE DEBUG
    #CONFIG
        __config _CONFIG1, _FEXTOSC_OFF & _RSTOSC_HFINT32 & _CLKOUTEN_OFF & _CSWEN_OFF & _FCMEN_OFF
        __config _CONFIG2, _MCLRE_ON & _PWRTE_ON & _LPBOREN_OFF & _BOREN_ON & _BORV_LO & _ZCD_OFF & _PPS1WAY_OFF & _STVREN_ON
        __config _CONFIG3, _WDTCPS_WDTCPS_11 & _WDTE_OFF & _WDTCWS_WDTCWS_6 & _WDTCCS_HFINTOSC
        __config _CONFIG4, _BBSIZE_BB512 & _BBEN_OFF & _SAFEN_OFF & _WRTAPP_OFF & _WRTB_OFF & _WRTC_OFF & _WRTSAF_OFF & _LVP_OFF
        __config _CONFIG5, _CP_OFF
    #ENDCONFIG
    '           
    OSCFRQ = %101                ' 16mhz
     DEFINE OSC 16  
    ' lcd setup
     DEFINE lcd_lines 4         
     DEFINE lcd_commandus 1500    
     DEFINE lcd_dataus 44
     DEFINE LCD_DREG PORTB        
     DEFINE LCD_DBIT 4            
     DEFINE LCD_RSREG PORTC       
     DEFINE LCD_RSBIT 7           
     DEFINE LCD_EREG PORTC       
     DEFINE LCD_EBIT 6            
    '
    '-------------------- I/O ------------------------------------------------------
    ' 
      TRISC.4=1            ' input TASTER
      TRISC.5=0            ' output LED1 
      ANSELA = %000000     ' ADC off all
      ANSELB = %00000000   ' 
      ANSELC = %00000000   ' 
    '
    '*******************************************************************************
    ''************************* DT_INTS-14 *****************************************
    '
    INCLUDE "DT_INTS-14_16F15345-A.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
    '
    '-------------------------------------------------------------------------------
    ;-- Place a copy of these variables in your Main program -------------------
    ;--   The compiler will tell you which lines to un-comment                --
    ;--   Do Not un-comment these lines                                       --
    ;---------------------------------------------------------------------------
    wsave   VAR BYTE    $20     SYSTEM       ' location for W if in bank0
    'wsave   VAR BYTE    $70     SYSTEM      ' alternate save location for W 
    '                                        ' if using $70, comment wsave1-3
    '
    ' --- IF any of these three lines cause an error ?? ------------------------
    '       Comment them out to fix the problem ----
    ' -- Which variables are needed, depends on the Chip you are using -- 
     wsave1  VAR BYTE    $A0     SYSTEM      ' location for W if in bank1
     wsave2  VAR BYTE    $120    SYSTEM      ' location for W if in bank2
     wsave3  VAR BYTE    $1A0    SYSTEM      ' location for W if in bank3
    '-------------------------------------------------------------------------------
    '
    '*************************** PIN NAMES ***************************************** 
      TASTER     VAR portC.4       '  
      LED1       VAR portC.5   
    '
    ' test program for PIC16F15345 with DT_INTS-14
    ' when button pressed, display "LED-blinky"
    ' TMR1 interupts toggle LED1
    start:
          GOSUB clearLCD  
          LCDOUT $FE,$80,"  TEST 16F15345"
          LCDOUT $FE,$94,"   20250825"
          LCDOUT $FE,$D4,"        push button"   
    '               
          WHILE TASTER = 1 : WEND             ' wait for pressed taster
          PAUSE  500
    ' 
          GOSUB clearLCD 
               LCDOUT $FE,$80,"   LED-blinky"                                                         
    '      
    Main:
          PAUSE 1
          GOTO Main                                    
    '
    '*******************************************************************************
    '
    clearLCD:
          LCDOUT $FE,$01   
              RETURN
    '
    '---------------------[TMR1 - interrupt handler]--------------------------------
    ToggleLED1:
         TOGGLE LED1
    @ INT_RETURN
    Attached Files Attached Files

Similar Threads

  1. DT_INTS for K42
    By mpgmike in forum Code Examples
    Replies: 29
    Last Post: - 7th June 2022, 16:29
  2. DT_INTS and 18F26k22
    By Mike2545 in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 9th September 2017, 16:08
  3. Dt_ints-14
    By iw2fvo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th November 2013, 07:57
  4. Re: DT_Ints-18
    By Steve_88 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 4th March 2012, 18:39
  5. Problem with DT_Ints-14
    By BobSpencerr in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 1st March 2007, 05:27

Members who have read this thread : 9

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