Login Form

The PIC18F4550 contains a USB module embedded, so we only need to add our programming code =)

Note that for this little project I am using the jPicUsb library.

The idea of the following java code is to send the value 127 through the USB port to the PIC microcontroller. 

package com.jvs.micro.usb;
import jPicUsb.iface;
public class USB_SendCmd {
	public static void main(String[] args) {
		try {
			iface.load();
			System.out.println("Library is loaded!");
		} catch (Exception e) {
			System.out.println(e.toString());
		}
		byte[] out = new byte[] { 127 };
		String value = new String(out);
		while (true) {
			try {
				System.out.println("Writing: " + value);
				iface.QWrite(out, 6, 1000);
				Thread.sleep(1000);
			} catch (Exception ex) {
				System.out.println("ERROR: " + ex.getMessage());
			}
		}
	}
}

Read more: Send simple data from a Java application to a PIC18F4550 through USB

contacts Contactanos

 

bugs Reportar bugs

about Acerca de www.tecnohobby.net

Go to top