Jump to content
43oh

SCI read and write


Recommended Posts

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
 
 
 
 
 
 
Link to post
Share on other sites

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.
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...