FlexC problems
Rsadeika
Posts: 3,837
in Propeller 1
The program below compiles, but it is not starting the new COG. The FlexC docs and examples are very skimpy on showing how to start a new COG, at least for beginners.
I do not know why this is not working as expected.
Ray
I do not know why this is not working as expected.
Ray
/* cr2rpi.c */ #include <simpletools.h> struct __using("efds.spin") fds; struct __using("efds.spin") rpi; static long stack[32]; void start_rpi(); int main() { fds.start(0, 1, 0, 115200); pause(150); int startit = __builtin_cogstart(start_rpi(),&stack[32]); print("Here I am!"); while(1) { pause(500); } } void start_rpi() { rpi.start(2, 3, 0, 115200); char inBuff[40]; while(1) { rpi.rxstr(inBuff); if(!strcmp(inBuff,"gofore")) { rpi.str("Something!\n"); } pause(500); } }[i][/i]
Comments
Here's an example that flashes two pins in different cogs:
I am using efds.spin, which is ExtendedFullDuplexSerial.spin, because it has some commands like str(), and rxStr(). Now I noticed that when I have:
rpi.str("\n")
it is not working as expected, it only does a LF, and not a CRLF. Not sure if that is a problem with FlexC or with edfs.spin. When I tried using rpi.str("\r"), I get nothing.
I am also having a problem with using rxStr(), it seems like it is not reading the input, at all, or maybe incorrectly, not sure if this is problem with FlexC or with efds.spin.
Is there a functional FullDuplexSerial object that can handle reading incoming strings?
Another inconsistency, when I placed efds.spin, in the inc folder, and then tried:
struct __using("spin/edfs.spin") fds;
in the program, I kept getting an error that it could not find edfs.spin. Not sure why that is occurring.
Ray