when 128k is not enough


Closed Thread
Results 1 to 40 of 82

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,680


    Did you find this post helpful? Yes | No

    Default Re: when 128k is not enough

    they are now . I had a few copy paste errors where the second delay fell off the c version and the pbp still had a unnecessary loop in it as well as the led initialising to 0 line misplaced into the loop .I just saw the leds flashing and assumed all was equal . the outcome is largely unaffected anyway . I was really just quantifying the interrupt latency for my own edification , I still don't think the code size comparison is valid a fairer test probably needs a few serout2's and a lcdout and a onwire or two to be meaningful .
    the mikro c is now 193 bytes and the pbp 315 other than

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,680


    Did you find this post helpful? Yes | No

    Default Re: when 128k is not enough

    In the C version there's a d_mode variable which you're checking
    your right of course
    that's the way I eliminated the redundant loop in the c version
    looks like I skipped that step for pbp

    code size now 336 and functional equivalence restored
    thanks for noticing that



    Code:
    *  Name    : UNTITLED.BAS                                      *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 29/11/2014                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :   pic12f1822                                                *
    '****************************************************************
    #CONFIG
    cfg1 = _FOSC_INTOSC
    cfg1&= _WDTE_ON
    cfg1&= _PWRTE_OFF
    cfg1&= _MCLRE_ON
    cfg1&= _CP_OFF
    cfg1&= _CPD_OFF
    cfg1&= _BOREN_ON
    cfg1&= _CLKOUTEN_OFF
    cfg1&= _IESO_ON
    cfg1&= _FCMEN_ON
      __CONFIG _CONFIG1, cfg1
    
    cfg2 = _WRT_OFF
    cfg2&= _PLLEN_OFF
    cfg2&= _STVREN_ON
    cfg2&= _BORV_19
    cfg2&= _LVP_OFF
      __CONFIG _CONFIG2, cfg2
    
    #ENDCONFIG
     
    DEFINE OSC 8 
    
    include "dt_ints-14.bas"
    include "REENTERPBP.bas"
    asm
    INT_LIST macro
          INT_HANDLER  INT_INT, _TL, PBP,yes
          endm
          INT_CREATE
          INT_ENABLE INT_INT
    ENDASM
        osccon=$70    '8 mhz
        anselA=0        'dig i/o 
        ANSELC=0
        TRISC= %11110000
        TRISA= %011111
        APFCON0.7=0
         OPTION_REG.6=0
      a  var  byte
      b  var  byte
      c  var  byte
      d  var  byte
      pin_mode var bit
      d_mode var bit
      x var byte
      all_off var byte
      
      pins_on var byte
      led var lata.5
     
      
      
      
      a=1        ;portC.0
      b=2         ;portC.1
      c=4         ;portC.2
      d=8         ;portC.3
      pin_mode=0
      d_mode=1
      all_off=~(a+b+c+d)
       led=0
      latC =   latC & all_off
      
     action:
      if d_mode then
      pins_on=a+b
      else
      pins_on=c+d
      endif
        
      for x = 1 to 5
      latC =   latC | pins_on
       
      
    
      pause 200
    
      latC =   latC & all_off
      
      pause 200
    
      next x
      if !d_mode  then  gosub shuffle
         d_mode= !d_mode
      goto action
      
       shuffle :
       pin_mode = not pin_mode
      if pin_mode then
      swap a,d
      swap b,c
      else
      swap b ,d
      swap c ,d
      endif
      return
      
    TL:
     led=!led 
    @ INT_RETURN

Similar Threads

  1. Saving space - close to 128k
    By longpole001 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 26th October 2014, 06:16
  2. writecode at upper half of 128K parts?
    By Tomasm in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd November 2004, 19:02

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