Broken code


Closed Thread
Results 1 to 23 of 23

Thread: Broken code

Hybrid View

  1. #1
    sinoteq's Avatar
    sinoteq Guest


    Did you find this post helpful? Yes | No

    Default

    I am using MPLAB 7.10 and PicBasic Pro 2.46

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sinoteq View Post
    I am using MPLAB 7.10 and PicBasic Pro 2.46
    Got some source code for us to look at?

    On another note - you said you are using the 4620 to shift code out to another chip. Are you using the hardware SPI? If so, I've had nothing but trouble with that (nothing in the errata from Microchip). But I gave up on the hardware SPI and just wrote some code to 'bit-bang' the shifting for me. Fixed all my problems...
    Last edited by skimask; - 7th February 2007 at 13:18.

  3. #3
    sinoteq's Avatar
    sinoteq Guest


    Did you find this post helpful? Yes | No

    Default

    I am using a bit bang shift out so that part is no problem. I have done some more investigation and this is what things looks like:

    I have a working program and I add ONE new variable (Fire_Rate Var Byte), this code compiles to 5A7F and is working.

    I change the variable to Word size (Fire_Rate Var Word) this code compiles to 5ABF. This is 64 bytes larger but that can be explained with the 64 bytes blocks used in the 18F flash. This code does not work.

    If I change back to Byte size variable and use Define Reset ORG to trick the PIC into "making my program bigger" by adding 64 empty bytes in the begining the code compiles to 5ABF. This code is working.

    I take it from this that the problem is not related to the program size but to the allocation of RAM. The Fire_Rate variable is not used at all in the sub that has the problem, but obviously it is related in some way, most likely because it is changing the RAM allocation and bank select.

    I will look at the list file and see if I can come up with why and where things stops to work.

    Mike

  4. #4
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Do you have any BRANCH instructions which may need to be changed to BRANCHL ?
    Keith

    www.diyha.co.uk
    www.kat5.tv

  5. #5
    sinoteq's Avatar
    sinoteq Guest


    Did you find this post helpful? Yes | No

    Default

    Nope. Only old useful Goto and GOSUB. By the way I can't see anything strange with the LST file.

    Mike

  6. #6
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Check to see if you have a GOSUB to any routine that doesn't issue a
    RETURN to get back.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  7. #7
    sinoteq's Avatar
    sinoteq Guest


    Did you find this post helpful? Yes | No

    Default

    Thank you for all ideas but still no luck in fixing the problem. The program jumps to the sub but the sub makes some really strange things before it jumps back to where should. If I just remove the new variable or make it a Byte size things are working. I will see what happenes if I make 2 new byte size variables, that should be similar to making one word variable and using a word variable becomes crap.

    Later.....
    Mike

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Melanies RTC code has broken
    By keithdoxey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th October 2006, 15:22

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