Shop OBEX P1 Docs P2 Docs Learn Events
1 wire problem — Parallax Forums

1 wire problem

Jon87Jon87 Posts: 14
edited 2010-06-17 16:12 in Propeller 1
Hi, I've got a problem with initializing objects in my program.

The problem is that if i initialize them in my start method, the 1 wire comms will not work correctly but if i initialize them in my main method, it works fine.

Does anyone know what might be causing this?

Thanks

OBJ

  text : "tv_text"
  ow   : "SpinOneWire" 
  
  
PUB start


  'text.start(12)
  'ow.start(3)
  main


PUB main | i, numDevices, addr1
  text.start(12)
  ow.start(3)
  text.out($00)
  .......
  .......etc

Comments

  • pullmollpullmoll Posts: 817
    edited 2010-06-17 14:36
    Jon87 said...
    Does anyone know what might be causing this?

    Not really. What happens if you give start some local variables (like main), just to see if perhaps some code is accessing the stack in a buggy manner.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pullmoll's Propeller Projects
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-06-17 15:10
    1-Wire is really finicky about timing and I have a hard time believing that Spin is fast enough for reliable OW comms; you might try one of the PASM drivers (I wrote one) in ObEx.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • Jon87Jon87 Posts: 14
    edited 2010-06-17 15:13
    I don't really know what local variables i could add to prove/disprove anything

    I'm currently working on a project which is using a few objects for reading IR codes, serial comms, keyboard input, reading and writing to eeprom and tv text. The only part that wont work is the 1 wire comms. I beleive it may have somehting to do with the direction change of the pin (input/output) throughout comms. I might try a different 1 wire comms object which uses a seperate cog to see if that helps

    Another question. how long does it take to stop or start a cog?
  • pullmollpullmoll Posts: 817
    edited 2010-06-17 15:27
    Jon87 said...
    I don't really know what local variables i could add to prove/disprove anything
    Well, it was just an idea, because the stack contents is about the only difference when you move the object calls
    Jon87 said...
    Another question. how long does it take to stop or start a cog?
    That should be in the order of 512 * 16 cycles + some more IIRC. 16 cycles is the hub window and there are 512 longs to be copied or initialized to zero. Someone else may know better.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pullmoll's Propeller Projects
  • Jon87Jon87 Posts: 14
    edited 2010-06-17 16:12
    pullmoll said...

    That should be in the order of 512 * 16 cycles + some more IIRC. 16 cycles is the hub window and there are 512 longs to be copied or initialized to zero. Someone else may know better.

    Thanks, as long as it's faster than the human eye can see it should be fine for my project.

    The program is working fine now in PASM
Sign In or Register to comment.