sending ascii prop to prop
in Propeller 1
hi everyone, quick question. i am sending 16 variable length names from one prop to another in "C" and here is a snipit of the code im using for each name. is there a faster or cleaner way to capture the incoming letters? thanks.
rxchark = 0; p = 0;
while(rxchark != '\r' && rxchark != '\n') { // no CR or LF
rxchark = fdserial_rxChar(transceiver); // get the name of the button to save
button1[p] = rxchark; // append char
p++;
}
button1[p] = '\0'; // append NULL
Comments
idx = 0; while (1==1) { charIn = fdserial_rxChar(transceiver); strName[idx++] = charIn; if (charIn == '\0') break; }
print("name = %s \n", strName);
to try and display it but my terminal is having problems.im sending
dprint(receive, "%s%c",button0, 0x00); //change text
button0 contains "low beams"
Have you tried this?:
dprint(receive, "%s%c",button0, '\0'); //change text
it may be somthing weird with the transceivers im using. can i connect the TX from one prop directly to the RX of another? to se if i can then receive a zero?
-Phil
I think you're probably right.
sending...
dprint(receive, "%s",button0); //change text fdserial_txChar(receive, '\0');
//
JonnyMac i adjusted your suggestion a little.
receiving...
#include "simpletext.h" #include "simpletools.h" // Include simple tools #include "fdserial.h" fdserial *transceiver; //HS-LC12S transceiver char button0[19]; // char button1[19]; // char button2[19]; // char button3[19]; // char button4[19]; // char button5[19]; // char button6[19]; // char button7[19]; // char button8[19]; // char button9[19]; // char button10[19]; // char button11[19]; // char button12[19]; // char button13[19]; // char button14[19]; // char button15[19]; // //----------------------------------------------------------------- int main() { //simpleterm_close(); high(10);//LC12S SET pin // RX-TX transceiver = fdserial_open(0, 1, 0, 9600); // p0-p1 transmit to receiver pause(100); while(1) { char charIn = 1; char strName[19]; int idx = 0; fdserial_rxFlush(transceiver); // flush rx buffer while (charIn != '\0') { charIn = fdserial_rxChar(transceiver); strName[idx] = charIn; idx++; //if (charIn == '\0') // break; } printi("strName = %s \n", strName); pause(1000); print("%c", CLS); }
but now how to i get whats stored in strName[19] into button0[19]? button0 = strName; dosent seem to work.