On the Atom, Atom Pro and maybe others the RS232 communication to the DB9 connector is done using bit bang functions and not using underlying hardware support. The underlying hardware H8 does have a hardware serial port that is connected to the external IO pins P14 and P15, but they are TTL level signals and not RS232 level signals.
You have a couple of choices, you could either write your own bitbang functions to talk to your debug window. I have been meaning to do this for the PRO for the same reasons. I debugged my last C code by turning on the BB2s LEDS for different conditions. I posted that code a few days ago with my I2C support functions…
Alternatively you could connect up something like a MAX232 chip to P14 and P15 to convert to the appropriate signal levels and then connect it to a DB9 connector…
On the Atom Pro, you have a choice. You can either use the basic or you can program the whole thing in C or C++, you can not mix the two. You can mix Basic with H8 assembly language. Assuming you have a 28 pin Atom Pro, you should have the H8/3694.
It would be great if Basic Micro exported a set of libraries that allow you to use their software functions, or alternatively, defined some form of interface that allowed you to add external modules that were callable from their basic. However that is not currently the case.
So in the mean time, it would be great if members who write something in C (or C++ or assembly) would post their code so others could use it. That is why I posted my first version of the I2C code (which I will rework to add more asyncronous support). maybe I will break down and import my serial bit bang functions from the AVR so I can debug this easier…
I am having a similar problem. I am trying to give commands serially through Matlab. Matlab says the bytes are being written but the robot does not move.
I am wondering if you changed this flowcontrol on matlab to be ‘hardware’? For me, some other programs work with no flowcontrol.
If I do change however, I get this error while trying to write 255 (one byte):
fwrite(s, [255])
??? Error using ==> serial.fwrite at 184
FWRITE can not be called when FlowControl is set to hardware and the PinStatus clear to send (CTS) field is off.
How do I change this pinStatus CTS field? Did you do that and it started working?