#1
| |||
| |||
![]()
Coding For File Transfer Using Rs232c Interface In Java Java is a programming language originally developed by James Gosling at Sun Microsystems at present part of Oracle Corporation and released in 1995 as a core component of Sun Microsystems' Java platform. Coding For File Transfer Using Rs232c Interface In Java File Transfer using RS232C #include #include #define COM1 0 #define DATA_READY 0×100 #define SETTINGS(0×80|0×02|0×00|0×00) #include int main(void) { char msg[1000], msg_in[1000]; char str[1000]; int status, out, in, i=0, extra; FILE *fp; int choice; char c[1000]; printf(“\n1. Send or 2.Receive”); scanf(“%d”, &choice); switch(choice) { case 1: { bioscom(0,SETTINGS,COM1); printf(“Enter the file name\n”); scanf(“%s”, str); while(1) { status=bioscom(3,0,COM1); if(status && DATA_READY) { fp=fopen(str,”r”); while((c[i]=getc(fp))!=EOF) { bioscom(1,c[i],COM1); printf(“%c”, c[i]); i++; } break; } } } case 2: { bioscom(0, SETTINGS, COM1); fp1 = fopen(“str.c”, “w”); while(1) { status=bioscom(3,0,COM1); if(status && DATA_READY) { while((sam=bioscom(2,0,COM1)&0x7f!=0) { msgbox[i]=sam; printf(“%c”, msgbox[i]); fprintf(fp1, “%c”, msgbox[i]); i++; } break; } } } } getch(); return(0); } Last edited by Aakashd; February 16th, 2020 at 03:38 PM. |
#3
| |||
| |||
![]() About RS232C for Data Transfer RS232 is an Interface and the protocol between DTE(data terminal equipment) and DCE(data communication equipment) using serial binary data exchange. Here C is used for the current version. Universal Asynchronous Data Receiver & Transmitter (UART), attached in a motherboard, used in connection with RS232 for transmitting data to any serial device like modem or printer from its DTE interface. Please find the below attached file for details of Coding For File Transfer Using Rs232c Interface In Java: Coding For File Transfer Using Rs232c Interface In Java ![]() ![]() ![]() ![]() link.springer.com/content/pdf/bbm%3A978-1-4613-1207-9%2F1.pdf Below I am providing you the coding for Create new class in JAVA: Create new class named ListAvailablePorts.java and paste following code. import gnu.io.CommPortIdentifier; import java.util.Enumeration; public class ListAvailablePorts { public void list() { Enumeration ports = CommPortIdentifier.getPortIdentifiers(); while(ports.hasMoreElements()) System.out.println(((CommPortIdentifier)ports.next Element()).getName()); } public static void main(String[] args) { new ListAvailablePorts().list(); } }
__________________ Answered By StudyChaCha Member |