(Catalina) printf, serial output, i2c
Hello,
I have the "Propeller demo board" from Parallax, I feel comfortable using the c language and would like to use Catalina to achieve some projects.
But I don't have a tv screen, nor a vga screen, nor a keyboard, nor a mouse, dedicated to my projects, and I'm not planning to have this extra equipment.
I'm would like to use the serial line (connected to the PC and used to transfer the binaries) as the output of printf to display all sorts of data I need.
How can I do this with Catalina? Is there a terminal?
Now another question about serial communications:
Let's imagine I would like to make the Propeller communicate with some other modules which can only use serial synchronous or also asynchronous communications.
Is there an easy way to do this with with Catalina ? (a library, an example, a built in function, anything)
Just like with basic stamps serout, serin, etc.
Same question but with i2c ?
On the pins connected to the eeprom and also on any pin I'd like.
Finally, I'm not yet very familiar with the propeller yet, I have only done the complete tutorial in the help file of the "Propeller Tool" from Parallax, which is a good demonstration of the possibilities of the chip and the Spin. But I'm not comfortable with the new Spin language. I'd love to use C with this great chip, and Catalina seem to offer multi-threading, a standard c math library, and the ability to store files. To help you evaluate my knowledge for your answer, I'm a C/C++ developer on various platforms (Windows, Solaris, Mac, Linux, BSD, Microchip), and I have also developed on Parallax Javelin Stamps and Basic Stamps.
Thanks in advance for your help.
I have the "Propeller demo board" from Parallax, I feel comfortable using the c language and would like to use Catalina to achieve some projects.
But I don't have a tv screen, nor a vga screen, nor a keyboard, nor a mouse, dedicated to my projects, and I'm not planning to have this extra equipment.
I'm would like to use the serial line (connected to the PC and used to transfer the binaries) as the output of printf to display all sorts of data I need.
How can I do this with Catalina? Is there a terminal?
Now another question about serial communications:
Let's imagine I would like to make the Propeller communicate with some other modules which can only use serial synchronous or also asynchronous communications.
Is there an easy way to do this with with Catalina ? (a library, an example, a built in function, anything)
Just like with basic stamps serout, serin, etc.
Same question but with i2c ?
On the pins connected to the eeprom and also on any pin I'd like.
Finally, I'm not yet very familiar with the propeller yet, I have only done the complete tutorial in the help file of the "Propeller Tool" from Parallax, which is a good demonstration of the possibilities of the chip and the Spin. But I'm not comfortable with the new Spin language. I'd love to use C with this great chip, and Catalina seem to offer multi-threading, a standard c math library, and the ability to store files. To help you evaluate my knowledge for your answer, I'm a C/C++ developer on various platforms (Windows, Solaris, Mac, Linux, BSD, Microchip), and I have also developed on Parallax Javelin Stamps and Basic Stamps.
Thanks in advance for your help.
Comments
Hello allaiks,
To use Catalina with a PC terminal emulator, you just define the PC symbol when linking your program. This works with the standard Parallax Serial Terminal, or with any other terminal emulator. To define this symbol on the command line just add -D PC to your command (the -D just means "define"). Since you have a Demo board, a complete command might look something like this (note that case is significant - so -D PC is not the same as -d PC or -D pc):
From Code::Blocks, you can do exactly the same thing - just go to Project->Build Options and select the PC option from the list of available HMI options, and the DEMO board from the list of available platforms.
As to your other questions, do you want a serial port in addition to the one you use as the HMI? There is no "out of the box" plugin to add another serial port - but with Catalina 3.1 you can now add your own serial port driver (or I2c driver) using any of the standard OBEX drivers - for examples on how to use an OBEX driver in Catalina, see the examples in the demos\spinc folder.
If you get stuck, just ask here in the forums (or send me a message).
Ross.
Thanks so much for your help,
Now, since I have defined the PC symbol, I get the error: For this code I have included stdio.h which I know contains the declaration of printf, thing I have even verified by editing the file.
Hum, there must be an explanation here :-)
You have not told the linker which C libraries to include. On the command line, you would add an option like -lc or -lci. If you are using Code::Blocks, you should instead check the Project->Build Options and make sure that one of the variants of the standard C libraries is selected.
Ross.
But where am I suppose to see the "Hello world!" string?
Since you selected the PC HMI option, it will be sent to serial output. If you open your terminal emulator you should see it - but note that the program may have already finished by the time you do so. If that is the case, make a simple modification to your program to print the output in a loop:
Now when you load it and start the program it will still be sending output when your terminal emulator starts up (make sure your terminal emulator program is set to 115,200 baud, and select the same com port you used to program the Propeller).
Ross.
I'm working on adding my own terminal emulator into Code::Blocks to do just that!
In the meantime, you could try a program like the following - it will wait till you press the space bar before executing:
Ross.
Ross.