Code check and refinement suggestions?


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,621


    Did you find this post helpful? Yes | No

    Default Re: Code check and refinement suggestions?

    Hi,
    Yes, if you want (or don't but can live with) leading zeros then use DEC3 (or DEC2, DEC4 etc) to specify the number of digits with which the number will be displayed. In Chris's case he's trying to right justify the displayed number (without leading zeros) so he's determining the number of digits in the number and then prints "leading spaces" to erases what ever might be there from before. Again - whatever works.

    /Henrik.

  2. #2
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Code check and refinement suggestions?

    An approach I've used for adding ICSP on a thru hole project where one isn't installed is to solder the important leads ICSPDAT, ICSPCLK and MCLR to a socket that will go between the the chip and the circuit card. As long as the circuit won't inhibit the loading because of a lowish resistance on clk or data you can install this temporarily and remove it when you're finished. Though I've yet to figure out a work around for surface mount projects.

    I've learned it isn't much more expensive to add the ICSP header and a switch to isolate the chip when needed for loading a program. I know this approach isn't possible in all instances but if you've got the space why not use it.

    Finally I want to thank you guys for helping out Kevlar and explaining why your code helps/is faster/more accurate. Exactly what I need to improve my capabilities.

  3. #3
    Join Date
    Dec 2005
    Location
    Salt Lake City, Ut, USA
    Posts
    108


    Did you find this post helpful? Yes | No

    Default Re: Code check and refinement suggestions?

    Thanks WD, Henrik and Avionics,

    I was pondering the leading zero method, which certainly is not a deal breaker for me...I just thought it would be sexier to right justify If I find a need for a tad more speed, I'll definitely use leading zeros. On the ICSP thing, I think I might modify my board to have it. I think my short term pain in changing the etch would pay off well in the long term, which is usually the case in life isn't it... Did you guys happen to have any thoughts on the RPM Sub? Another thing I noticed is, what are the odds that I may miss an encoder index pulse while inside the Timer ISR (because I disable the IOC Interrupt)? Are there any ways that I could safeguard against this situation, or should I sweat it? This will obviously be a more critical situation at low rpm...

    I can't thank you guys enough for your thoughts and willingness to help (Ditto what Avionics wrote ),
    Chris

    EDIT: Sorry Henrik, I completely missed your previous post in regards to the RPM thing. I thought about that A or B channels, which would be way more accurate...if I only knew how many PPR they are (way old proprietary Renco's from a ct scan machine). I suppose it would be pretty simple to whip up some code to count the pulses as I rotate the motor by hand...hmmmm.
    Last edited by kevlar129bp; - 30th July 2013 at 23:51. Reason: Missed Henrik's first reply

Similar Threads

  1. Replies: 3
    Last Post: - 13th September 2008, 17:40
  2. Your Suggestions: Assembly code material?
    By dw_picbasic in forum General
    Replies: 1
    Last Post: - 2nd February 2007, 17:33
  3. Can some one please check my code out thanks
    By Jhdgkss in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 10th February 2006, 08:19
  4. Pushbutton code routine suggestions?
    By jessey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd September 2005, 01:02
  5. Code check (sorry)
    By barkerben in forum General
    Replies: 5
    Last Post: - 30th November 2004, 15: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