Faster DIG algorithm


Results 1 to 9 of 9

Threaded View

  1. #4
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Faster DIG algorithm

    /My english isn't good. Tabsoft got it right.
    I'll try to explain better...
    I have word variable Pressure.
    I need to extract digits from Pressure variable to 4 different variables for displaying on static 7 segment LCD.
    Offtopic:
    To dive LCD just connect pin to pin LCD with MCU, and in ISR XOR LAT with mask every 20mS or so...
    BANKSEL PORTA 'Select Bank
    MOVLW 11101111b 'Mask unused pins
    XORWF LATA,F 'Invert unmasked pins and write to LATA
    It should have lower power consumption than multiplexed LCD wit LCD module on PIC.

    Back to topic:
    One thing that I tried is to use DIG and 4 variable. If I can extract one digit much faster, then do same thing for all 4 digits. That is why I ask for faster extracting for one variable...
    Other way is to use arraywrite, and DEC4 to extract digit. Each byte in array will have one digit.

    Tabsoft, thank you. You give me an idea:
    Pressure = 1234
    tmpDig0 = Pressure // 10 'tmpDig0 =4
    pressure = Pressure / 10 'Pressure=123
    tmpDig1 = Pressure // 10 'tmpDig1=3
    pressure = Pressure / 10 'Pressure=12
    tmpDig2 = Pressure // 10 'tmpDig2=2
    tmpDig3 = Pressure / 10 'tmpDig3=1
    This will be probably ok. It takes just under 1,5mS.
    I didn't mention that I'm using PBPL and running on intosc at 16MHZ for all test.
    I'm waiting boards to arrive, so I can't measure current consumption jet. So there is always option to go back to PBPW.

    Thank you all.
    Last edited by pedja089; - 13th February 2015 at 09:52.

Similar Threads

  1. help about ds1804 (dig. pot.)
    By chailuck in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 7th August 2010, 10:33
  2. A Checksum Algorithm
    By amindzo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th December 2008, 22:33
  3. DIG DEC Madness
    By earltyso in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 13th June 2008, 23:05
  4. Use of DIG, DCD, NCD
    By websmith in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th November 2006, 06:14
  5. 'DIG' equivalent in other Languages?
    By Art in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th November 2005, 22:43

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