Shop OBEX P1 Docs P2 Docs Learn Events
hmc5883l compass rewrite help — Parallax Forums

hmc5883l compass rewrite help

stargazer2050stargazer2050 Posts: 89
edited 2014-10-31 05:20 in Propeller 1
Quickstart bd
Compass
like to turn off terminal and still run compass

In order to run the compass, the terminal must be on.
Ive coded out all but PUB heading. data is called term.dec (@e), calls "east", 0.

how would you rewrite so no 'term' thingys are used.

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-10-30 12:23
    Quickstart bd
    Compass
    like to turn off terminal and still run compass

    In order to run the compass, the terminal must be on.
    Ive coded out all but PUB heading. data is called term.dec (@e), calls "east", 0.

    how would you rewrite so no 'term' thingys are used.

    You didn't provide us with much information about the program you're using.

    It's certainly possible to use the compass without a terminal. You could either remove the serial portion of the program or just not connect it to the PC.

    What sort of output do you want?

    Here's a link to my attempt to use a HMC5883L to control some servos.
  • stargazer2050stargazer2050 Posts: 89
    edited 2014-10-30 12:42
    Hi duane,

    Using hmc5883l_demo.spin by parallax
  • stargazer2050stargazer2050 Posts: 89
    edited 2014-10-30 12:47
    Term.str (@N)
    Looks like it calls dat section.
    How to write around the serial portion.
    I need that cog!!
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-10-30 14:31
    Term.str (@N)
    Looks like it calls dat section.
    How to write around the serial portion.
    I need that cog!!

    All "Term.str(@N)" does is output the string labelled "N" to the terminal. As you can see in the DAT section the contents of the string is just the letter "N" and a terminating zero.

    I don't see a problem with just removing all the "Term." calls from the program.

    You could make the t1 and t2 variables in the Heading method global variables and then you could use these values in other parts of your program.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-10-30 14:34
    I need that cog!!

    I don't know if you've ever tried Tracy Allen's four port serial driver, but it's an easy way of using fewer cogs if your program uses more than one serial port.

    I rarely run out of cogs myself. I usually run out of hub RAM first. If you're willing to post your code, I bet someone could help you conserve cogs.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-10-30 15:52
    There's an easier way to eliminate the terminal stuff from a program than going through and deleting all the calls. Just substitute a dummy object with the same PUBlic routines. For example, here's one that I call "Parallax Serial Terminator" that replaces "Parallax Serial Terminal"
    PUB Start(baudrate)
    PUB StartRxTx(rxpin, txpin, mode, baudrate)
    PUB Stop
    PUB Char(bytechr)
    PUB Chars(bytechr, count)
    PUB CharIn
    PUB Str(stringptr)
    PUB StrIn(stringptr)
      byte[stringptr]~
    PUB StrInMax(stringptr, maxcount)
      byte[stringptr]~
    PUB Dec(value)
    PUB DecIn
    PUB Bin(value, digits)
    PUB BinIn
    PUB Hex(value, digits)
    PUB HexIn
    PUB Clear
    PUB ClearEnd
    PUB ClearBelow
    PUB Home
    PUB Position(x, y)
    PUB PositionX(x)
    PUB PositionY(y)
    PUB NewLine
    PUB LineFeed
    PUB MoveLeft(x)
    PUB MoveRight(x)
    PUB MoveUp(y)
    PUB MoveDown(y)
    PUB Tab
    PUB Backspace
    PUB Beep
    PUB RxCount
      return 63
    PUB RxFlush
    

    The output routines do nothing. Except for strin and strinmax, which return a null string, and rxcheck, which returns 63 to keep a program from blocking, the other input routines return 0.

    -Phil
  • stargazer2050stargazer2050 Posts: 89
    edited 2014-10-31 05:20
    Hi duane & phil,

    Am using 0 to 360 azimuth by globally using value in aziadjust.
    Needed t1, t2 and aziadjust , blanked out rest in new semi blank method per phil.
    For some reason I still need to have a terminal running to get it to work, so I merged my serial1 input with the compass to save 1 cog, seems to work good.

    Ill start a new thread to get a lesson on pcfullduplexserialfc4. Been trying it for 6 weeks now. Finally got reguar fullduplex working.

    Thankyou both very much.
Sign In or Register to comment.