Quote Originally Posted by malwww View Post
hi Joe thank you again for explaining to me ,I have another question please if you dont mind...I want to write a string (lookup) to the external eeprom then I'll read it and send it out just to get more ideas because I'm new in pbp ,but its easier to learn than asm. have a great weekend Joe
Code:
'' I2CREAD and I2WRITE Commands

  Include "modedefs.bas"          
  DEFINE I2C_SLOW 1
  DEFINE SHIFT_PAUSEUS 1000
SDO VAR PortB.0
SCLK var PortB.1
         
SCLK = 8
SO      con     0                      
DPIN    var     PORTA.0                 
CPIN    var     PORTA.1               
B0      var     byte
B1      var     byte
B2      var     byte
B3      var     byte
n       var     byte 
portB = 0          
TRISB = 0 
 'for n = 0 to 15 <font color = red>' commented out </font color>

<font color=green>you have setup your variables, and stored nothing in them yet, and are proceeding to lookup the value of "n" which is unknown to you,</font color>
lookup  n,[252,96,218,242,102,182,190,224,254,246],b0 ' numbers from 0 to 9
 <font color=green>'the following loop will output the value stored in "n" filtered through the lookup table 15 times,
always the same number,in each eeprom location. 
why the str modifier? 
Seems to me the numbers in the lookup table are
not string values, as they would be arranged between
quotation marks like so "252","96" . . .</font color>
        For B2 = 0 To 15
                        
                I2CWRITE DPIN,CPIN,$A0,b2,[str B0\8]  
                Pause 20                
        
        
        Next B2
        'next n

loop:   For B3 = 0 To 15          
                I2CREAD DPIN,CPIN,$A0,B3,[B1] 
                 pause 1000
                
                SHiftOUT SDO,SCLK,0,[b1]
                       '
                      
        Next B3

        

        Goto loop
        end
i wrote this code but it doesnt shiftout the numbers from 0 to 9 like i have in the string .but it works good with last programe you fixed for me .see u joe
are you seeing what you need to change ?