Shop OBEX P1 Docs P2 Docs Learn Events
Trouble with simple RomEngine and TV.text program. — Parallax Forums

Trouble with simple RomEngine and TV.text program.

sccoupesccoupe Posts: 118
edited 2010-08-14 18:18 in Propeller 1
Im using the romengine and tvtext objects to do a simple assign a value to variable, write a different value to the variable eeprom location, read that eeprom value into variable2 and then print both variables to the screen. It should show "56", but doesnt work. I have the second write to the screen commented because it seems to lock the application like its a null value or something. Am I using the romengine correctly?

Thanks
CON

  _clkmode = xtal1 + pll16x
  _xinfreq = 5_000_000

  _clockDataPin = 29
  _clockClockPin = 28

VAR

  word  variable
  word  variable2
  
OBJ

  text : "tv_text"
  rom  : "I2C_ROMEngine"  

PUB start | i
 
  text.start(12)

  rom.ROMEngineStart(_clockDataPin, _clockClockPin, -1)

  variable := "5"

  rom.writeword(@variable,"6")

  variable2 := rom.readword(@variable2)

  text.out(variable)
  'text.out(variable2)

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2010-08-14 16:43
    Does writing the word succeed? What exactly is returned from the read call (you could use text.hex(variable2, 4))?
  • sccoupesccoupe Posts: 118
    edited 2010-08-14 16:50
    kuroneko wrote: »
    Does writing the word succeed? What exactly is returned from the read call (you could use text.hex(variable2, 4))?

    text.hex(variable2,4) returns 0000

    So a null value i guess that the text.out cannot handle and crashes. Looks like the writing isnt working.
  • kuronekokuroneko Posts: 3,623
    edited 2010-08-14 17:00
    sccoupe wrote: »
    So a null value i guess that the text.out cannot handle and crashes. Looks like the writing isnt working.

    Passing 0 to text.out() will clear the screen. Is that what happens? Just to be sure, can you assign the result of rom.writeword() to e.g. variable2 and print it out with text.hex(variable2, 8)?

    How does text.hex(variable, 4) show up after assigning "5" to it?
  • sccoupesccoupe Posts: 118
    edited 2010-08-14 17:29
    kuroneko wrote: »
    Passing 0 to text.out() will clear the screen. Is that what happens? Just to be sure, can you assign the result of rom.writeword() to e.g. variable2 and print it out with text.hex(variable2, 8)?

    How does text.hex(variable, 4) show up after assigning "5" to it?

    text.out() is apparently what happens, yes its a clear blue screen. I thought it locked up.

    text.hex(@@variable, 4) shows 0045
    text.hex(@variable, 4) shows 08F0
    text.hex(variable, 4) shows 0035

    rom.writeword() isnt valid, so im not sure what you mean there.

    Thanks
  • kuronekokuroneko Posts: 3,623
    edited 2010-08-14 17:37
    sccoupe wrote: »
    text.hex(@variable, 4) shows 08F0
    text.hex(variable, 4) shows 0035
    That looks OK (just checking whether this function works).
    sccoupe wrote: »
    rom.writeword() isnt valid, so im not sure what you mean there.
    Apologies, that was short for
    variable2 := rom.writeword(@variable2, "6")
    

    And I just noticed, in your original code you write the "6" to the address of variable but attempt to read it back from the address of variable2 which explains why you get 0 back. Unless that's a typo. Can you verify?
  • sccoupesccoupe Posts: 118
    edited 2010-08-14 17:48
    This displays 0000
      variable := "5"
    
      rom.writeWord(@variable2,"6")
    
      variable2 := rom.readWord(@variable2)
    
      text.hex(variable2,4)
    


    This also displays 0000
      variable2 := rom.writeword(@variable2, "6")
    
      text.hex(variable2,4)
    

    Yes, the other part was a typo. :)
  • kuronekokuroneko Posts: 3,623
    edited 2010-08-14 17:59
    sccoupe wrote: »
    This also displays 0000
      variable2 := rom.writeword(@variable2, "6")
    
      text.hex(variable2,4)
    

    Well, that simply means that writing the word failed (it's supposed to return TRUE/-1). Time to check the wiring (or you could first start looking how far you get in the I2C driver). As I've never used to object you're on your own now. Are you using pull-ups on both lines like suggested in the driver source?

    Or maybe try a different I2C driver.
  • sccoupesccoupe Posts: 118
    edited 2010-08-14 18:04
    No, I only have the pullup on the SDA as is required for the propeller to load from the eeprom. I could try adding this. Will this effect the propeller boot operation?
  • kuronekokuroneko Posts: 3,623
    edited 2010-08-14 18:08
    sccoupe wrote: »
    Will this effect the propeller boot operation?

    No. Also, I just had a closer look at the driver you're using and it seems that it relies on there being a pull-up on both lines (level is controlled by manipulating dira only).
  • sccoupesccoupe Posts: 118
    edited 2010-08-14 18:18
    The added resistor allowed it to work. Thats about 6 hours wasted today for not following directions. :)

    Thanks much for your help. Now I can sleep tonight. LOL!
Sign In or Register to comment.