Serout code space


Results 1 to 12 of 12

Threaded View

  1. #6
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Serout code space

    Nice
    If it could be matched in space, I’d still prefer to see my own code, just that I’ve never had a reason to do it until now.
    It would be less in asm though, and I still think I could top it.

    It was worth the effort to do with a dsPic where the pin was not mappable to UART, so incidentally tried with PBP as well.

    No BASIC For/Next loop, instead I’d count down to zero.
    No shift command, instead an asm rotate to ensure only 1 instruction,
    My own delay routine, which is conveniently right before a return, so can be called multiple times.
    watchdog timer resets also have to be turned off because PBP won’t put them in it’s own routines, but in YOUR code.

    To my disadvantage, there needs to be some value stored in Delay, which would claim some more space.


    Something like this (untested).. and I can’t remember if PBP labels need the underscore or not.
    Code:
    count var byte
    pdelay var byte
    
    serialout:
    @ movlw	,8
    @ movwf	_count	,F
    @ clrf PORTB	,1
    @ call pausedelay
    sendbyte:
    PORTB.1 = txbyte.bit0
    @ rrf txbyte	,F
    @ call pausedelay
    @ decfsz _count
    goto sendbyte
    @ bsf PORTB	,1
    pausedelay:
    @ movlw	,210
    @ movwf	_pdelay	,F
    zpausedelay:
    decfsz _pdelay
    @ goto zpausedelay
    @ return
    Last edited by Art; - 21st November 2016 at 05:52.

Similar Threads

  1. Working code but my layman approach uses too much code space
    By Christopher4187 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 14th December 2012, 20:44
  2. I'm running out of code space example.
    By retepsnikrep in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st June 2010, 20:33
  3. Minimizing code space
    By Tobias in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th May 2009, 07:25
  4. Need more code space
    By Sphere in forum General
    Replies: 2
    Last Post: - 19th September 2005, 20:49
  5. Need more code space
    By ghutchison in forum General
    Replies: 1
    Last Post: - 12th February 2005, 20:54

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