Shop OBEX P1 Docs P2 Docs Learn Events
Updating variables from another object running assembly — Parallax Forums

Updating variables from another object running assembly

parskoparsko Posts: 501
edited 2006-08-20 22:52 in Propeller 1
Hey guys,

I have asked this before, but thought it better to create a new post.

I have a Top Object. I want this to update a TV display with a variable (DDD for example).
DDD is passed to the separate object, from the Top Object, and updated by the assy program.

One great example which was for a Spin program, can be found at:

http://forums.parallax.com/showthread.php?p=596723

I want to do EXACTLY was dan (sawmiller) is doing in his ADC program, except my final number is created via Assembly code. Actually, my example is also an ADC value (that I have been working on for years, it seems). Dan calls his ADC object from a main program to display the value.

I feel one problem I am having is the ADC object is ending, and my variable is disappearing. I can't figure out a way to keep the updated variable active.

Any thoughts?

-Luke

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-08-20 18:42
    PUB Start(AAA)
      coginit(cogid,@shiftin,AAA)
    '  The coginit will not return here because the assembly routine is started in this cog.
    '  AAA already is an address in main (HUB) memory, so you don't have to do anything
    '  to it.  Your shiftin routine takes the address in PAR, fetches the data, does its thing,
    '  and stores a new value back into the variable.  The only issue is 1) Finding out when
    '  the assembly routine is done.  If your ADC routine can't return a negative number,
    '  I'd initialize the variable with -1, then wait in the main program for it to be changed
    '  to something else.  The ADC routine (at the rdlong) could check for a -1 and wait for
    '  a -1 to be there, then start the next conversion.  That way, your two routines are
    '  synchronized.  If you need some rapid samples, you could buffer several values in
    '  your main routine before displaying/processing them.
    
    
  • CJCJ Posts: 470
    edited 2006-08-20 19:55
    Parkso, I think I got it to operate the way you want it to, the problem was with the way the ADC object was working, so I just told it to use the Get_data routine, too many @s your second layer was calling the @ of the Temporary variables

    I don't have the hardware to test it out, so I hope it is good to go

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Who says you have to have knowledge to use it?

    I've killed a fly with my bare mind.
  • parskoparsko Posts: 501
    edited 2006-08-20 22:04
    CJ,

    Wow, that's it. Man, when you thought you've tried every combination, you realize you haven't. That's pretty easy. The "@" killed me over and over again. It really is easy (I shouldn't jinx myself).

    Attached is the final code...

    -Parsko
  • CJCJ Posts: 470
    edited 2006-08-20 22:52
    good to hear that it is working for you

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Who says you have to have knowledge to use it?

    I've killed a fly with my bare mind.
Sign In or Register to comment.