need help in lookup


Closed Thread
Results 1 to 28 of 28

Hybrid View

  1. #1
    Join Date
    Apr 2009
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    thank you so much joe,its good i got more ideas from that thread you added,see you soon joe

  2. #2
    Join Date
    Apr 2009
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    hi again joe.
    im trying to make a counter from 0 to 9999, i want to use the same code u fixed for me' well i use 74hc164 and 4 digit l7segment leds now i want to write a variables for 4 digits and shiftout, if it will works please im putin digits in porta.0 to 3, im confused how to use a variable works with shiftout, have a great day Joe .!

    ' I2CREAD and I2WRITE Commands

    Include "modedefs.bas"

    DEFINE SHIFT_PAUSEUS 1000
    SDO VAR PortB.0
    SCLK var PortB.1

    SCLK = 8

    DPIN var PORTA.0
    CPIN var PORTA.1
    B0 var byte
    B1 var byte
    B2 var byte

    N var byte
    portB = 0
    TRISB = 0

    pause 100

    For B2 = 0 To 9
    lookup b2,[252,96,218,242,102,182,190,224,254,246],b0
    I2CWRITE DPIN,CPIN,$A0,b2,[ b0]
    Pause 20
    Next B2

    loop: For B3 = 0 To 9
    I2CREAD DPIN,CPIN,$A0,b3,[B1]
    pause 1000

    SHiftOUT SDO,SCLK,0,[b1]
    '
    Next B3

    Goto loop
    end
    Last edited by malwww; - 12th May 2009 at 18:03.

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


    Did you find this post helpful? Yes | No

    Default more info required

    Hi malwww,
    are you using the eeprom in this counter or just a display? Are you wanting to load count into eeprom and then display the results or just count to 9999? Am I correct in assuming SDO & SCLK are for the display ?

    It is pretty easy once you get the hang of it, overflow your counter variable into another variable and sort @ display time using the DIG statement. Look at this thread to see how, post #9 is where I posted the code to which I refer. http://www.picbasic.co.uk/forum/showthread.php?t=9037
    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.

  4. #4
    Join Date
    Apr 2009
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    hi joe im using the eeprom to save data and count them,just want to know how to vary the digits when enable digit 1 it shift out the data or number to digit 1 then digit 2 so on and remember im using shiftout to 74hc164 to drive 7 sigment digits,i want to drive 4 digit with shiftout, i will check this thread you gaved me thank you so much joe
    Last edited by malwww; - 12th May 2009 at 23:32.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by malwww View Post
    hi joe I'm using the eeprom to save data and count them,just want to know how to vary the digits when enable digit 1 it shift out the data or number to digit 1 then digit 2 so on and remember im using shiftout to 74hc164 to drive 7 sigment digits,i want to drive 4 digit with shiftout, i will check this thread you gaved me thank you so much joe
    I buy 4 digit displays from http://www.sureelectronics.net/ , usually through their eBay store. For about 15 US you get an spi display that works exactly with the code in your lookup table and it is about 32mm tall, 1 1/2 inches tall. These displays can be hooked together using cables supplied with them to make several digit displays. BTW, God helps us every day, that's why we do not starve.
    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.

  6. #6
    Join Date
    Apr 2009
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    hello joe i wrote this code now it works the 7segment and shiftout .but when i vary things it doesnt works and it doesnt show me things, i want to know where i put a variables and how, is pic cant run 2 things in the same times ? (variables and shiftout with digit out) and i keep the shiftout how it is now , please help now it show me 3210 on leds 7segments ,sorry i cant find lcds in my country and i cant send money to buy from europ or usa bcz they dont alow us to send money out, i need to call my friends in spain to buy me them but it will take long 'now im new in pbp i want to learn a bit good and sorry about my english , thank you joe


    ' I2CREAD and I2WRITE Commands

    Include "modedefs.bas"
    'DEFINE SHIFT_PAUSEUS 1

    DEFINE OSC 4
    SDO VAR PortB.0
    SCLK var PortB.1
    DPIN var PORTA.0
    CPIN var PORTA.1
    B0 var byte
    B1 var byte
    B2 var byte
    B3 var byte
    B4 var byte

    symbol Digit_1 = portb.4
    symbol Digit_2 = portb.5
    symbol Digit_3 = portb.6
    symbol Digit_4 = portb.7
    SCLK = 8

    TRISB = 0
    ' i did a variable here lookup or read but it dont work or shiftout,

    main:
    Digit_2 = 1
    Digit_3 = 1
    digit_4 = 1
    SHiftOUT SDO,SCLK,0,[252]
    Digit_1 = 0

    pause 1
    Digit_1 = 1
    Digit_3 = 1
    digit_4 = 1
    SHiftOUT SDO,SCLK,0,[96]
    Digit_2 = 0

    pause 1
    Digit_1 = 1
    Digit_2 = 1
    digit_4 = 1
    SHiftOUT SDO,SCLK,0,[218]
    Digit_3 = 0

    pause 1
    Digit_1 = 1
    Digit_2 = 1
    digit_3= 1
    SHiftOUT SDO,SCLK,0,[242]
    Digit_4 = 0

    pause 1
    goto main

    end
    Last edited by malwww; - 13th May 2009 at 18:17.

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


    Did you find this post helpful? Yes | No

    Default

    Here is what your code is doing

    Quote Originally Posted by malwww View Post
    hello joe i wrote this code now it works the 7segment and shiftout .but when i vary things it doesnt works and it doesnt show me things, i want to know where i put a variables and how, is pic cant run 2 things in the same times ? (variables and shiftout with digit out) and i keep the shiftout how it is now , please help now it show me 3210 on leds 7segments ,sorry i cant find lcds in my country and i cant send money to buy from europ or usa bcz they dont alow us to send money out, i need to call my friends in spain to buy me them but it will take long 'now im new in pbp i want to learn a bit good and sorry about my english , thank you joe


    ' I2CREAD and I2WRITE Commands

    Include "modedefs.bas"
    'DEFINE SHIFT_PAUSEUS 1

    DEFINE OSC 4
    SDO VAR PortB.0
    SCLK var PortB.1
    DPIN var PORTA.0
    CPIN var PORTA.1
    B0 var byte
    B1 var byte
    B2 var byte
    B3 var byte
    B4 var byte

    symbol Digit_1 = portb.4 <font color=red> renaming portb.4 to Digit_1, These can only hold the value 1 or 0</font color>
    symbol Digit_2 = portb.5
    symbol Digit_3 = portb.6
    symbol Digit_4 = portb.7

    SCLK = 8 <font color=red> attempt to give portb.1 the value of 8 ???</font color>

    TRISB = 0 <font color=seagreen> set all port b as outputs</font color>
    ' i did a variable here lookup or read but it dont work or shiftout,

    main:
    Digit_2 = 1 <font color = blue> Make renamed ports HIgh. </font color>
    Digit_3 = 1
    digit_4 = 1
    SHiftOUT SDO,SCLK,0,[252]
    Digit_1 = 0

    pause 1
    Digit_1 = 1
    Digit_3 = 1
    digit_4 = 1
    SHiftOUT SDO,SCLK,0,[96]
    Digit_2 = 0

    pause 1
    Digit_1 = 1
    Digit_2 = 1
    digit_4 = 1
    SHiftOUT SDO,SCLK,0,[218]
    Digit_3 = 0

    pause 1
    Digit_1 = 1
    Digit_2 = 1
    digit_3= 1
    SHiftOUT SDO,SCLK,0,[242]
    Digit_4 = 0

    pause 1
    goto main

    end
    You need to put in the REQUIRED code to disable analog stuff for your chosen PIC too or it will not do the digital dance. You need to define the TRISA values to make the proper ports inputs or outputs.
    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