Shop OBEX P1 Docs P2 Docs Learn Events
What the H**Ks with this print stuff? — Parallax Forums

What the H**Ks with this print stuff?

DomanikDomanik Posts: 233
edited 2014-11-23 19:41 in Learn with BlocklyProp
GRRrrrrrr! Been chasing my tail in simpleIDE until I stumbled on this oddity. Apparently "printf" needs a "print" statement in order to load. The binary is 5k smaller without the "print". I like all caps in hex so I use printf when needed.

/*
Nothing prints until the "print" comment is un-commented and then
it kinda works, except "print" doesn't print uppercase HEX?
*/
#include "simpletools.h"
int main()
{

printf("Hello World %04X --- %04x\n", 250, 250);
//print("Hello World %04X --- %04x\n", 250, 250);

}


Dom..

Comments

  • Dave HeinDave Hein Posts: 6,347
    edited 2014-11-23 13:33
    printf should work without print. The printf is probably coming out before the terminal is ready. Add a one second delay at the beginning of your program and you should see the output from the printf.
  • DomanikDomanik Posts: 233
    edited 2014-11-23 13:43
    Dave Hein wrote: »
    printf should work without print. The printf is probably coming out before the terminal is ready. Add a one second delay at the beginning of your program and you should see the output from the printf.

    You're right. Adding a pause(300) makes it work. Thanks Dave.

    PS: Fixed my original program too. Thanks +1

    Also, when run from eeprom does't need a pause, so it's probably related to the IDE downloading/handshake/delay of releasing the terminal to the ap.
  • GenetixGenetix Posts: 1,754
    edited 2014-11-23 19:41
    BASIC Stamp programs commonly had a PAUSE 1000 to allow Windows enough time to initialize the serial port before messages were sent to be displayed.
Sign In or Register to comment.