need help in lookup


Results 1 to 28 of 28

Threaded View

  1. #22
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    I wrote you a counter, here is the code, would you like fries and a coke?
    Code:
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF &_CP_OFF & _BODEN_OFF & _LVP_OFF
    
    DEFINE OSC 4
    
    SDO  Var PortB.4
    SCLK Var PortB.5
    DLE  Var PortB.7
    EECON1 = 7
    B0      Var WORD
    B1      Var byte
    
    D1      Var byte
    D10     Var byte
    D100    Var Byte
    D1000   Var Byte
    ONES    Var Byte
    TENS    Var Byte
    HUNS    Var Byte
    THOUS   Var Byte
    'WPUA = %00110001
    'ANSEL   = 0  ' FOR USE IN 16F690
    'ANSELH  = 0
    CCP1CON = 0
    'CM1CON0 = 0
    'CM2CON0 = 0
    CMCON = 7   ' Disable comparators 16F648A
    OPTION_REG = 0     '16f628a       
            'OPTION_REG = %00111000     ' set for 16f690  
    data @0,252,96,218,242,102,182,190,224,254,246
    Pause 10
     PORTB = 0
     PORTA = 0
     TRISB = %00000000 ' lower 4 pins outputs
     TRISA = %00000001 ' RA2 = TMR0 clock input
     
    Main:
    count portA.0,100,b1
     B0 = B0+B1   'STORE THE RESULTS BETWEEN COUNTER LOOPS
     If B0 >= 9999 then B0 = 0
    
    D1    = b0 DIG 0        ' Load Thousands Digit
        Read D1, ONES           ' Convert and Load Thousands Variable
    d10   = B0 DIG 1        ' Load Hundreds Digit
        READ D10,TENS           ' Convert and Load Hundreds Variable
    D100  = B0 DIG 2        ' Load Tens Digit
        READ D100,HUNS          ' Convert and Load Tens Variable
    D1000 = B0 DIG 3        ' Load Ones Digit
        READ D1000,THOUS        ' Convert and Load Ones Variable
    Shiftout SDO,SCLK,4,[ONES\8,TENS\8,HUNS\8,THOUS\8]   ' Send digits to display module 0
    PAUSE 10
    HIGH PORTB.7
    pulsout DLE, 125 
    pause 12
    Goto MAIN
    
    end
    Last edited by Archangel; - 14th May 2009 at 10:12.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. Graphic LCD with PICbasic pro
    By amindzo in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 25th November 2012, 11:45
  2. Lookup Table
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 11th March 2008, 10:38
  3. ADCIN and LOOKUP ...
    By Acetronics2 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 16th June 2007, 21:02
  4. problem with USART
    By leemin in forum Serial
    Replies: 4
    Last Post: - 11th December 2006, 17:56
  5. Confused On Dig & Lookup
    By SOMRU in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th December 2006, 21:49

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts