PIC Microcontroller Interface with Java on PC using USB

Hi! I want to associate the PIC18F4550 with a Java program and first make it cross-platform. There is only one way that I am now Java: javacomm . But I want it to be USB, because not every laptop has an RS232 port at present. Waht are the ways PIC interacts with Java, can you suggest making it truly cross-platform and avoiding writing a driver for each new OS?

+4
source share
4 answers

The Arduino approach should be tailored to your needs: a microcontroller with hardware UART combined with the FTDI USB-to-TTL chip, then use rxtx to access the resulting serial port on 100+ platforms.

This approach seems to work well: communicating and programming arduino is very easy on Linux, Windows, and OS X.

+1
source

First disclaimer: I did not do this with PIC and Java, only with AVR32B from VB to PC.

If you use a USB CDC USB device on the USB interface of the microcontroller and connect it to a USB HOST computer, it will be listed and displayed as a new COM port. This is then processed by the application as a regular serial port. I used the standard USB driver USBSER.SYS.

I assume that the microchip provides an example of source code for their USB peripheral device so that it can work in different classes of devices. (I know what Atmel does for the AVR32 families)

+2
source

Why did you accept the answer above? I agree with @Ian's comment.

The PIC18F4550 and its friends have a built-in USB. It is easy, and there are many examples to place a virtual serial port in PIC firmware. Another one is the HID device, again many examples of PIC firmware.

Do not add extra equipment to the pudding.

+2
source

You need to use JNI to directly call WIN32API. I used the JNA library (JNI wrapper) to make the implementation easier and make the DLL to export simpler and more direct methods in Visual C ++ 2010. You can also create other libraries (DLL / SO) using the same interface with other systems such as OSX and Linux.

+1
source

Source: https://habr.com/ru/post/1302456/


All Articles