oblivion 0 Posted January 16, 2014 Share Posted January 16, 2014 Hi ! I have the C2000 launchpad. I would like to send character from my PC to C2000 with the SCI (so I want to read characters with the C2000 launchpad). (Example_F2802xSci_FFDLB.c and Example_F2802xSci_FFDLB_int.c don't work on my computer) I want use the "Example_F2802xLaunchPadDemo.c" program and modify it in order to do that. Someone does have already write something ? I assume I must re-write this part : //Redirect STDOUT to SCI status = add_device("scia", _SSA, SCI_open, SCI_close, SCI_read, SCI_write, SCI_lseek, SCI_unlink, SCI_rename); fid = fopen("scia","w"); freopen("scia:", "w", stdout); setvbuf(stdout, NULL, _IONBF, 0); TO : //Redirect STDIN to SCI fid = fopen("scia","r"); freopen("scia:", "r", stdin); setvbuf(stdin, NULL, _IONBF, 0); .... and use "getchar" to read character ???? Can someone help me ? Thank you. Regards, Oblivion Quote Link to post Share on other sites
TI_Trey 38 Posted January 17, 2014 Share Posted January 17, 2014 Oblivion, Yes, I believe you're correct. You would want to do something like this: status = add_device("scia", _SSA, SCI_open, SCI_close, SCI_read, SCI_write, SCI_lseek, SCI_unlink, SCI_rename); fid = fopen("scia","rw"); freopen("scia:", "w", stdout); freopen("scia:", "r", stdin); setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stdin, NULL, _IONBF, 0); I haven't tested this so I can't confirm it works, but it should be close. You can read about the CIO functions in the compiler users guide. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.